A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
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
author & internet detective
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.
OCA 8 book
How To Ask Questions The Smart Way
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
subject: oracle equivalent to "IF EXISTS"
using hibernate formula
NX: DuplicateKeyException for records without keys!? *blink*
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015