import testsuite.BaseTestCase; import java.sql.*; public class bug61866 extends BaseTestCase { public bug61866(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(bug61866.class); } public void testbug61866() throws Exception { try { this.stmt.execute("drop procedure if exists WARN_PROCEDURE"); this.stmt.execute("CREATE PROCEDURE WARN_PROCEDURE() BEGIN DECLARE l_done INT; SELECT 1 INTO l_done FROM DUAL WHERE 1=2; END"); this.pstmt = this.conn.prepareStatement("CALL WARN_PROCEDURE()"); this.pstmt.execute(); assertTrue("No warning when expected", this.pstmt.getWarnings().toString().contentEquals("java.sql.SQLWarning: No data - zero rows fetched, selected, or processed")); this.pstmt.clearWarnings(); assertNull("Warning when not expected", this.pstmt.getWarnings()); } finally { this.stmt.execute("drop procedure if exists WARN_PROCEDURE"); //closeMemberJDBCResources(); } } }