Declare a variable in Oracle SQL to use in a query Declare a variable in Oracle SQL to use in a query oracle oracle

Declare a variable in Oracle SQL to use in a query


try this:

variable var DATEexec :var := '15-OCT-13'

and then your select with using :var in it


I have found a way to add variables for the sql query as follows

DEFINE RES_DT = TO_DATE('11-AUG-15');

And also to access the variable through the query we have to use '&' notation as follows

select * from customer where assign_date = &RES_DT;