Subject | Stored Procedure question. |
---|---|
Author | Andrew |
Post date | 2012-01-31T21:04:02Z |
Hi all,
I'm trying to do a stored procedure that does a select with parameters and then, if records aren't found, do the insert and proceed with the DML.
I have to implement this as a Stored procedure (thrid party app) and I'm stumped. I tried to google it but there were a gazzilion examples and none of them had this example.
something like:
Select name, surname, address from client where SSN = 1234
if not found (or recordcount = 0, or empty = true) then
insert (name, surname, address, SSN) in client ('john', 'doe', 'aa street', 1234);
Edit client set total_bought = total_bought + 100.00;
Thanks
Andrew
I'm trying to do a stored procedure that does a select with parameters and then, if records aren't found, do the insert and proceed with the DML.
I have to implement this as a Stored procedure (thrid party app) and I'm stumped. I tried to google it but there were a gazzilion examples and none of them had this example.
something like:
Select name, surname, address from client where SSN = 1234
if not found (or recordcount = 0, or empty = true) then
insert (name, surname, address, SSN) in client ('john', 'doe', 'aa street', 1234);
Edit client set total_bought = total_bought + 100.00;
Thanks
Andrew