we have a function if we call it by using SELECT we get the error code ORA-14551 “Cannot preform a DML operation inside a query”
select pkg_tools.replace_site(1121,3343) from dual;
how to run this function and get the results
when we run it in SQL developer in this way:
declare
v_return VRACHAR2(200);
begin
v_return := pkg_tools.replace_site(1121,3343);
end;
works with no errors
and we need this function to be called inside PHP
note: I can not paste this function here, because it’s to long, but it does allot of operations including insert and update!
A function that does DML cannot be called in a
SELECTstatement regardless of the calling language.If you want to do DML and return a value, it would make much more sense to create a stored procedure with an
OUTparameter rather than using a function. So it would make much more sense toand then call that stored procedure from PHP
If you don’t want to do that, my guess is that you could do something like this as well (adapted from one of the scripts on page 164 of the Underground PHP and Oracle Manual)