I am using JSP script which update/inserts some value into DB2, but getting error while doing the same.
The script is passing some values which uses the same in the update/insert SQL. The date value is initialized as null in a variable & this variable is called in the SQL statement. If the date is null it passes a null value & this gives error.
============
String Np1_dob = request.getParameter("p1_dob");
String UpdSql = "update db2admin.T_CUS_NAP set " ;
UpdSql = UpdSql + "(CUS_ORG, CUS_PTNR1_DOB, CUS_PTNR1_SPS_NM, CUS_PTNR1_SPS_DOB) = ('";
UpdSql = UpdSql + Ndname + "','" + Np1_dob + "','" + Np1_spnm + "','" + Np1_spdob +"'";
=================
The variable is p1_dob is initially passed as null. If contains a date then value is passed to Np1_dob (as shown above), then SQL works fine but if its a null value then gives error as the SQL passes the null value with quotes ('null') which is not accepted in DB2 for date values.
How do I get this done ?
Please Help.
TIA
Raj
The script is passing some values which uses the same in the update/insert SQL. The date value is initialized as null in a variable & this variable is called in the SQL statement. If the date is null it passes a null value & this gives error.
============
String Np1_dob = request.getParameter("p1_dob");
String UpdSql = "update db2admin.T_CUS_NAP set " ;
UpdSql = UpdSql + "(CUS_ORG, CUS_PTNR1_DOB, CUS_PTNR1_SPS_NM, CUS_PTNR1_SPS_DOB) = ('";
UpdSql = UpdSql + Ndname + "','" + Np1_dob + "','" + Np1_spnm + "','" + Np1_spdob +"'";
=================
The variable is p1_dob is initially passed as null. If contains a date then value is passed to Np1_dob (as shown above), then SQL works fine but if its a null value then gives error as the SQL passes the null value with quotes ('null') which is not accepted in DB2 for date values.
How do I get this done ?
Please Help.
TIA
Raj