Link to home
Start Free TrialLog in
Avatar of lmymusic2000
lmymusic2000

asked on

how to update a null date in JAVA

I would like to ask JAVA developers this question. I encounter a situation where my java program failed to read a null date in a Oracle table. The compile error is 'JAVA NULL POINTER EXCEPTION'. What should be the logic in code to handle this situation. I am initialize my date field as date. I try to initialize my date field as string to get around this issue and not working either. All input welcome. Thanks
SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CEHJ
You could try the following or ResultSet.wasNull
Object date = resultSet.getObject(n);
if (date == null) {
   // Take action
}

Open in new window

Post your code and we'll try to find the solution.
This is definitely better than trying to store date as string - sooner or later
you'll regret doing it in your database - I had a few cases like that in the old tables - since then
trying to cope with this unfortuinate decision

and I'm sure we'll find something how to deal with null pointer
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lmymusic2000
lmymusic2000

ASKER

I've found the solution on my own. Thank you for all of your respond
I've requested that this question be closed as follows:

Accepted answer: 0 points for lmymusic2000's comment http:/Q_27430686.html#37126318

for the following reason:

I've found the solutions. Thank you for all the responds.
>>I've found the solution on my own. Thank you for all of your respond

Sorry - that's not an acceptable response
Hi Mod,
Actually other team members in this project found the solution to this question and I do not know what is the actual coding behind this. Please close this question and thank you for all the  respond
Sorry that's not acceptable either. No refund