I need a simple query. Just a select statement but with several unions each having the same date filter. I would like to declare the date at the beginning of the script. I don't have permission to create a table hence SELECT INTO won't work. I tried the below:
DECLARE
stdt date := SYSDATE;
Begin
select * from tbl
where til_date < stdt;
End;
I have used SYSDATE just for representation. I need to use different dates in place of SYSDATE and there are n number of unions. Hence I require date to be declared at the start. The problem with the above query is that I don't have access to create table and hence can't use SELECT INTO. Please help me how to achieve this.