Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: insert in function not possible?
It is possible. You forgot to declare the return datatype.
Jan Rosinowski wrote:
> in sqlaw it's common practice to use functions like
>
> create function f_newfoo(bar varchar)
return <datatype>
> as
> begin
> insert into foo(b) values (bar);
return <return_value>;
> end;
>
> try this in oarcle gives an ora-6571 ?!
>
> what's wrong? why can't i modify the database in a function? using a
> stored proc seems to work but actually it's crap to use a procedure
> with an out-parameter to simulate a function.
>
> how do i retrieve the current sequencevalue correctly?
select sequence_name.currval from dual;
>
>
> ciao, jan
Good luck,
Peter-Paul van de Beek Received on Tue Dec 15 1998 - 09:51:10 CST