Simple use of variables in query
807711Oct 24 2010 — edited Oct 24 2010Hi,
i've just started using PL/SQL and as a long time user of TSQL the syntax is a bit confusing for me. I'm trying to test a simple query - using a variable to select some rows from a table. Lest assume that we have a table with data from different days and we want to view data from specific day.
I could use:
SELECT * FROM TABLE
where TRADE_DATE = '2010-10-23'
but what i would like to do is to pass the date value as a variable, in TSQL i'd just write:
declare @trade_date datetime
set @trade_date = '2010-10-23'
SELECT * FROM TABLE
where TRADE_DATE = @trade_date
Could someone help me and write the last query using PL/SQL syntax?
Also - it there some kind of a tutorial for people like me? comparison of simple queries written in both languages? tried to google it but didn't have luck.