Compile-time error message View PL / SQL

Compile invalid objects are DBA and database one of the working developer common. For the compilation process of how to capture the error, the following two methods to catch errors are given.

First, the current version of the database information and invalid objects

    1, view the current version of the database   

[sql] view plain copy

 print?

1.SQL> select * from v$version;                                        

2.                                                                     

3.BANNER                                                               

4.----------------------------------------------------------------     

5.Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi     

6.PL/SQL Release 10.2.0.4.0 - Production                               

7.CORE    10.2.0.4.0      Production                                   

8.TNS for Solaris: Version 10.2.0.4.0 - Production                     

9.NLSRTL Version 10.2.0.4.0 - Production                               

    2, access to the database of invalid objects

[sql] view plain copy

 print?

1.set linesize 180                                                                                          

2.col object_name format a45                                                                                

3.SELECT owner, object_name, object_type, status                                                            

4.FROM dba_objects                                                                                          

5.WHERE status = 'INVALID'                                                                                  

6.     AND                                                                                                  

7.     object_type IN ('PROCEDURE', 'FUNCTION', 'TRIGGER', 'VIEW', 'PACKAGE');                              

8.                                                                                                          

9.OWNER                          OBJECT_NAME                                   OBJECT_TYPE         STATUS   

10.  ------------------------------ --------------------------------------------- ------------------- -------  

11. OTC_WRHS_POSITION              OTC_WRHS_POSITION_PCK_tmp                     PACKAGE             INVALID  

    3. Compile invalid objects (compiled many ways, this is not an exhaustive list)    

[sql] view plain copy

 print?

1./**************************************************/                            

2./* Author: Robinson Cheng                         */                            

3./* Blog:   http://blog.csdn.net/robinson_0612     */                            

4./* MSN:    [email protected]              */                            

5./* QQ:     645746311                              */                            

6./**************************************************/                            

7.                                                                                    

Note that the name of the package 8 .-- subject body contains lowercase characters, double quotes Compiled                  

9.SQL> alter package "OTC_WRHS_POSITION"."OTC_WRHS_POSITION_PCK_tmp" compile body;  

Second, capture a compilation error
    1, using the show errors to catch errors   

[sql] view plain copy

 print?

1.SQL> show errors;                                                                 

2.No errors.                                                                        

3.                                                                                  

4.SQL> show errors package body "OTC_WRHS_POSITION"."OTC_WRHS_POSITION_PCK_tmp";    

5.No errors.                                                                        

    2, if a query can not show errors to error, direct access to view dba_errors   

[sql] view plain copy

 print?

1.SQL> desc dba_errors;                                                                                                     

2.Name           Type           Nullable Default Comments                                                                   

3.-------------- -------------- -------- ------- ---------------------------------------------------------------            

4.OWNER          VARCHAR2(30)                                                                                               

5.NAME           VARCHAR2(30)                    Name of the object                                                         

6.TYPE           VARCHAR2(12)   Y                Type: "TYPE", "TYPE BODY", "VIEW", "PROCEDURE", "FUNCTION",                

7."PACKAGE", "PACKAGE BODY", "TRIGGER",                                                                                     

8."JAVA SOURCE" or "JAVA CLASS"                                                                                             

9.SEQUENCE       NUMBER                          Sequence number used for ordering purposes                                 

10. LINE           NUMBER                          Line number at which this error occurs                                     

11. POSITION       NUMBER                          Position in the line at which this error occurs                            

12. TEXT           VARCHAR2(4000)                  Text of the error                                                          

13. ATTRIBUTE      VARCHAR2(9)    Y                                                                                           

14. MESSAGE_NUMBER NUMBER         Y                                                                                           

15.                                                                                                                           

16. SQL> select owner,name,TEXT from dba_errors where owner='OTC_WRHS_POSITION' and name='OTC_WRHS_POSITION_PCK_tmp' and      

17.    2  sequence=(select max(sequencefrom dba_errors where owner='OTC_WRHS_POSITION');                                     

18.                                                                                                                           

19. OWNER                NAME                      TEXT                                                                       

20.  -------------------- ------------------------- ------------------------------------------------------------               

21.  OTC_WRHS_POSITION    OTC_WRHS_POSITION_PCK_tmp PLS-00103: Encountered the symbol "ULL" when expecting one o               

22.                                                f the following:                                                           

23.                                                                                                                           

24.                                                   . ( ) , * @ % & = - + < / > at in is mod remainder not re               

25.                                                m                                                                          

26.                                                   <an exponent (**)> <> or != or ~= >= <= <> and or like LI               

27. KE2_                                                                       

28.                                                   LIKE4_ LIKEC_ between || multiset member SUBMULTISET_                   

29.                                                The symbol "." was substituted for "ULL" to continue.                      

30. 

Source: http://blog.csdn.net/leshami/article/details/6913026

Guess you like

Origin www.cnblogs.com/moonfans/p/11312078.html
Recommended