0
declare
    v_empno empdab.eno%type:=&n;
    v_empdab empdab%rowtype;
    begin
    select eno, ename,doj,position,salary,comm,address into v_empdab from empdab where eno=v_empno;
      dbms_output.put_line(v_empdab.eno||v_empdab.ename||v_empdab.doj||v_empdab.position||v_empdab.salary||v_empdab.comm||v_empdab.address);
end ;
4

1 回答 1

2

SQL*Plus 命名参数可以在 PL/SQL 中使用。我认为您还没有向我们发送真正的代码。

Script start cc.sql
accept n prompt 'Enter value for n :'

set serveroutput on

declare
   v_v test.v%type := &n;
   r_v test%rowtype;

begin
   dbms_output.put_line(v_v);
   select v into v_v from test where rownum = 1;
   dbms_output.put_line(v_v);
   dbms_output.put_line(&n);

end;
/
End Script cc.sql

   

SQL> @cc
Enter value for n :'abc'
old   2:    v_v test.v%type := &n;
new   2:    v_v test.v%type := 'abc';
old   9:    dbms_output.put_line(&n);
new   9:    dbms_output.put_line('abc');
abc
a
abc

PL/SQL procedure successfully completed.

SQL>
于 2012-07-05T07:52:26.577 回答