I have a table and if data exists I have to display data with dbms_output. If the table is empty I have to write a message "table is empty'.
I want to use cursors and I don't know how the condition should look like when the table is empty.
That works fine:
declare
cursor cursor_name is select nr, name from branch;
begin
for i in cursor_name
loop
dbms_output.put_line('Number: ' || to_char(i.nr) || ' Name: ' || i.name);
end loop;
end;
/
You can use such a simple code block
if your aim is displaying only for the case that the table has no data