Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: insert in function not possible?

Re: insert in function not possible?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 16 Dec 1998 13:33:56 GMT
Message-ID: <3677b672.10536290@192.86.155.100>


A copy of this was sent to rosinowski_at_gmx.de (Jan Rosinowski) (if that email address didn't require changing) On Wed, 16 Dec 1998 10:48:14 GMT, you wrote:

>>You cannot modify the database in a function you call from a SQL statement such
>>as select, insert, update, delete. You must be trying to run the function from
>>a 'select f_newfoo('x') from dual;'.
>
>that's exactly what i tried as..
>
>>Instead, if you are in sqlplus just:
>>
>>SQL> set serveroutput on
>>SQL> exec dbms_output.put_line( f_newfoo( 'x' ) );
>
>... i don't know how to get this returnvalue without a select when
>using delphi's tdataset-components.
>

sorry, that'll be a question for the delphi newsgroup I guess.

>> :my_host_variable := f_newfoo( 'x' );
>
>is also impossible for me.
>
>do i really have to issue a series of queries like
>
> insert into foo(bar) values('ba');
>
> select seq_foo.currval as retrievedcurrseq from dual;
>
> update foo set moreinfo='bla' where foseq=:retrievedcurrseq;
>

No, you would just:

   insert into foo(bar) values( seq_foo.nextval, 'ba' );    select seq_foo.currval into YOUR_VARIABLE from dual;

>?
>
>sorry, i'm an oracle newbie coming from sybase
>
>ciao, jan
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed Dec 16 1998 - 07:33:56 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US