user2389221 user2389221 - 7 months ago 13
SQL Question

How to create a temp variable in database oracle query?

Similar to programming languages, is it possible to create a temporary variable and define it a value? e.g.

String date = '12-MAY-12'

Select COUNT (*) FROM TABLEX WHERE TABLE_DATE < DATE;

ZZa ZZa
Answer

The answer is, it depends.

It depends on environment you use.

For example, Allround Automations PL/SQL Developer accepts sign & before string for variables (values of them are asked during query execution):

SELECT COUNT (*) 
FROM TABLEX 
WHERE TABLE_DATE < &DATE;
Comments