17,377
社区成员
发帖
与我相关
我的任务
分享
SQL> create or replace function fntest
2 return nvarchar2
3 is
4 ename nvarchar2(30);
5 begin
6 select first_name into ename from hr.employees where rownum = 1;
7 return ename;
8 end;
9 /
Function created
SQL> set serveroutput on;
SQL>
SQL> declare
2 ename nvarchar2(30);
3 begin
4 select fntest into ename from dual;
5 dbms_output.put_line(ename);
6 end;
7 /
Steven
PL/SQL procedure successfully completed
SQL> set serveroutput on;
SQL>
SQL> declare
2 a int;
3 b int;
4 begin
5 a:=1;
6 dbms_output.put_line(a);
7 select a into b from dual;
8 dbms_output.put_line(b);
9 end;
10 /
1
1
PL/SQL procedure successfully completed