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!

Simple use of variables in query

807711Oct 24 2010 — edited Oct 24 2010
Hi,

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.
This post has been answered by Saubhik Banerjee on Oct 24 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 21 2010
Added on Oct 24 2010
2 comments
778 views