Yes, it can be done,
I'd write the trig to do a select on that PK and if %FOUND is true, update
otherwise in the exception handler for that block, do the insert.
begin
..
begin
select PK from table;
UPDATE
exception
INSERT
end
..
end
Dan
-----Original Message-----
Sent: Tuesday, February 13, 2001 10:26 AM
To: Multiple recipients of list ORACLE-L
Listers,
I am attempting to write a trigger on a table that will have batch
inserts nightly. I want each insert to check to see if a record with that
primary key exists, and if it does, update the record. If the primary key
does not yet exist in the table, insert the record. The batch load each
night is a large series of inserts, no updates. I want the trigger to
figure out it if needs to update or insert.
Can this be done??
Thank you,
-Fred Smith
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Fred Smith
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
_____________________________________________________________________
This message has been checked for all known viruses by UUNET delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.uk.uu.net/products/security/virus/
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Dasko, Dan
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).