Skip to Main Content
  • Questions
  • how to generate .dsv files using SQL script?

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Nitin.

Asked: April 16, 2018 - 9:02 am UTC

Last updated: April 17, 2018 - 5:54 am UTC

Version: 11g

Viewed 1000+ times

You Asked



we have around 100 table out of 200, in which there is a column date.

what we want is,

first we want to chagen the NLS_date_format to DD-MON-YYYY HH12:MI:SS AM(using script)
then save the tables with date in a .DSV files.

also not sure if the script is executed successfully, how and where the .dsv files are saved.

how to change the .dsv file path to my own selected path?

Reply awaited!!

Many Thanks
Nitin

and Connor said...

first we want to chagen the NLS_date_format to DD-MON-YYYY HH12:MI:SS AM(using script)


SQL> select sysdate from dual;

SYSDATE
---------
17-APR-18

1 row selected.

SQL> alter session set nls_date_format = 'DD-MON-YYYY HH12:MI:SS';

Session altered.

SQL> select sysdate from dual;

SYSDATE
--------------------
17-APR-2018 01:51:42

1 row selected.


Files are saved exactly where you nominate them, eg

SQL> spool c:\temp\my_output.csv
SQL> spool c:\temp\other\my_output.csv

If you don't nominate a path, then typically it will be in the current directory or the "start in" directory for the shortcut on Windows,


Is this answer out of date? If it is, please let us know via a Comment