Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Adding a record when a search record is not found (Oracle)

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-16 : 15:05:59
lloyd lee writes "I'm doing PL/SQL. Some of my procedure is to update a record. When the record to be updated is not in the table then I have to create it.
What is the best way to to this?
there are 2 ways that I do this.
First is that I use the SELECT INTO statement and use the
EXCEPTION WHEN NO_DATA_FOUND. It is here where I insert the record.

Second is that I use the UPDATE stetement setting a key field with its value then use the IF SQL%NOTFOUND. It is here where I insert the record.

Both works ok. do you have any other suggestion?"
   

- Advertisement -