Today I read a book and wroteCodeBut it can be executed in seqplus, but cannot be executed in PLSQL. I checked it online.
<Outer> declare v_deptno number (2); v_dname varchar2 (10); begin <inner> begin select deptno into v_deptno from EMP where lower (ename) = lower ('& name'); end; -- <inner> select dname into v_dname from Dept where deptno = v_deptno; dbms_output.put_line ('department name:' | v_dname ); end; -- <outer>
It is found that two prefixes are missing,
Declare
Begin
End;
With the same code, PLSQL can be executed.
-- Name block declarebegin <outer> declare v_deptno number (2); v_dname varchar2 (10); begin <inner> begin select deptno into v_deptno from EMP where lower (ename) = lower ('& name'); end; -- <inner> select dname into v_dname from Dept where deptno = v_deptno; dbms_output.put_line ('department name:' | v_dname ); end; -- <outer> end;