id
我做错了什么? 它正在开发其他程序,所以我很难确定究竟是什么阻止它工作。该过程也成功运行。有什么想法吗? 感谢您的任何帮助。我确信我只是遗漏了一些非常明显的东西。
当我运行时:
SET SERVEROUTPUT ON
SET VERIFY OFF
DECLARE
v_idno oilcust1.custid%TYPE :=&input_idno;
v_tank oilcust1.tankcapacity%TYPE;
v_name oilcust1.custname%TYPE;
v_state oilcust1.custstate%TYPE;
v_city oilcust1.custcity%TYPE;
BEGIN
SELECT custid, custname, tankcapacity, custstate, custcity INTO v_idno, v_name, v_tank, v_state, v_city
FROM oilcust1
WHERE custid = v_idno;
IF v_state = 'NC' THEN
IF v_tank > 500 THEN
IF v_city = 'Asheville' THEN
DBMS_OUTPUT.PUT_LINE(v_name || ' is a in an immediate city
and holds an above average tank.');
ELSE
DBMS_OUTPUT.PUT_LINE(v_name || ' is not of priority at this time.');
END IF;
END IF;
END IF;
END;
/
SET VERIFY ON
SET SERVEROUTPUT OFF
没有DBMS线。
答案 0 :(得分:1)
我尝试复制同样的问题,问题仅在于会话的set serveroutput on
。请参阅下面的代码,尝试使用Minimal, Complete, and Verifiable example
File: p1.sql
declare
v_empno integer :=&input_empno;
v_ename varchar2(10);
begin
select ename into v_ename from emp where empno = v_empno;
if v_empno > 7700 then
if v_ename is not null then
dbms_output.put_line(v_ename);
else
dbms_output.put_line('empno doesn''t exist');
end if;
else
dbms_output.put_line('please enter empno < 7700');
end if;
end;
/
没有set serveroutput on;
C:\Users\Utsav>sqlplus ***/***@localhost
SQL*Plus: Release 11.2.0.2.0 Production on Sat May 13 12:21:35 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> @C:\ora\p1.sql
Enter value for input_empno: 7782
old 2: v_empno integer :=&input_empno;
new 2: v_empno integer :=7782;
PL/SQL procedure successfully completed.
服务器输出
之后SQL> set serveroutput on;
SQL> @C:\ora\p1.sql
Enter value for input_empno: 7782
old 2: v_empno integer :=&input_empno;
new 2: v_empno integer :=7782;
CLARK
PL/SQL procedure successfully completed.
SQL>