views:

57

answers:

1

I have write the following pl/sql program and unable to dectect the error :

 declare
 variable a number;
 b number:=2354;
 begin
 b:=:a;
 end;

the error in this is

SP2-0552: Bind variable "A" not declared.

plz help ...

+6  A: 

VARIABLE is a SQL*PLus keyword. So you need to move it outside the PL/SQL declaration:

SQL> variable a number;
SQL>
SQL> declare
  2      b number:=2354;
  3  begin
  4      :a := b;
  5  end;
  6  /

PL/SQL procedure successfully completed.

SQL>
SQL> print a

         A
----------
      2354

SQL>
APC