2023年12月18日发(作者:)

scott@ORCL> show parameter plsql%ings

NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ plsql_warnings string ENABLE:INFORMATIONAL, DISABLE: PERFORMANCE, DISABLE:SEVERE

scott@ORCL> alter procedure dead_code compile;

SP2-0805: Procedure altered with compilation warnings

scott@ORCL> show errors; Errors for PROCEDURE DEAD_CODE:

LINE/COL ERROR -------- ----------------------------------------------------------------- 4/6 PLW-06002: Unreachable code 7/3 PLW-06002: Unreachable code

b.检测引起性能问题的代码 scott@ORCL> create or replace procedure update_sal 2 (no number,salary varchar2) 3 as 4 begin 5 update emp set sal=salary where empno=no; 6 end; 7 /

Procedure created.

scott@ORCL> alter session set plsql_warnings='enable:performance';

scott@ORCL> alter procedure update_sal compile;

SP2-0805: Procedure altered with compilation warnings

scott@ORCL> show errors Errors for PROCEDURE UPDATE_SAL:

LINE/COL ERROR -------- ----------------------------------------------------------------- 5/24 PLW-07202: bind type would result in conversion away from column

六、更多参考

有关SQL请参考

有关PL/SQL请参考