Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top