13

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

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Shree Naath
  • 477
  • 2
  • 5
  • 18

1 Answers1

35

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;
Frank Schmitt
  • 30,195
  • 12
  • 73
  • 107
  • also when I try to use row count . It always returns 0 even if there are values in the table .DECLARE CURSOR c_employees_3i is SELECT * FROM employees_3i; row_count NUMBER; BEGIN OPEN c_employees_3i; row_count := c_employees_3i%rowcount; Dbms_Output.put_line(row_count); CLOSE c_employees_3i; END; – Shree Naath Oct 19 '16 at 07:18
  • @ShreeNaath Please ask a separate question for this (after searching the site for similar questions. I'd guess this has been asked before). – Frank Schmitt Oct 19 '16 at 07:28