创建一个存储过程有错误,在哪里看:
sql> create or replace procedure p_test(u_name in varchar2,t_bytes in number) is
2 v_name varchar2(20);3 objectname varchar2(20);
4 v_bytes number;
5 begin
6 v_name :=u_name;
7 v_bytes :=t_bytes;
8 execute immediate 'truncate table p_t';
9 FOR X IN (select sql_ID,sql_text from gv$sqlarea where parsing_schema_name =v_name
10 and COMMAND_TYPE =3
11 AND sql_TEXT NOT LIKE '%OPT_DYN_SAMP%'
12 and TO_DATE(FIRST_LOAD_TIME,'YYYY-MM-DD HH24:MI:SS') > sysdate - 1/24/60*10) Loop
13 for y in (select DISTINCT t.object_name into objectname from gv$sql_plan t where T.sql_id =x.sql_id
14 and t.operation = 'TABLE ACCESS' and t.OPTIONS = 'FULL' AND T.OBJECT_OWNER=v_name and t.bytes/1024/1024 >v_bytes) loop
15 insert into p_t values (x.sql_id,x.sql_text,y.object_name);
16 commit;
17 end loop ;
18 end loop ;
19 end;
20 /
警告: 创建的过程带有编译错误。
在pl/sql developer中编辑此存储过程也没有看到具体的错误。
只有借助于SYS.USER_ERRORS,可以看到提示第一行有错误,中文括号,这里是一个思路。
sql> select * from SYS.USER_ERRORS where NAME = upper('p_test');
NAME TYPE SEQUENCE LINE POSITION TEXT ATTRIBUTE MESSAGE_NUMBER
---------- ---------- ------ ---- --------- --------------------------------------------------------- --------- --------------
P_TEST PROCEDURE 1 1 21 PLS-00103: 出现符号 "("在需要下列之一时: ERROR 103
( ; is with authid as
cluster compress order using compiled wrapped external
deterministic parallel_enable pipelined result_cache
符号 "(在 "(" 继续之前已插入。
P_TEST PROCEDURE 2 1 59 PLS-00103: 出现符号 ")"在需要下列之一时: ERROR 103
:= . ),@ % default
character
符号 ")在 ")" 继续之前已插入。
P_TEST PROCEDURE 3 13 43 PLS-00103: 出现符号 "INTO"在需要下列之一时: ERROR 103 . (,* @ % & - + / at mod remainder rem <an identifier> <a double-quoted delimited-identifier> <an exponent (**)> as from || multiset 符号 "INTO" 被忽略。