Best strategy question

Bart Pietercil bart.pietercil at cognosis.be
Thu Sep 11 13:08:13 CDT 2008


Hi guys,

bit of a strategy question here:

what is the best way (inside a stored procedure) to verify if a record  
exists. If it does not exist I want to insert it, if it exists not.
The table I will insert the record has a unique_check method in place

So what do I do:

1) immediately insert the record and count on the exception to tell me  
it already exist
2) do a select on the record to verify if it exists on only do the  
insert if the cursor returned empty

I am inclined to think 1) is optimal for speed but is it the best way  
altogether....

Looking forward to your thoughts


Bart Pietercil


More information about the Valentina mailing list