if (sqlca != null) {
System.err.println ("SqlCode: " + sqlca.getSqlCode());
System.err.println ("SQLERRMC: " + sqlca.getSqlErrmc());
System.err.println ("SQLERRP: " + sqlca.getSqlErrp() );
String[] sqlErrmcTokens = sqlca.getSqlErrmcTokens();
for (int i=0; i< sqlErrmcTokens.length; i++) {
System.err.println ("  token " + i + ": " + sqlErrmcTokens[i]);
}
int[] sqlErrd = sqlca.getSqlErrd();
char[] sqlWarn = sqlca.getSqlWarn();
System.err.println ("SQLSTATE: " + sqlca.getSqlState());
System.err.println ("message: " + sqlca.getMessage());
          }
}
sqle=sqle.getNextException();              
    }
}
Error handling using the WHENEVER statement
The WHENEVER statement causes the SQL precompiler to generate source 
code that directs the application to go to a specified label if either an error, a 
warning, or no rows are found during execution. The WHENEVER statement 
affects all subsequent executable SQL statements until another WHENEVER 
statement alters the situation.
The WHENEVER statement has three basic forms:
EXEC SQL WHENEVER SQLERROR   action 
EXEC SQL WHENEVER SQLWARNING action 
EXEC SQL WHENEVER NOT FOUND  action
In the above statements:
SQLERROR: Identifies any condition where SQLCODE < 0. 
SQLWARNING: Identifies any condition where SQLWARN(0) = W or 
SQLCODE > 0 but is not equal to 100. 
NOT FOUND: Identifies any condition where SQLCODE = 100. 
In each case, the 
action 
can be either of the following:
CONTINUE: Indicates to continue with the next instruction in the application. 
GO TO 
label: 
Indicates to go to the statement immediately following the label 
specified after GO TO. (GO TO can be two words, or one word, GOTO.) 
If the WHENEVER statement is not used, the default action is to continue 
processing if an error, warning, or exception condition occurs during execution.
218 
MySQL to DB2 UDB Conversion Guide






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

san diego web hosting

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved