declare
v_emp emp%rowtype;
begin
select * into v_emp from emp where empno=7369;
dbms_output.put_line(v_emp.ename);
end;在pl/sql里面执行不会输出结果。为什么呢?
v_emp emp%rowtype;
begin
select * into v_emp from emp where empno=7369;
dbms_output.put_line(v_emp.ename);
end;在pl/sql里面执行不会输出结果。为什么呢?
set serveroutput on;
declare
v_emp emp%rowtype;
begin
select * into v_emp from emp where empno=7369;
dbms_output.put_line(v_emp.ename);
end;
set serveroutput on;
set serveroutput on;
declare
v_sal emp.sal%type;
begin
select sal into v_sal from emp
where empno = 7369;
if(v_sal<1200) then
dbms_output.put_line('low');
elsif(v_sal<2000) then
dbms_output.put_line('middle');
else
dbms_output.put_line('high');
end if;
end;
/ 加上后在客户端运行了下,说ORA-00922:缺少或无效选项
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining optionsSQL> set serveroutput on;
SQL> declare
2 v_sal emp.sal%type;
3 begin
4 select sal into v_sal from emp
5 where empno = 7369;
6 if(v_sal <1200) then
7 dbms_output.put_line('low');
8 elsif(v_sal <2000) then
9 dbms_output.put_line('middle');
10 else
11 dbms_output.put_line('high');
12 end if;
13 end;
14 /
lowPL/SQL procedure successfully completed.SQL>
plsql可能需要某个菜单里面的某个选项设置一下,不需要这个命令吧。没用过的工具问题就搞不懂了。
呵呵。不过开发还是用pl/sql或toad好调试点。
declare
v_sal scott.emp.sal%type;
begin
select sal into v_sal from scott.emp
where empno = 7369;
if(v_sal <1200) then
dbms_output.put_line('low');
elsif(v_sal <2000) then
dbms_output.put_line('middle');
else
dbms_output.put_line('high');
end if;
end;
set serveroutput on;
declare
v_sal scott.emp.sal%type;
begin
select sal into v_sal from scott.emp
where empno = 7369;
if(v_sal <1200) then
dbms_output.put_line('low');
elsif(v_sal <2000) then
dbms_output.put_line('middle');
else
dbms_output.put_line('high');
end if;
end;
然后按F8执行,可是看不到运行结果啊?