oracle dbms_output 无法打印布尔值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40124414/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
dbms_output cannot print boolean?
提问by Shree Naath
I am learning cursors and I cannot print the boolean value in the
我正在学习游标,但无法在
dbms_output.put_line();
The code is
代码是
DECLARE
CURSOR c_employees_3i is
SELECT * FROM employees_3i;
row_count BOOLEAN;
BEGIN
OPEN c_employees_3i;
row_count := c_employees_3i%isopen;
Dbms_Output.put_line(bool_to_text(row_count));
CLOSE c_employees_3i;
END;
I get this error
我收到这个错误
ORA-06550: line 8, column 22:
PLS-00201: identifier 'BOOL_TO_TEXT' must be declared
ORA-06550: line 8, column 1:
PL/SQL: Statement ignored
Please help me to rectify the error. Thanks
请帮我纠正错误。谢谢
回答by Frank Schmitt
The function bool_to_text
does not exist (and AFAIK, Oracle never had such a function).
该功能bool_to_text
不存在(AFAIK,Oracle 从未有过这样的功能)。
You can use diutil.bool_to_int
to convert the Boolean to an Integer and print that:
您可以使用diutil.bool_to_int
将布尔值转换为整数并打印:
begin
dbms_output.put_line(sys.diutil.bool_to_int(true));
end;