Search code examples
oraclevariablesplsql

What is wrong with this PL/SQL? Bind Variable * is NOT DECLARED


Here is:

declare
  v_str1   varchar2(80);
begin
  v_str1 := 'test';
  print :v_str1;
end

When I run it using SQLDeveloper just in a sql worksheet I get this:

Bind Variable "v_str1" is NOT DECLARED
anonymous block completed

Solution

  • Got it:

    set serveroutput on
    
    declare
      v_str1   varchar2(80);    
    begin
     v_str1 := 'test';
     dbms_output.put_line(v_str1);
    end;
    

    More info here.