Expand my Community achievements bar.

How to Handle JDBC Null Pointer Exception

Avatar

Former Community Member

Hi All,

I have a SQL query, which may return NULL for some data and hence my process fails as null pointer exception.

How do I handle this exception in my process and move forward with next steps.

Please Suggest.

3 Replies

Avatar

Former Community Member

Any Helpful Answers Please !!!!

Regards--

Chalukya.

Avatar

Level 10

You can change the SQL query to return emptry string instead of NULL value.

e.g. if you want to return empty or other default value when an email contains null value, use the following query.

SELECT COALESCE(Email,'no email specified' ) AS EmployeeEmail FROM PersonalTable

The COALESCE method will return the first non-null value specified in the parameter list.

Nith