Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> ORA-06571: Function MYFUNC does not guarantee not to update database
Hi,
I created a Function in Oracle like the following:
create or replace function myfunc return varchar2 is
abvar varchar2(10);
begin
select user into abvar from dual;
return abvar;
exception
when NO_DATA_FOUND then
raise_application_error (-20002,'nothing');
return'';
end;
This compiles perfectly but the only problem is that when i try to call it in the command line like :
SQL> Select myfunc from dual;
It gives me an error saying
ERROR at line 1:
ORA-06571: Function MYFUNC does not guarantee not to update database
If i comment the raise_application_error line, it works fine.
Can anybody tell me , how to work around this. This problem occurs when you declare a variable of type table and then assign values to it.
create or replace function myfunc return varchar2 is
abvar varchar2(10);
partrec part_master%ROWTYPE; /* part_master is a table */
begin
partrec.part_num := 'vishi';
select user into abvar from dual;
return abvar;
exception
when NO_DATA_FOUND then
return'';
end;
This also compiles perfectly but i encounter the same problem once i call it from the command line.
Both these work fine if i call the function from inside a pl/sql block..
Please help. Received on Mon Nov 17 1997 - 00:00:00 CST
![]() |
![]() |