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

Home -> Community -> Usenet -> c.d.o.misc -> statement works in SQLPLUS prompt, but not from PL/SQL

statement works in SQLPLUS prompt, but not from PL/SQL

From: Kal Khatib <kkhatib_at_cisco.com>
Date: Tue, 30 Jun 1998 15:56:49 -0700
Message-ID: <35996D30.7F0A400B@cisco.com>


I'm using dynamic SQL to execute a statement. Works from SQLPLUS, but I get an 'Invalid number error'
when run from PL/SQL

I'm out of trick as to the cause. Here is the part giving me trouble

c1 := dbms_sql.open_cursor;

dbms_sql.parse (c1, sql_report_this, dbms_sql.NATIVE);
dbms_sql.define_column (c1, 1, v_field_1, 2000);          -- a varchar2
dbms_sql.define_column (c1, 2, v_field_3);                -- number
dbms_sql.define_column (c1, 3, v_field_4);                -- number

dummy := dbms_sql.execute(c1);

LOOP

         EXIT WHEN (dbms_sql.fetch_rows(c1) <= 0);
         dbms_sql.column_value (c1, 1, v_field_1);
         dbms_sql.column_value (c1, 2, v_field_3);
         dbms_sql.column_value (c1, 3, v_field_4);

         -- Some pront and other statements here.
END LOOP;
dbms_sql.close_cursor(c1);

It seems to choke on the EXIT WHEN....
I have the same logic implemented in other procedure and they work fine.

The above code is inside 2 nested loops that feeds 2 variables to sql_report_this variable.

I'm baffled by the error Received on Tue Jun 30 1998 - 17:56:49 CDT

Original text of this message

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