Home » SQL & PL/SQL » SQL & PL/SQL » call function generates ORA-14551: cannot perform a DML operation inside a query
call function generates ORA-14551: cannot perform a DML operation inside a query [message #519100] Tue, 09 August 2011 07:48 Go to next message
gtriant
Messages: 42
Registered: September 2006
Member
Dear all,

Calling function

select PACK.MAIN('blah') from dual

generates:
ORA-14551: cannot perform a DML operation inside a query
ORA-06512: at "SYSADM.NEW_QUANTUM_PACK", line 756
ORA-06512: at "SYSADM.NEW_QUANTUM_PACK", line 245

Unfortunately the Body is not accessible to see.
The spec of the function is:

FUNCTION MAIN (mvar IN varchar2) RETURN varchar2;

I read somewhere that I can call it like:

var myVar VARCHAR2;
call PACK.MAIN('blah') into :myVar

But this generates:
ORA-01008: not all variables bound

Am I doing something wrong?

[Updated on: Tue, 09 August 2011 07:53]

Report message to a moderator

Re: call function generates ORA-14551: cannot perform a DML operation inside a query [message #519102 is a reply to message #519100] Tue, 09 August 2011 08:01 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
gtriant wrote on Tue, 09 August 2011 08:48
Dear all,

Calling function

select PACK.MAIN('blah') from dual

generates:
ORA-14551: cannot perform a DML operation inside a query
ORA-06512: at "SYSADM.NEW_QUANTUM_PACK", line 756
ORA-06512: at "SYSADM.NEW_QUANTUM_PACK", line 245

Unfortunately the Body is not accessible to see.


Well, it has DML in it which you can clearly not do based on the error message.

Quote:

The spec of the function is:

FUNCTION MAIN (mvar IN varchar2) RETURN varchar2;

I read somewhere that I can call it like:

var myVar VARCHAR2;
call PACK.MAIN('blah') into :myVar

But this generates:
ORA-01008: not all variables bound

Am I doing something wrong?


Even if the syntax was correct, it doesn't change the fact that function is doing DML.
Re: call function generates ORA-14551: cannot perform a DML operation inside a query [message #519104 is a reply to message #519100] Tue, 09 August 2011 08:04 Go to previous messageGo to next message
cookiemonster
Messages: 13973
Registered: September 2008
Location: Rainy Manchester
Senior Member
var myVar VARCHAR2;
exec :myvar := PACK.MAIN('blah');

Re: call function generates ORA-14551: cannot perform a DML operation inside a query [message #519133 is a reply to message #519104] Tue, 09 August 2011 11:45 Go to previous message
gtriant
Messages: 42
Registered: September 2006
Member
Actually my worry was that I was not going to be able to call from java CallableStatement. But it is ok.

Thanks for the replies
Previous Topic: Function Help?
Next Topic: case statement in where clause issue
Goto Forum:
  


Current Time: Sun Nov 02 04:21:50 CST 2025