Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Function and Insertstatement
A copy of this was sent to Dirk Joosen <d.joosen_at_REMOVETHIS.planetinternet.nl>
(if that email address didn't require changing)
On Thu, 18 Nov 1999 11:23:34 +0100, you wrote:
>Hello,
>
>Can someone tell me if it is possible to use a INSERT statement in a
>Function. When I use the INSERT statement I become next failure when I
>run the function.
>ORA-06571: Function GETCLIENTID does not guarantee not to update
>database.
>
>The reason that I use a Function is that I want to return a ID which I
>use.
>I know that I also can declare a procedure whith an IN OUT argument but
>I thought that a Function was easyer to use.
>
>Thanks and regards Dirk
Yes, you can code a function to write to the database.
No, you cannot call that function from a SQL select (unless you have Oracle8i and the function is an autonomous transaction...)
you would just code:
begin :my_host_variable := my_function(...); end;
--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Nov 18 1999 - 08:49:27 CST