1 Reply Latest reply: Dec 5, 2011 3:51 PM by mwickham-Oracle RSS

    PL/SQL EXECUTE IMMEDIATE SELECT INTO returning ORA-00942

    903418
      Hello,

      I am trying to run the following EXECUTE IMMEDIATE statement

      SELECTSTATEMENT :=
      'SELECT PARTITION_NAME '
      || ' FROM DBA_TAB_PARTITIONS WHERE PARTITION_NAME = :a'
      || ' AND TABLE_NAME = :b'
      || ' AND TABLESPACE_NAME = :c';

      DBMS_OUTPUT.put_line( SELECTSTATEMENT );
      EXECUTE IMMEDIATE SELECTSTATEMENT INTO V_PARTITION_NAME USING P_PARTITION_NAME, P_ORACLE_TABLE, 'TS_CIF_SOLUTION2';

      Unfortunately I receive the following error

      ORA-00942: table or view does not exist

      However I have ran this statement outside of the EXECUTE IMMEDIATE and do not receive the error. I have used FROM SYS.DBA_TAB_PARTITIONS as well to specify the owner. I also have privileges to this table.