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 -> ORA-06571 from user defined function

ORA-06571 from user defined function

From: Jim Poe <jpoe_at_fulcrumit.com>
Date: Wed, 20 Jan 1999 14:04:24 -0800
Message-ID: <36A652E8.FB4DCC2B@fulcrumit.com>


I wrote the following function:
CREATE OR REPLACE function jbp_FUNCT1 ( TABLENAME VARCHAR2 ) RETURN NUMBER IS
  vNewNumber NUMBER( 10 ) := 0;
  TName VARCHAR2( 50 );

  vcurs INTEGER;
  vretcd INTEGER;
  vstmt VARCHAR2(100);

BEGIN
  vcurs :=dbms_sql.open_cursor;

  TName:=UPPER( TABLENAME );

  vstmt := 'select '||TName|| '_SEQ.NextVal into :NewNumber from dual';

  dbms_sql.parse(vcurs, vstmt, dbms_sql.v7);   dbms_sql.bind_variable( vcurs, ':NewNumber', vNewNumber );   vretcd := dbms_sql.execute(vcurs);
  dbms_sql.variable_value( vcurs, ':NewNumber', vNewNumber );

  Return vNewNumber;

  commit;

  dbms_sql.close_cursor( vcurs );
END; I use it with the following sql:
  select jbp_funct1( 'PDCR' ) NewNumber from dual;

i get the ORA-06571 error. 'Function jbp_funct1 does not guarantee not to update database.' The documentation for the error states: Action: If the referenced function is a packaged PL/SQL function: Recreate the PL/SQL function with the required pragma; be certain to include the "Write No Database State" (WNDS) argument in the argument list of the pragma.

What is the 'right pragma' and why would I not want the database updated? I assume it is referring to updating the sequence.

Thanks
--
Jim Poe
<jpoe_at_fulcrumit.com>
Fulcrum InteTech, Inc. Received on Wed Jan 20 1999 - 16:04:24 CST

Original text of this message

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