Follow by Email

Thursday, January 16, 2014

java.sql.SQLDataException: ORA-01405: fetched column value is NULL

Exception Description

ORA-01405 is thrown when you attempt to execute FETCH, which was returned as a NULL value, but there was no indicator in use. If you are using Oracle

I have a databse function to which if you pass a query it will give you back a CLOB containing XML output of that query , I encountered this error today when I try to pass a query which returns null as result there I got this exception.


Once I understood the exception and it's cause the handling code aws easy to write , in my catch block I will retun an error message like "No Record Found ,You may want to revise your query to get some data satifying your conditions".


You might try resolving ORA-01405 by substituting a value with NVL function when a NULL value appears, or simply construct your cursor so that NULL values are not returned (you may also specify that columns with NULL values are not received).