Re: Stored Procedure Help
From: Juan M. Quiroz <quirozj_at_ucs.orst.edu>
Date: 1998/02/06
Message-ID: <34DBA86E.296C_at_ucs.orst.edu>#1/1
Date: 1998/02/06
Message-ID: <34DBA86E.296C_at_ucs.orst.edu>#1/1
Bill Li wrote:
>
> Please help!
>
> Does anyone have an example of a stored procedure that takes several input
> parameters of keys and values and does a select on a row, if the row exists
> then do an update, else, do an insert? A return code is returned indicating
> success/fail and whether an insert or update was done.
>
> Thanks,
> Bill
somewhere in your code you can use the following
update table_name
set field_1= value_1, field_2 = value_2, field_3 = value_3, field_4 = value_4, field_5 = value_5, field_6 = value_6 where conditions follow; if sql%NotFound then insert into table_name values (value_1, value_2, value_3, value_4, value_5, value_6); end if;
Juan Received on Fri Feb 06 1998 - 00:00:00 CET