Originally posted by chrisrlong
Another point, assuming it can't be done in bulk.

As you mentioned, it helps to have an idea as to whether you will have more updates or inserts. And I don't see what there is to figure out there - it's kinda obvious.

Anyway, the point is, if more updates:

UPDATE ... WHERE EXISTS
IF SQL%ROWCOUNT = 0
THEN
INSERT...

If more inserts:

INSERT WHERE NOT EXISTS
IF SQL%ROWCOUNT = 0
THEN
UPDATE...

Using the EXISTS or NOT EXISTS is more efficient than waiting for the exception.

- Chris
I swear I've only had one beer today, but I'm totaly lost here. I'm not sure what are you talking about here.

You are talking about update/insert of a record by record inside cursor, right? If so, why checking for existance at all? I mean, ROWCOUNT will tell if it exists or not, no?

You are not talking about the same concept that slimdave has suggested, are you? Or have I totaly and 100% miss some important point here?

I realy am confused.....