Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using declare variables in Oracle

Tags:

sql

plsql

I am having a syntax issue with the declaration in Oracle. I am using these variables on MS SQL server and they work just fine; however, how do I declare these in Oracle?

Use in MS SQL server:

DECLARE @FROM_DT DATETIME
DECLARE @END_DT  DATETIME
DECLARE @LOCATION  VARCHAR(100)

SET @FROM_DT = '04/01/2011'
SET @END_DT =  '05/09/2011'
SET  @LOCATION ='VA'
like image 729
joe Avatar asked Mar 14 '26 02:03

joe


1 Answers

You cannot declare variables outside of a PL/SQL block.

The format of variable declarations inside a PL/SQL block is described very detailed in the manual (including examples):

http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/fundamentals.htm#CIHGGIAH


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!