PL/SQL (MOSC)

MOSC Banner

Append date time to csv file generated

edited Dec 3, 2018 12:38PM in PL/SQL (MOSC) 2 commentsAnswered ✓

Hi

  I have a procedure that generates a csv file every time is executed, i need help on how to append date time to prevent the file from being overitten every the procedure is executed. see the procedure below.

=================

CREATE OR REPLACE PROCEDURE EMP_CSV AS

  CURSOR emp_data IS

  SELECT employee_id, first_name, last_name, salary, job_id, department_id

   FROM employees;

v_file UTL_FILE.FILE_TYPE;

BEGIN

  v_file := UTL_FILE.FOPEN (location => 'DUMP_DIR',

                                              filename => 'emp_details.csv',

                                              open_mode => 'w',

                                              max_linesize => 32767);

  FOR cur_rec IN c_data LOOP

  UTL_FILE.PUT_LINE(v_file,

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center