how to trfr a file into db and and db file to os

In this forum you can share stuff related to Oracle 11g, 10g, 9i.
Post Reply
vangala.jpreddy
Posts: 21
Joined: Tue Oct 30, 2007 8:06 am
Location: India

how to trfr a file into db and and db file to os

Post by vangala.jpreddy »

Dear Gurus,

Please explain me How to Transfer OS file into database and how to transfer database table into os file. If you have any documentation please forward me.

Thanks in advance.
Jayaprakash.
amirtai
Posts: 138
Joined: Sat Apr 08, 2006 5:54 pm
Location: Canada
Contact:

Post by amirtai »

Hi there

SQL*Loader is a bulk loader utility used for moving data from external files into the Oracle database.

Oracle does not supply any data unload utilities. However, you can use SQL*Plus to select and format your data and then spool it to a file:

set echo off newpage 0 space 0 pagesize 0 feed off head off trimspool on
spool oradata.txt
select col1 || ',' || col2 || ',' || col3
from tab1
where col2 = 'XYZ';
spool off

Alternatively use the UTL_FILE PL/SQL package:

rem Remember to update initSID.ora, utl_file_dir='c:\oradata' parameter
declare
fp utl_file.file_type;
begin
fp := utl_file.fopen('c:\oradata','tab1.txt','w');
utl_file.putf(fp, '%s, %s\n', 'TextField', 55);
utl_file.fclose(fp);
end;
/

Hope that would be helpful.

Amir
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests