问题
我只是想看一个变量的值。我不明白为什么这一定很困难。
我的SQL语句
--set serveroutput on format wrapped; Tried this too
SET SERVEROUTPUT ON;
--DBMS_OUTPUT.ENABLE(32000); Tried with, and without this
vend_num xx.VENDOR_CWT.VEND_NO%TYPE;
SELECT vend_no
INTO vend_num
FROM xx.VENDOR_NAME
WHERE VENDOR_NAME1 = 'xxxx';
dbms_output.put_line(vend_num);
我得到的错误
Error starting at line 13 in command:
dbms_output.put_line(vend_num)
Error report:
Unknown Command
我尝试过什么
我尝试过以下答案:
Print text in Oracle SQL Developer SQL Worksheet window
Printing the value of a variable in SQL Developer
我已经完成了这个答案建议的gui:https://stackoverflow.com/a/7889380/496680
我已尝试exec dbms_output[...]
,因为有些帖子已经建议过了。
问题
如何打印vend_num的值;
答案 0 :(得分:5)
DBMS_Output是一个PL / SQL包,所以你可以在PL / SQL代码中调用它。
declare
end_num xx.VENDOR_CWT.VEND_NO%TYPE;
begin
SELECT vend_no
INTO vend_num
FROM xx.VENDOR_NAME
WHERE VENDOR_NAME1 = 'xxxx';
dbms_output.put_line(vend_num);
end;
/