查看PL/SQL编译时的错误信息
2014-11-25 18:12
363 查看
查看PL/SQL编译时的错误信息
转自:http://blog.csdn.net/leshami/article/details/6913026
编译无效对象是DBA与数据库开发人员常见的工作之一。对于编译过程中的错误该如何去捕获,下面给出两种捕获错误的方法。
一、当前数据库版本信息及无效对象
1、查看当前数据库版本
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 -
64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE
10.2.0.4.0
Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
2、获得数据库中的无效对象
set linesize 180
col object_name format a45
SELECT owner, object_name, object_type, status
FROM dba_objects
WHERE status = 'INVALID'
AND
object_type IN ('PROCEDURE', 'FUNCTION', 'TRIGGER', 'VIEW',
'PACKAGE');
OWNER
OBJECT_NAME
OBJECT_TYPE
STATUS
------------------------------
--------------------------------------------- -------------------
-------
OTC_WRHS_POSITION
OTC_WRHS_POSITION_PCK_tmp
PACKAGE
INVALID
3、编译无效对象(编译方法很多,在此不一一列出)
--注意该包对象中包体的名字含小写字符,因此编译时使用双引号括起来
SQL> alter package
"OTC_WRHS_POSITION"."OTC_WRHS_POSITION_PCK_tmp" compile body;
二、捕获编译错误
1、使用show errors捕获错误
SQL> show errors;
No errors.
SQL> show errors package body
"OTC_WRHS_POSITION"."OTC_WRHS_POSITION_PCK_tmp";
No errors.
2、如果使用show errors无法查询到错误,直接查询视图dba_errors
SQL> desc dba_errors;
Name
Type
Nullable Default Comments
-------------- -------------- -------- -------
---------------------------------------------------------------
OWNER
VARCHAR2(30)
NAME
VARCHAR2(30)
Name of the object
TYPE
VARCHAR2(12)
Y
Type: "TYPE", "TYPE BODY", "VIEW", "PROCEDURE",
"FUNCTION","PACKAGE",
"PACKAGE BODY", "TRIGGER","JAVA SOURCE" or "JAVA CLASS"
SEQUENCE
NUMBER
Sequence number used for ordering purposes
LINE
NUMBER
Line number at which this error occurs
POSITION
NUMBER
Position in the line at which this error occurs
TEXT
VARCHAR2(4000)
Text of the error
ATTRIBUTE
VARCHAR2(9)
Y
MESSAGE_NUMBER
NUMBER
Y
SQL> select owner,name,TEXT from dba_errors where
owner='OTC_WRHS_POSITION' and name='OTC_WRHS_POSITION_PCK_tmp'
and
2 sequence=(select max(sequence) from dba_errors
where owner='OTC_WRHS_POSITION');
OWNER
NAME
TEXT
-------------------- -------------------------
------------------------------------------------------------
OTC_WRHS_POSITION
OTC_WRHS_POSITION_PCK_tmp PLS-00103: Encountered the symbol "ULL"
when expecting one of the following:
. ( ) , * @ % & = - < /
> at in is mod remainder not rem
<> or != or ~= >=
<= <> and or like
LIKE2_LIKE4_ LIKEC_ between || multiset member SUBMULTISET_The
symbol "." was substituted for "ULL" to continue.
转自:http://blog.csdn.net/leshami/article/details/6913026
编译无效对象是DBA与数据库开发人员常见的工作之一。对于编译过程中的错误该如何去捕获,下面给出两种捕获错误的方法。
一、当前数据库版本信息及无效对象
1、查看当前数据库版本
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 -
64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE
10.2.0.4.0
Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
2、获得数据库中的无效对象
set linesize 180
col object_name format a45
SELECT owner, object_name, object_type, status
FROM dba_objects
WHERE status = 'INVALID'
AND
object_type IN ('PROCEDURE', 'FUNCTION', 'TRIGGER', 'VIEW',
'PACKAGE');
OWNER
OBJECT_NAME
OBJECT_TYPE
STATUS
------------------------------
--------------------------------------------- -------------------
-------
OTC_WRHS_POSITION
OTC_WRHS_POSITION_PCK_tmp
PACKAGE
INVALID
3、编译无效对象(编译方法很多,在此不一一列出)
--注意该包对象中包体的名字含小写字符,因此编译时使用双引号括起来
SQL> alter package
"OTC_WRHS_POSITION"."OTC_WRHS_POSITION_PCK_tmp" compile body;
二、捕获编译错误
1、使用show errors捕获错误
SQL> show errors;
No errors.
SQL> show errors package body
"OTC_WRHS_POSITION"."OTC_WRHS_POSITION_PCK_tmp";
No errors.
2、如果使用show errors无法查询到错误,直接查询视图dba_errors
SQL> desc dba_errors;
Name
Type
Nullable Default Comments
-------------- -------------- -------- -------
---------------------------------------------------------------
OWNER
VARCHAR2(30)
NAME
VARCHAR2(30)
Name of the object
TYPE
VARCHAR2(12)
Y
Type: "TYPE", "TYPE BODY", "VIEW", "PROCEDURE",
"FUNCTION","PACKAGE",
"PACKAGE BODY", "TRIGGER","JAVA SOURCE" or "JAVA CLASS"
SEQUENCE
NUMBER
Sequence number used for ordering purposes
LINE
NUMBER
Line number at which this error occurs
POSITION
NUMBER
Position in the line at which this error occurs
TEXT
VARCHAR2(4000)
Text of the error
ATTRIBUTE
VARCHAR2(9)
Y
MESSAGE_NUMBER
NUMBER
Y
SQL> select owner,name,TEXT from dba_errors where
owner='OTC_WRHS_POSITION' and name='OTC_WRHS_POSITION_PCK_tmp'
and
2 sequence=(select max(sequence) from dba_errors
where owner='OTC_WRHS_POSITION');
OWNER
NAME
TEXT
-------------------- -------------------------
------------------------------------------------------------
OTC_WRHS_POSITION
OTC_WRHS_POSITION_PCK_tmp PLS-00103: Encountered the symbol "ULL"
when expecting one of the following:
. ( ) , * @ % & = - < /
> at in is mod remainder not rem
<> or != or ~= >=
<= <> and or like
LIKE2_LIKE4_ LIKEC_ between || multiset member SUBMULTISET_The
symbol "." was substituted for "ULL" to continue.
相关文章推荐
- 查看PL/SQL编译时的错误信息
- 查看PL/SQL编译时的错误信息
- 查看PL/SQL编译时的错误信息
- 4、Oracle PL/SQL编译错误查看与处理
- 【PL/SQL调试】SQL*Plus 或者 PL/SQL Developer查看存储过程编译错误
- 使用SQL*Plus创建ORACLE存储过程报编译错误,如何知道具体错误信息?
- PL/SQL 如何查看当前连接信息以及SQL PLUS如何指定IP地址
- 查看Oracle 存储过程编译有错误信息
- 关于PL/SQL编译程序ORA-00600错误
- PL/SQL 一个数据对象一个事务(且记录错误信息到处理对象)(rollback,submit)
- 查看package编译时的错误信息及重新编译
- Medoo Error的使用:查看错误SQL信息
- SQLServerAgent could not be started (reason: 无法加载任何子系统。有关详细信息,请查看错误日志。).
- PL/0语言编译程序整理实现:(9)、错误信息
- 使用PL/SQL developer 工具编译包或者其他objects时候出现错误
- ThinkPhp5框架查看页面基本信息,执行文件,流程,错误,sql,调试
- Delphi常见各类编译错误信息-中英对照
- 安装SQL2000时出现:安装程序配置服务器失败。参考服务器错误日志和 C:/WINDOWS/sqlstp.log 了解更多信息。
- 最常见的20种VC++编译错误信息
- "ORA-06502: PL/SQL: 数字或值错误 : 字符串缓冲区太小"的解决,总结一下oracle开发的小经验