Prepare Interview

Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address
Check our LIVE MOCK INTERVIEWS

SQL Interview Questions and Answers

Test your skills through the online practice test: SQL Quiz Online Practice Test

Experienced / Expert level questions & answers

Ques 1. How to Retrieve Warnings?

SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something did not happen as planned. A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object




SQLWarning warning = stmt.getWarnings();

if (warning != null)

{

while (warning != null)

{

System.out.println("Message: " + warning.getMessage());

System.out.println("SQLState: " + warning.getSQLState());

System.out.print("Vendor error code: ");

System.out.println(warning.getErrorCode());

warning = warning.getNextWarning();

}

}

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

Related interview subjects

MySQL interview questions and answers - Total 108 questions
DBMS interview questions and answers - Total 73 questions
SQLite interview questions and answers - Total 10 questions
MSSQL interview questions and answers - Total 50 questions
Oracle interview questions and answers - Total 34 questions
Redis Cache interview questions and answers - Total 20 questions
SQL interview questions and answers - Total 152 questions
©2023 WithoutBook