User Tools

Site Tools


kurs:write_to_file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

kurs:write_to_file [2014/09/10 21:22] (current)
Line 1: Line 1:
 +select * from all_directories;​
  
 +<​code>​
 +PACKAGE BODY TEST_PACKAGE
 +IS
 +
 +   ​PROCEDURE TEST_PROC
 +    is
 +     ​v_filehandle utl_file.file_type;​
 +   -- type emp_record_type IS RECORD employees%rowtype;​
 +  cursor emp_cursor is
 +    SELECT * FROM employees
 +   ORDER BY employees.salary DESC;  ​
 +   
 +   emp emp_cursor%rowtype;​
 +   BEGIN
 +   
 +   ​v_filehandle := utl_file.fopen('​DATA_FILE_DIR',​ '​out.txt',​ '​w'​);​
 +   
 +   -- open emp_cursor;
 +   for emp in emp_cursor  ​
 +     loop
 +      dbms_output.put_line(emp.salary);​
 +      utl_file.putf(v_filehandle,​ emp.salary);​
 +      utl_file.new_line(v_filehandle);​
 +      ​
 +  end loop;
 +     ​utl_file.fclose(v_filehandle);​
 +/*   ​EXCEPTION
 +      WHEN exception_name THEN
 +          statements ;*/
 +   END;
 +
 +   -- Enter further code below as specified in the Package spec.
 +END;
 +</​code>​
kurs/write_to_file.txt ยท Last modified: 2014/09/10 21:22 (external edit)