SQLERR

SQLERR

Notes:

  1. This command is only available with Natural for DB2, Natural SQL Gateway, and Natural for SQL/DS.
  2. There are minor differences depending on whether the command is used with Natural for DB2, Natural SQL Gateway, or Natural for SQL/DS. These differences are marked accordingly in the following description.

The SQLERR command is used to obtain diagnostic information about the most recent SQL error.

When an SQL error occurs, Natural issues an appropriate error message. When you enter the SQLERR command, the following information on the most recent SQL error is displayed:

  • the Natural error message number;

  • the corresponding reason code (if applicable);

  • for Natural for DB2: the variables SQLSTATE and SQLCODE returned by DB2

  • for Natural SQL Gateway: the SQLCODE returned by the ConnecX SQL Engine or the SQL database system;

  • for Natural for SQL/DS: the variables SQLSTATE and SQLCODE returned by SQL/DS;

  • the corresponding error message.

The SQLERR command can be issued either from the Natural NEXT prompt or from within a Natural program (by using the FETCH statement).

Sample SQLERR Diagnostic Information Screen (Natural for DB2)

                ***** SQLERR Diagnostic Information *****                   
---------------------- NATURAL SQL Interface Codes -------------------------
Return Code: 3700    Reason Code: 0      SQLSTATE : 52003    SQLCODE: -206 
--------------------------------- SQLCA-------------------------------------
SQLERRP (DB2 Sub routine where error occurred)             :  DSNXOGP       
SQLERRD (DB2 Internal State)                                                
        RDS Return Code                                    :         700    
        DBSS Return Code                                   :           0    
        Number of Rows Processed                           :           0    
        Estimated Cost                                     :          11.2  
        Syntax error on PREPARE or EXECUTE IMMEDIATE       :           0    
        Buffer Manager ERROR Code                          :           0    
SQLWARN (Warning Flags)                                                     
        Data truncated                                                      
        Null Values ignored (AVG,SUM,MAX,MIN)              :                
        No. of columns greater than no. of host variables  :                
        UPDATE/DELETE without WHERE clause                 :                
        SQL Statement not valid in DB2                     :                
         Adjustment to DATE/TIMESTAMP Variable made         :               
DB2 Error Message :                                                    
DSNT4081 SQLCODE = -206, ERROR: THE OBJECT TABLE OR VIEW OF THE INSERT,
              DELETE, OR UPDATE STATEMENT IS ALSO IDENTIFIED IN A FROM CLAUSE

Sample SQLERR Diagnostic Information Screen (Natural SQL Gateway)

                  *** SQLERR Diagnostic Information ***                      
---------------------- Natural SQL Interface Codes ------------------------- 
Return Code: 3700    Reason Code: 0                 ZZN01    SQLCODE: -4017  
--------------------------------- SQLCA ------------------------------------ 
SQLERRD (Additional Information)                                             
        Number of Rows Processed                           :           0     
                                                                              
SQLWARN (Warning Flags)                                                      
        Data truncated                                     :                 
                                                                             
        No. of columns greater than No. of host variables  :                 
CNX Error Message :                                                          
4017(E): SERVER ERROR: ODBC:(HY000) NATIVE:(0) : Ambiguous table reference: (D
EMO) ? PERS_ID , NAME , ADDRESS , DATEOFBIRTH , SALARY FROM << Syntax Error >>
  NSB.DEMO ?.                                                                 
                                                                              
 
 
 
                                                                               
                                                                               
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
            Error Exit  Expl        Parms  -     +          Prev  Next  Canc

Sample SQLERR Diagnostic Information Screen (Natural for SQL/DS)

                   *** SQLERR Diagnostic Information ***
----------------------- NATURAL SQL Interface Codes -------------------------
Return Code: 3700              Reason Code: 0                SQLCODE: -204  
-------------------------------- SQLCA --------------------------------------
SQLERRP (Adabas SQL Subroutine where error occurred)       :  ARIXOCA        
SQLERRD (Adabas SQL Internal State)                                          
        RDS Return Code                                    :            100  
        DBSS Return Code                                   :              0  
        Number of Rows Processed                           :              0  
        Estimated Cost                                     :              1.0
        Syntax error on PREPARE or EXECUTE IMMEDIATE       :              0  
        Buffer Manager ERROR Code                          :              0  
SQLWARN (Warning Flags)                                                      
        Data truncated                                                       
        Null Values ignored(AVG,SUM,MAX,MIN)               :                 
        No. of columns greater than no. of host variables  :                 
        UPDATE/DELETE without WHERE clause                 :                 
        SQL statement causes a performance degradation     :                 
        Adjustment to DATE/TIMESTAMP Variable made         :                 
SQL/DS Error Message :                                                       
SAG.SYSTABLES  not found in system catalog