This is our code:
Procedure WRITE_ORPHANED_CHILD is
CURSOR ORPHANED_cur IS
SELECT c.id FROM cat c
WHERE parent_count=0
AND NOT EXISTS (SELECT 'X'
FROM store_root_Cat src
WHERE src.cat_id=c.id);

begin
for c in fran loop
UTL_FILE.PUT_LINE ( Orphaned_Child_info, to_number(c.id);
end loop;
end;

Firstly does it look correct? We want to create a cursor based on a record_count field not being updated by the count and display them.

Secondly, I am contemplating using the spool command too? I do know that UTL uses the parameter in the init file, how different are these two utilities? and which was is better for me to allow developers to run this code and print it to a file?

Thanks,
Nirasha