Insert or Update a target with no constraints
I am trying to figure out how to do an insert/update on a target table which doesn't have a constraint? In other words how to define a condition on this target table attribute to achieve this? please advice.
~Prabha
... you're right. But don't forget to set to No Constraints too. And proof your matching settings several times. Due to an error in 10gR2 the settings could change: Bug in OWB 10gR2: Several Loading Properties after sync
Regards,
Detlef
Similar Messages
-
How to insert or update comparing values with two or more table
Hai All
I have three or four table in my database.
Table 1 Dailattend is the main table here i need to insert or update my data and the fieds are
Emplcode number,attdate date, intime date,intrin date ,introut date, outtime date are the fields
Table 2 acclempbarcode the fields are
emplcode number ,barcode number ....etc
so now my data is in text format and i have broke the date like this
0011221100112200100320100815
First 16 is barcode and next 8 is date and 4 is time and i have created a temp table and store the date and move to main table
My problem is the main table dailattend has no barcode so when i am going to insert or update i need to check whether the barcode is match with the emplcode in the main table
How can i write insert or update statement
The data is like this
00110022 is barcode,10-03-2010 is my date and 0815 is time so i need to insert into dailattend table so now i have emplcode in dailattend table so i need to compare the barcode belong the emplcode in the another table and i need to insert in the dailattend table
Pls give me some solution with example
Regards
Srikkanth.Mtry somthing like this
create table t1
as
select '0011221100112200' barcode,to_date('100320100815','ddmmyyyyhh24mi') dt
from dual
create table barcodetbl
emplcode varchar2(2000)
barcode varchar2(2000)
datetime date
merge into barcodetbl bc
using( select * from t1) x
on
(bc.barcode = x.barcode)
when matched
then update
set datetime = x.dt
when not matched
then
insert (emplcode,barcode,datetime)
values(1,x.barcode,x.dt)
/didn't realize that barcode is not in the main table.
something along the lines
Table 1 Dailattend is the main table here i need to insert or update my data and the fieds are
Emplcode number,attdate date, intime date,intrin date ,introut date, outtime date are the fields
Table 2 acclempbarcode the fields are
emplcode number ,barcode number ....etc
merge into dailattend bc
using( select * from t1, acclempbarcode ac where t1.barcode = ac.barcode) x
on
(bc.emplcode = x.emplcode)
when matched
then update
set datetime = x.dt
when not matched
then
insert (emplcode,datetime)
values(1,x.dt)
/Alvinder
Edited by: alvinder on Mar 23, 2010 3:50 PM -
Execute a SQL-Insert after update the target
Hi to All,
my scenario is SQL_1 -> XI -> SQL_2, but after update the SQL_2, I need to execute an SQL-insert. Can I do this without BPM?
Regarts
RobertoHi Roberto,
If you want to insert the SQL_2 after updation of SQL_2 then BPM is not required.
After updating the target you can execute the insert operation. I think , you can go for Stored procedures here.
But if you want Response back to XI after successful Update, then BPM is required.
>>You can do this in the stored procedure. For e.g just check this blog-
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
Regards,
Moorthy
Message was edited by: Krishna Moorthy P -
Mapping problem with compressed key update record (target format)...
Hi Guys,
Getting below error while replication from Source to target. Source table is having NOT NULL Column, but on target replicat process giving error about some NULL value ??
How to overcome this issue, any idea...
2011-08-04 10:35:04 INFO OGG-00995 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: REPLICAT RMASTRK starting.
2011-08-04 10:35:05 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: REPLICAT RMASTRK started.
2011-08-04 10:35:06 WARNING OGG-00869 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: OCI Error ORA-01407: cannot update ("INFRA"."CUST"."CODE") to NULL (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"DP_ID" = :a3,"EXCHNG_CODE" = :a4,"ORD_QTY" = :a5,"ORD_PRICE" = :a6,"CODE" = :a7,"MKRT_CODE" = :a8,"CHANN>.
2011-08-04 10:35:06 WARNING OGG-01004 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Aborted grouped transaction on 'INFRA.CUST', Database error 1407 (ORA-01407: cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL).
2011-08-04 10:35:06 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Repositioning to rba 44132192 in seqno 68708.
2011-08-04 10:35:06 *WARNING OGG-01154 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: SQL error 1407 mapping INFRA.CUST to INFRA.CUST OCI Error ORA-01407:* *cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"DP_ID" = :a3,"EXCHNG_CODE"=:a4,"ORD_QTY"*
*= :a5,"ORD_PRICE" = :a6,"SCRP_CODE" = :a7,"MKRT_CODE" = :a8,"CHANN>.*
2011-08-04 10:35:06 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Repositioning to rba 44132192 in seqno 68708.
2011-08-04 10:35:06 ERROR OGG-01296 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Error mapping from INFRA.CUST to INFRA.CUST.
2011-08-04 10:35:06 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: PROCESS ABENDING.
Oracle GoldenGate Delivery for Oracle process started, group RMASTRK discard file opened: 2011-08-04 10:35:05
Current time: 2011-08-04 10:35:06
Discarded record from action ABEND on error 1407
OCI Error ORA-01407: cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL
(status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"MKRT_CODE" = :a8,"CHANN>
Aborting transaction on ./dirdat/pm beginning at seqno 68708 rba 44132192
error at seqno 68708 rba 44132192
Problem replicating INFRA.CUST to INFRA.CUST
*Mapping problem with compressed key update record (target format)...*
ORD_QTY = 500
ORD_PRICE = 37430
SCRP_CODE =
MKRT_CODE = N
Oracle GoldenGate Delivery for Oracle process started, group RMASTRK discard file opened: 2011-08-
04 10:35:05
Current time: 2011-08-04 10:35:06
Discarded record from action ABEND on error 1407
OCI Error ORA-01407: cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL
(status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"MKRT_CODE" = :a8,"CHANN>
Aborting transaction on ./dirdat/pm beginning at seqno 68708 rba 44132192
error at seqno 68708 rba 44132192
Problem replicating INFRA.CUST to INFRA.CUST
Mapping problem with compressed key update record (target format)...
ORD_QTY = 500
ORD_PRICE = 37430
SCRP_CODE =
MKRT_CODE = N
Any inputs / help would be appreciated.
Regards,
ManishThe SCRP_CODE column has a NOT NULL constraint. The ORA-01407 error is telling you that you cannot update or set a value for this column to null because of the constraint. This has absolutely nothing to do with an index. You can use a marker/sentinel value in lieu of using NULL. For a numeric field, where everything is positive, a negative value (-1) can be decoded as meaning null. For a character field, a code such as NA can represent NULL.
This also has nothing to do (directly) with GoldenGate failing because of this error. The underlying SQL statement will fail everywhere, regardless of the tool or application. It is not a case of failing only in GoldenGate. -
Insert or Update data in SAP with Business Objects?
Hi all,
I am new to Business Objects world with my little expertise in Crystal Reports and Xclesius.
Could you please clarify me that is there any solution or technology or Product of Business Objects which not only make impressive dashboards and analyze the data but also can communicate with back end SAP R/3 to save or update data.
We are actually analyzing our Client requirements in which there is a need of Dashboards as well as some custom configurations that needs to be saved somewhere in the SAP system in order to make decisions in future.
Our back end system is SAP BW. One possibility is to use Adobe Flex as a base architecture with BSP and BW but we are more concerned with what BOBJ provides.
Looking forward for your suggestions.
Kind Regards
Umer FarooqGR81 wrote:
I would like to know how I can insert or update data in a Google Spreadsheet from an Oracle Database please?
Thanks,you can't since Oracle knows nothing about spreadsheets; Google or otherwise. -
INSERT or UPDATE with multiple rows
Hi there!
I want to ask what I should do in the following case: I have to handle mutliple rows of data to insert OR to update into the database.
The first question is about how to decide whether I should take INSERT or UPDATE. I read here in the forum that I could take a SELECT-statement before, and, if it isn't null, I could update the resultset..if it is null I can make an INSERT-statement.
But now I a have multiple rows to update or to insert which I want to handle as a transaction (with a batch), so I don't want to check each row the way I described above. Does anyone has a hint ?
Thanks a lot in advance.This is not a problem with java but rather a problem
with databases in general. The solution generally
depends on the data that is being operated on.
If there is a primary key involved, and most records
were expected to NOT be in the database, then you
could just insert them in blocks (transaction/batch).
Each block would fail when a primary key duplicate.
Then you can process each block as individual
l statements. The ones that fail are done as
inserts.
The reverse of the above is used if you expect most
records to be in the database. Do updates and the
break out the blocks with failures to locate the
inserts.
Keep in mind that queries for keys probably will be
faster, but that requires that your keys are ordered.
If you keys are ordered then you can get a range from
the initial data. Use that to query the database for
keys between that range (only return the keys.)
Using the returned keys you can decide whether each
h record needs to be an update or insert (presort the
data into each group and batch each group for more
speed.)
If the data is really mixed and the database supports
it then you can write a stored proc (MySQL does not)
which decides whether an insert/update is needed.
Finally if you have large amounts of data, bulk
operations especially inserts are better done with
tools supplied by the database vendor. Instead of
using JDBC to do the insert/updates you write the
output to a file and pass the file to the tool. You
might use JDBC (again with the ordered key query) to
decide which operation to do. Although faster for
large sets this is problematic due to the error
handling that you have to add.
Thanks for this, jschell. I look for your answers, because they're on the money and written well. I learn a lot from them. - MOD -
Insert OR Update with Data Loader?
Hello,
can i Insert OR Update at same time with Data Loader?
How can i do this?
Thanks.The GUI loader wizard does allow for this including automatically adding values to the PICKLIST fields.
However, if you mean the command line bulk loader, the answer is no. And to compound the problem, the command line version will actually create duplicates for some of the objects. It appears that the "External Unique Id" is not really "unique" (as in constrained via unique index) for some of the objects. So be very careful when you prototype something with the GUI loader and then reuse the map on the command line version.
You will find that some objects can work well with the command line loader (some objects will not).
Works well (just a few examples):
Account (assuming your NAME,LOCATION fields are unique).
Financial Product
Financial Account
Financial Transaction
Will definitely create duplicates via command line bulk loader:
Contact
Asset
Also be aware that you might hear that during a go-live that Oracle will remove the 30k record limit on bulks loads (temporarily). I have not had any luck with Oracle Support making that change (2 clients specifically in the last 12 months). -
Updating records for parent & child with integrity constraints
Hello, I haven't used oracle in a few years and now running a lab and need to make a few changes for testing. no production data at all.
What is the easiest way to change the parent and child tables? When I try to change the parent, oracle barks that the child is neglected, when i try to change the child first, then the parent is mad.
If I need to set up a trigger, what is the simplest form?
thanks much!Depends on what you want your data to look like. Since it's test, I would do what janeesh said. Disable the constraint on the tables, write a script to UPDATE all the necessary values in the parent and child table, and then re-enable the constraint.
I like the idea of setting the constraint to ENABLE VALIDATE afterwards to check the data in the tables. This verifies that all the updates you did comply with the constraint. Essentially this just checks to see if you hosed anything in either table. -
In OWB I need to update the target table with same field for match/update
In OWb I am trying to update the target table with the match and the update on the same field can this be done. I am getting a error match merge error saying you cannot update and match on the same field. But in SQl my select is
Update table
set irf = 0
where irf = 1
and process_id = 'TEST'
Hwo do i do this in OWB.table name is temp
fields in the table
field1 number
field2 varchar2(10)
field3 date
values in the table are example
0,'TEST',05/29/2009
9,'TEST',05/29/2009
0,'TEST1',03/01/2009
1,'TEST1',03/01/2009
In the above example I need to update the first row field1 to 1.
Update temp
set field1 = 1
where field1 = 0
and field2 = 'TEST'
when I run this I just need one row to be updated and it should look like this below
1,'TEST',05/29/2009
9,'TEST',05/29/2009
0,'TEST1',03/01/2009
1,'TEST1',03/01/2009
But when I run my mapping I am getting the rows like below the second row with 9 also is getting updated to 1.
1,'TEST',05/29/2009
1,'TEST',05/29/2009
0,'TEST1',03/01/2009
1,'TEST1',03/01/2009 -
I have recently acquired an update for my mac OX the program being the snow leopard, i have been forever inserting the disk only to have it ejected by my mac, hence, i am unable to update my system with snow leopard, what can i do, as i have just paid out money for something which
Worked like a charm and resolved my problem totally. The only issue I had is that, unlike the Computer (Mac OS). the iPad doesn't give constant visibility to what it is doing (feedback), so I wasn't initially sure it had done anything.
When I opened my emailed message with .vcf file attached, and tapped the .vcf attachment icon, I saw activity on the icon for just a few seconds, then it reverted to the original with nothing apparently happening. After about 30 seconds, the secondary menut popped up indicating the transfer of 1200 addresses would be completed, if I approved the action. Another 10 to 15 seconds then transpired before the completed Contact list appeared on the ipad. So you must be patient, if you have a large Addressbook. That's reasonable,but unexpected lack of feedback left me wondering, like so many other things on the iPad.
THank you for the assist. Apparently Apples Mac Genius people did not know this procedure, and I will pass it on to my local Apple Store Instructor.
-- Chuck -
SQL INSERT / SQL UPDATE don't work with form page, don't affect table
The subject line says it all. No matter what I try, my updates on the form don't appear on the report page, which accesses the table. When I look at the table using SQL WORKSHOP, the changes aren't made there either. What am I missing? I have another report page and form page with a different table in the same application and updates in that table work fine. I coded them both the same. What should I be looking at?
Steve "the n00b" in Raleigh NCSteve,
How you have created the FORM page? Using FORM WIZARD? Or You have created blank page and after that you have manually created all the form items?
If you have used WIZARD to create form page, then you can see a page process with Automatic Row Processing (DML) type. Here you need can set DML (Insert/Update/Delete) you wish to use on this form. APEX will take care of the rest.
If there is no such process in your page, then you need to create one. You may have one process to do both (Insert and Update) and you can have two sepate processes. I prefer having two seperate page processes (after submit), one for Insert and one for Update.
Now you can make the Insert process conditional so that it only execute when you click button - Create (Add or any similar button you have ) Also make the Update process conditional so that it only execute when you click button - Save (Update or any similar button you have )
Just a quick note - From the above trigger, I can guess you are allowing users to enter Primary Key manually? In my opinion, Primary key should be always system generated using SEQUENCE. Users can only enter BUSINESS KEY (if any) and we should not use Business key as Primary Key.
Good Luck :-)
- Hari
Edited by: Hari_639 on Oct 23, 2009 8:02 PM -
When the update statement will check the constraint violation ?
Hello all,
i am working on data masking of production data using oracle Translate function.i have created a function otis_mask using translate function to mask sensitive values .For this i am tesitng on a small table. i have created a table with single primary key column SSN.
sql>desc SSN_MASK
Name Null? Type
SSN NOT NULL NUMBER(10)
1) i have inserted the value 9949577766. if resulted mask value exist in table it should throw the constraint violation error.But it is not throwing any error.rows are properly updating .
Eg:-
Table contains below values.
PA_DATA_SUB @qdsrih30 >select *from SSN_MASK;
SSN
7727399911
9949577766
9989477700
UPDATE SSN_MASK SET SSN=otis_mask(SSN);
if above update statement process 7727399911 first then resulted mask value is 9989477700.This value is already in the table.
if the update statement process 9949577766 first then resulted mask value is 7727399911.This value is already in the table.
in any of the above scenario update statement should have to throw constraint violation error. But its not happening. rows are properly updating . when the update statement checking the constraint violation ? after processing all the rows or processing of each row ?
Please help me in understandding the update statement processing ?
Thanks,
Venkat Vadlamudi.1)created a function as below.
CREATE OR REPLACE Function otis_mask(incol varchar2) return varchar2 is
random_str varchar2(20);
begin
select (translate(incol,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890','qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0842319576')) INTO random_str FROM DUAL;
return random_str;
end;
2. create a table ssn_mask.
create table ssn_mask(ssn number(10) primary key);
3) inserted 3 rows as below.
insert into ssn_mask values(9949577766);
insert into ssn_mask values(7727399911);
insert into ssn_mask values(9989477700);
4)UPDATE SSN_MASK SET SSN=otis_mask(SSN);
5) Table contains below rows.
Sql >select *from SSN_MASK;
SSN
9949577766
7727399911
9989477700.
6)UPDATE SSN_MASK SET SSN=otis_mask(SSN);
If the above statement process first row 9949577766,then otis_mask function will return 7727399911 and update statement will update the value of 9949577766 to 7727399911 .At this case 7727399911 is already in the table.So update statement should have to throw primary key constraint violation error.
If the above statement process second row 7727399911 first ,then otis_mask function will return 9989477700.and update statement will update the value of 7727399911 to 9989477700.At this case 9989477700 is already in the table.So update statement should have to throw primary key constraint violation error.
But its not throwing any integrity constraint violation error.
i just want to know when update statement will check the constraint ?
is update statement will first process all records and kepp in handy the new values then update the table with new values (or) process the first row and update the new value with old value then process second row and update with new value so on ?
Thanks,
Venkat Vadlamudi. -
Update OIM field with process form fields
Hi,
I have configured AD as a target resource to my OIM. Now i have a requirement to update few fields of OIM , on the basis of change in the fields of process form when target recon will run. For this, as per my understanding i can use the post insert/post update adapter. I wrote the adapter code as well. But when now i am running the recon against my resource, and updating the field, it couldn't even run the adapter as nothing has been written in logs (not even the println statements mentioned in adapter code :( ). Could anyone please tell me where i am missing.Hi,
I did create a task and assign it on "Event Processed" (Response) under reconciliation insert recieved and reconciliation update recieved. Now when i tried to run recon it is giving me error while processing the recon event. Error is "An error occured while processing the off lined reconciliation event. [xellerate.jms] processing reconciliation message with id <recon event id> failed" . Am i missing something.... Please help
TIA -
Error while updating to target
Hi Friends,
Im trying to load the data from the DSO to the cube, while loading the data im getting a error "Error while updating to target CUBE Name".
when i check the message in error stack im getting this "Value 'Complaints Resolution for Activity ' (hex. '0043006F006D0070006C00610069006E007400730020005200') of characteristic ZWF_NAME BRAIN 60"
I found a notEe 1148007, this not says that
"A program to write data is generated for each InfoCube that contains data (type "Standard"). The name of this program is stored in the table RSDCUBELOC. When you activate an InfoCube again, the name of this program may inadvertently be deleted.
In the DTP monitor, this error occurs in the "Update" step and message RSBK 241 is displayed: "Error while updating to target G7SD0C05 (type INFOCUBE)"
I have checked the table RSDCUBELOC and i can see the program entry there and after that i have reactivated the cube and reloaded the data but im still getting the same issue.
Can anyone pls suggest me how to resolve this issue?.
Thanks in advance
BNHi,
It is issue with the Lowe case letters of a particular info object. You have to write a routine to convert those lower into upper.
reason is if you chack IOB properties Lower case might be unchecked and the data you are getting in lower case.
Let us know the details if you still have any issues.
Reg
Pra -
Issue in Data from DSO to DSO Target with different Key
Hello All,
I am having Issue in Data from DSO to DSO Target with different Key
Source DSO has Employee + Wage + Post numner as key and Target has Employee + Wage Type as key.
DSO semantic grouping works like Group By clause in sql, is my understanding right ?
Also if someone can explain this with a small example, it would be great.
Many Thanks
KrishnaDear, as explained earlier your issue has nothing to do with semantic grouping .
Semantic grouping is only usefull when you have written a routine in the transformation for calculations and in error handling .
Please go through this blog which explains very clearly the use of semantic grouping .
http://scn.sap.com/community/data-warehousing/netweaver-bw/blog/2013/06/16/semantic-groups-in-dtp
Now coming to your above question
DSO 1
Employee WageTyp Amount
100 aa 200
200 aa 200
100 bb 400
100 cc 300
If we have semantic group as Employee . If we have Employee as key of the target DSO and update type as summation .
then target DSO will have
Emp Amount
100 700
200 200
In this case Wage type will be the last record arriving from the data package . If the record 100 cc 300 is arrivng last then wage type will be cc .
2) Case 2
DSO 1
Employee WageTyp Amount
100 aa 200
200 aa 200
100 bb 400
100 aa 300
if we do Semantic grouping with Emp and Wage Type If we have Employee and wage type as key of the target DSO and update type as summation .
then target DSO will have
Emp Wage Amount
100 aa 500
200 aa 200
100 bb 400
Hope this helps .
Maybe you are looking for
-
I can no longer connect to the available wi fi networks with my ipad 1
For some reason I can no longer connect to the available wi-fi networks with my ipad...help
-
OIM 11g R1: How to export Users
Hello, how can i export users to an ldif, csv or xml file from OIM? I need an automated process, which give me a list of special users and their attributes to import this to another system.
-
Private vs. protected, naming conventions etc.
I've been grappling with a couple of frustrations with Forte, and I'm interested in feedback from others on this list regarding approaches they may have adopted to address these. One is that in the Forte workshops there is no way to view only the pub
-
Closing Application Sharing Session leads to Exception
Hi everybody, I have successfully configured the application sharing on a EP 7.0 (SP10). We have testet it and it works just fine. However, when the initiator closes the session, he gets an exception: com.sapportals.portal.prt.component.PortalCompone
-
Are there any hot fixes or releases due soon?
It's been a while since I've seen anything released from the update centre. Are there any fixes due for release soon? Despite several months, a few hot fixes and the JSC2 Update 1 release, JSC2 doesn't seem to have improved all that much since the in