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

Home -> Community -> Usenet -> c.d.o.tools -> Re: ORA-00905 error in PL/SQL code

Re: ORA-00905 error in PL/SQL code

From: Richard J Woodland <richwoodland_at_interfacefamily.com>
Date: 2000/05/31
Message-ID: <393518d7$0$73582@news.voyager.net>#1/1

CREATE OR REPLACE PROCEDURE demo (pTableName VARCHAR2) IS

  lHandle NUMBER;
  lQuery VARCHAR2(100) := 'SELECT COUNT(*) FROM ' || pTableName;   lResult NUMBER;
  lDummy NUMBER;

BEGIN   lHandle := DBMS_SQL.OPEN_CURSOR;

  DBMS_SQL.PARSE(lHandle,lQuery,DBMS_SQL.V7);

  DBMS_SQL.DEFINE_COLUMN(lHandle,1,lResult);

  lDummy := DBMS_SQL.EXECUTE(lHandle);

  IF DBMS_SQL.FETCH_ROWS(lHandle) > 0 THEN     DBMS_SQL.COLUMN_VALUE(lHandle, 1, lResult);   ELSE
    lResult := 0;
  END IF;   DBMS_SQL.CLOSE_CURSOR(lHandle);

  DBMS_OUTPUT.PUT_LINE(TO_CHAR(lResult)||' rows in '||pTableName);

END demo;
/

EXECUTE demo('MYTABLE');

Hope this helps!

Rich Woodland
Magic Interface, Ltd.

Gennady wrote:

> Hello,
> I'm trying to execute the code:
> declare
> c2 number;
> d2 number;
> k number;
> vin_table_name varchar2(30):='MYTABLE';
> begin
> dbms_output.enable;
> c2 := dbms_sql.open_cursor;
> dbms_sql.parse(c2, 'select count(*) into '||k||' from
> '||vin_table_name||'',dbms_sql.native);
> d2:=dbms_sql.execute(c2);
> dbms_output.put_line(k);
> dbms_sql.close_cursor(c2);
> end;
>
> But I get error ORA-00905: missing keyword.
> Could you please give me a hint how to fix the problem?
> Thanks,
> Gennady
Received on Wed May 31 2000 - 00:00:00 CDT

Original text of this message

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