Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> INSERT in PL/SQL function
Hi all,
I'm trying to find a way to insert or update table data within a function. Background: The functions are to be called from another application that needs a return code to verify that the function worked.
I've tried cheating Oracle by encapsulating the insert statement in a procedure or hiding it behind dbms_sql but Oracle still tells me that the function violates its pragma.
How can I work around it?
Again: what I want to do is the following: create or replace function foo (in_data in whatever) return number is begin
if (checks on in_data return TRUE) then
=09insert into table values(in_data);
=09return 1;
else
=09return 0;
end if;
when others then
=09return 0;
end;
The calling applcation should be able to do something like $return_code =3D (SELECT foo($data) from dual; and $return_code would then be either 1 or 0
Thanks,
=09Susanne =09
Susanne Heymann phone: (+49) (0)221 3091 251 metronet GmbH fax: (+49) (0)221 3091 298 Bonner Str. 172-176 e-mail: susanne_at_metronet.de D-50968 K=F6ln-Bayenthal www: http://www.metronet.de/~susanne -------------------------------------------------------------------- New address and phone! -- Susanne --------------------------------------------------------------------Received on Wed Jul 30 1997 - 00:00:00 CDT