这是:
declare
v_str1 varchar2(80);
begin
v_str1 := 'test';
print :v_str1;
end
当我在 sql 工作表中使用 SQLDeveloper 运行它时,我得到了这个:
Bind Variable "v_str1" is NOT DECLARED
anonymous block completed
最佳答案
print
不是 PLSQL 函数。如果你想得到一个输出,你可以使用 dbms_output.put_line(v_str1);
set serveroutput on;
declare v_str1 varchar2(80);
begin
v_str1 := 'test';
dbms_output.put_line(v_str1);
end;
:v_str1 是一个绑定(bind)变量,但您不能在 plsql 中声明。当您声明它时,您必须使用 VARIABLE 关键字。
关于oracle - 这个 PL/SQL 有什么问题?绑定(bind)变量 * 未声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1597806/