Handling nulls when using Oracle XMLType

boss700

New Member
I am using Oracle's XMLType function to get XML data from a stored procedure that returns a cursor. My SQL looks something like this:\[code\]select XMLType(package_name.storedProcName('PARAM1', 'PARAM2', 'PARAM3')) as sresult from dual;\[/code\]In cases where the stored procedure returns records, this works fine and I get the XML result that I expect. However, when the procedure returns no records, I get the following error(s):\[code\]ORA-06502: PL/SQL: numeric or value errorORA-06512: at "SYS.XMLTYPE", line 334ORA-06512: at line 1\[/code\]Preferably, I'd like to return null, a blank string or some other value in this case. Certainly I want to avoid raising an Oracle exception every time this happens. What can I do to achieve this?Note: I cannot alter the Oracle stored procedure.
 
Back
Top