0

PreparedStatement ps1 = con.prepareStatement("update cart set address = ?,city =?,state=?,country=?,mobileNumber=?,orderDate=SYSDATE,deliveryDate= orderDate + INTERVAL '10' DAY ,paymentMethod = ?,transactionId = ?,status=? where email = ? and address is NULL");

orderDate & deliveryDate has varchar(100) datatype in db.

1
  • Why would your date columns have a varchar type? To get rid of the error, you will need to convert the date into a string. Commented Feb 1, 2022 at 19:15

1 Answer 1

0

The datatype of the returned value for SYSDATE is DATE. As orderDate & deliveryDate is varchar(100) datatype, you need to use TO_CHAR() to convert it. use something like below

update cart set address = ?,city =?,state=?,country=?,mobileNumber=?,
orderDate=TO_CHAR(SYSDATE, 'yyyy/mm/dd'),
deliveryDate= TO_CHAR(SYSDATE + INTERVAL '10' DAY,'yyyy/mm/dd') , 
paymentMethod = ?,transactionId = ?,status=? where email = ? and address is 
NULL");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.