-
Update or Insert?
Hi,
I am facing a classic problem of determining whether to use Update or Insert.
Wondering if there is any good way of doing it in one shot using Oracle 8i.
I have a requirement where I don't know whether data exists in the table or not. For this currently I am firing a Select count(*) and if there are any rows in the database then I form an Update query otherwise an Insert.
This seems to be very orthodox way and not a good option.
However if someone has thought of any good workable work around for such scenario please share it with us.
Thanks in Advance.
Regards,
SP
-
> However if someone has thought of any good workable work around for such scenario please share
9i - Merge / upsert statement.
8i and lower - There's really no work around. You gotta write code. plsql or whatever.
-
Re: Update or Insert?
Originally posted by sp_ojha
I have a requirement where I don't know whether data exists in the table or not. For this currently I am firing a Select count(*) and if there are any rows in the database then I form an Update query otherwise an Insert.
Use your exceptions. Do a plain insert, if DUP_VAL_ON_INDEX is fired, update.
Jeff Hunter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|