How can we compare Two dates
set_up_date = 20-02-18 (in date)
expiry_date = 23-04-20 (in date)
select *
BETWEEN TO_NUMBER(TO_CHAR('set_up_date','YYYYMMDD')) AND
TO_NUMBER(TO_CHAR('expiry_date','YYYYMMDD'))
from dual;
How can we compare Two dates
set_up_date = 20-02-18 (in date)
expiry_date = 23-04-20 (in date)
select *
BETWEEN TO_NUMBER(TO_CHAR('set_up_date','YYYYMMDD')) AND
TO_NUMBER(TO_CHAR('expiry_date','YYYYMMDD'))
from dual;
'set_up_date'
and 'expiry_date'
are string literals - they are not column names or bind variables. You also need to use the correct syntax for a query which has statements in the order: SELECT ... FROM ... [WHERE ...] [GROUP BY ...] [ORDER BY ...]
.
So, if you have a table your_table
with a your_date_column
column of the DATE
data type then you can compare it to the two DATE
variables set_up_date
and expiry_date
identified in your question using:
SELECT *
FROM your_table_name
WHERE your_date_column BETWEEN set_up_date AND expiry_date;