-- Sample Script to test performance improvement from PL/SQL native compilation


-- Thin wrapper for executing SQL statements

-- Note: Following code sample depend on the employees and departments tables.
-- These are in the hr sample schema. Scripts to create and populate this are provided

-- with Oracle9i, and it is included in the standard pre-built database. The sample
-- is complete.
-- Connect hr/hr@9i 
set serveroutput on
     

begin
  for department in ( select department_id d, department_name from departments
                      order by department_name )
  loop
    Dbms_Output.Put_Line ( Chr(10) || department.department_name );
    for employee in ( select last_name from employees
                      where department_id = department.d

                      order by last_name )
    loop
      Dbms_Output.Put_Line ( '- ' || employee.last_name );
    end loop;
  end loop;
end;
/
Show Errors