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

Home -> Community -> Usenet -> c.d.o.server -> Re: ORA-14551: cannot perform a DML operation inside a query

Re: ORA-14551: cannot perform a DML operation inside a query

From: Kenneth Koenraadt <plovmand_at_>
Date: Sat, 18 Aug 2001 08:21:15 GMT
Message-ID: <3b7e241b.1665894@news.mobilixnet.dk>


On 17 Aug 2001 23:32:14 -0700, daud11_at_hotmail.com (Daud) wrote:

>Hi
>
>I have written a pl/sql function that returns a value.
>The function will insert or update into a table everytime it is
>called.
>However, everytime I call the function from a select statement like:
>
>select getVal('data') from dual;
>
>I got an error message like below.
>
>ORA-14551: cannot perform a DML operation inside a query
>
>I think I understand why. However, is there a workaround to this
>problem? I need to call the function from a select statement and the
>function needs to insert/update a table.
>
>thanks
>Daud11

Hi Daud,

There is no workaround if you really want to do an update in a query.

And that's good, because it is *very bad* programming practice.

Instead, do it straightly by

ReturnValue:= getVal('data');

Now you can use Returnvalue in all select statements.

Regards,
Kenneth Koenraadt
Systems Consultant
Oracle DBA
plovmand@<no-spam>hotmail.com Received on Sat Aug 18 2001 - 03:21:15 CDT

Original text of this message

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