Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dbms_output cannot print boolean?

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

like image 477
Shree Naath Avatar asked Oct 19 '16 07:10

Shree Naath


Video Answer


1 Answers

The function bool_to_text does not exist (and AFAIK, Oracle never had such a function).

You can use diutil.bool_to_int to convert the Boolean to an Integer and print that:

begin
  dbms_output.put_line(sys.diutil.bool_to_int(true));
end;
like image 169
Frank Schmitt Avatar answered Oct 06 '22 08:10

Frank Schmitt