Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Declare constant or variables in a SQL statement and use in a query

646747Jun 24 2008 — edited Jun 24 2008
Hi,
I'd like to use a constant in a query oracle. (with sql-developer)
I want to declare this constant (ex a date) only one time in the statement and then I want use that constant in the "where" part of the query.

I tried this for example:
DECLARE
prova CONSTANT VARCHAR(8) := '20080601';
BEGIN
SELECT * FROM WN_T_CON_PREST PREST2 WHERE PREST2.D_CON_DATA_FINE>=TO_DATE(prova,'YYYYMMDD');
END;

I selected the query, I played the query (F9 in sql-developer), but it doesn't work.

There is anyone who can help me?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2008
Added on Jun 24 2008
5 comments
6,744 views