一個挺好的查看錯誤的方法

SQL> begin
  2      p_rowid(3,0);
  3  end;
  4  /
    p_rowid(3,0);
    *
ERROR at line 2:
ORA-06550: line 2, column 5:
PLS-00905: object SCOTT.P_ROWID is invalid
ORA-06550: line 2, column 5:
PL/SQL: Statement ignored


SQL> show errors;
Errors for PROCEDURE P_ROWID:

LINE/COL ERROR
-------- -----------------------------------------------------------------
27/38    PLS-00103: Encountered the symbol "CUR" when expecting one of the
         following:
         . ( * @ % & = - + ; < / > at in is mod remainder not rem
         return returning <an exponent (**)> <> or != or ~= >= <= <>
         and or like like2 like4 likec between into using || multiset
         bulk member submultiset
         The symbol "(" was substituted for "CUR" to continue.

27/59    PLS-00103: Encountered the symbol ";" when expecting one of the
         following:
         . ( ) , * @ % & = - + < / > at in is mod remainder not rem =>

LINE/COL ERROR
-------- -----------------------------------------------------------------
         <an exponent (**)> <> or != or ~= >= <= <> and or like like2
         like4 likec between || multiset member submultiset
         The symbol ")" was substituted for ";" to continue.

SQL> create or replace procedure p_rowid
  2                                     (
  3                                         range number
  4                                       ,id     number
  5                                     )
  6  is
  7      cursor cur_rowid is
  8          select
  9                 dbms_rowid.rowid_create(1, b.data_object_id, a.relative_fno, a.block_id, 0)            rowid1
 10               , dbms_rowid.rowid_create(1, b.data_object_id, a.relative_fno, a.block_id+blocks-1, 999) rowid2
 11          from
 12                 dba_extents a
 13               , dba_objects b
 14          where
 15                 a.segment_name            =b.object_name
 16                 and a.owner               =b.owner
 17                 and b.object_name         ='TEST'
 18                 and b.owner               ='SCOTT'
 19                 and mod(a.extent_id,range)=id
 20          ;
 21      
 22      v_sql varchar2(4000);
 23  begin
 24      for cur in cur_rowid
 25      loop
 26          v_sql:='delete test where object_id>5000 and rowid between :1 and :2';
 27          execute immediate v_sql using cur.rowid1,cur.rowid2;
 28          commit;
 29      end loop;
 30  end;
 31  /

Procedure created.

SQL> begin
  2      p_rowid(3,0);
  3  end;
  4  /

PL/SQL procedure successfully completed.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章