Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: insert statement in a function or select statement
Hi,
"Sharkie" <sharkdba_at_yahoo.com> wrote in message
news:423b5ab1.0406031214.5c9b6070_at_posting.google.com...
> Oracle 8.1.7 on Solaris.
>
> Is it possible to somehow execute an insert statement inside a function
> or another select statement? Here's what I need to happen:
Yes:
create table t1(x int);
create or replace function f1(p_x int) return int as
pragma autonomous_transaction;
begin
insert into t1 values(p_x);
commit;
return p_x;
end;
/
select f1(1) from dual; select f1(2) from dual; select f1(3) from dual;
select * from t1;
X
-
1
2
3
VC Received on Thu Jun 03 2004 - 18:57:40 CDT