A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
oracle equivalent to "IF EXISTS"
Joined: Aug 28, 2003
Nov 09, 2005 14:26:00
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
Joined: May 26, 2003
Nov 09, 2005 19:04:00
You can definitely use a stored procedure. I'm not sure of a way to do it using raw SQL.
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: oracle equivalent to "IF EXISTS"
NX: DuplicateKeyException for records without keys!? *blink*
using hibernate formula
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014