0

im application developer and we are using Oracle database for this project. I never used oracle before so i want some help to build a simple query. I have a CARD table with these columns EXPIREMONTH and EXPIREDAY. I would like to return the CARDS that will expire in the next month from the SYSDATE

  select * from CARDS where EXPIREMONTH == Sysdate('MM' + 1) // something like this 

Thanks.

1 Answer 1

0

You have not specified the data type of ExpireMonth. If it is a date or timestamp you can try this

select * from CARDS where EXTRACT(MONTH FROM EXPIREMONTH) + 1 = EXTRACT(MONTH FROM CURRENT_TIMESTAMP) + 1

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.