Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
|
Using XML-SQL Utility (XSU), 13 of 26
When there are no rows to process the utility simply returns a null string. But it might be desirable to get an exception everytime there are no more rows present, so that the application can process this through exception handlers. When the setRaiseNoRowsException
() is set, then whenever there are no rows to generate for the output the utility raises a oracle.xml.sql.OracleXMLSQLNoRowsException. This is a run time exception and need not be caught unless needed. The following code extends the previous examples to use the Exception instead of checking for null strings.
public class pageTest { .... // rest of the class definitions.... public void main(String[] argv) { pageTest test = new pageTest("select * from emp"); test.query.setRaiseNoRowsException(true); // ask it to generate exceptions try { while(true) System.out.println(test.nextPage()); } catch(oracle.xml.sql.OracleXMLNoRowsException) { System.out.println(" END OF OUTPUT "); test.close(); } } }
Note how the condition to check the termination changed from checking for the result to be null to an exception handler.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|