朋友们,我需要在执行pl / sql块时从用户那里获得输入我试过这个:
Accept x number prompt 'enter variable'
set serveroutput on
declare
begin
dbms_output.putline('ut entered value id'||x);
end;
/
但是我得到了错误:
在命令的第3行开始出错:
declare
begin
dbms_output.putline('ut entered value id'||x);
end;
Error report:
ORA-06550: line 7, column 44:
PLS-00201: identifier 'X' must be declared
ORA-06550: line 7, column 1:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
任何人都可以帮助我!
答案 0 :(得分:1)
SQL * Plus substitution variables引用了&符号&
:
SQL> Accept x number prompt 'enter variable:'
enter variable:1234
SQL> set serveroutput on
SQL> declare
2 begin
3 dbms_output.put_line('ut entered value id:'||&x);
4 end;
5 /
old 3: dbms_output.put_line('ut entered value id:'||&x);
new 3: dbms_output.put_line('ut entered value id:'|| 1234);
ut entered value id:1234
PL/SQL procedure successfully completed.
答案 1 :(得分:0)
不确定这是你的事,但也许......
Select * from DBA_ROLE_PRIVS where grantee = '&Grantee';