views:

44

answers:

2

Hi

What is the equivalent of

DECLARE @Variable INT SET @Varialbe = 1

in Oracle?

Thanks

+3  A: 

In PL/SQL, you have a declare block:

declare
    x integer := 1;
    ...
begin
    ...
end;

If you are writing an SQL*Plus script, you use variable to declare a bind variable

variable x integer := 1;

It's also possible to define variables.

FrustratedWithFormsDesigner
+1  A: 

In PL/SQL:

DECLARE
  a number;
BEGIN
  a := 1;
END;

You can paste this code in SQLPlus to run it.

Pablo Santa Cruz