| Author |
oracle equivalent to "IF EXISTS"
|
g forte
Greenhorn
Joined: Aug 28, 2003
Posts: 25
|
|
Hello all, I am trying to write a query that will check if a record exists and, if not , inserts the record in 1 trip to the db. I have this query: IF NOT EXISTS (Select award_number from hold_table_award WHERE award_number = 'duh') BEGIN INSERT INTO hold_table_award(award, title)VALUES(?,?) This wont work in Oracle. Anyone know how to make it work or if Oracle has something similar to IF NOT EXISTS or IF EXISTS? TIA!!
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26141
|
|
|
You can definitely use a stored procedure. I'm not sure of a way to do it using raw SQL.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
 |
|
|
subject: oracle equivalent to "IF EXISTS"
|
|
|