Re: Is there an ASCII export tool?

From: Peter Adams <padams_at_sulmail.stanford.edu>
Date: 1997/05/30
Message-ID: <338EF633.204E168F_at_sulmail.stanford.edu>#1/1


Using Dev2x (a local program unit) and the text_io package, here's a script I used to create a sql*loader ascii data file out of one of my local databases to be loaded up to a Unix Oracle server. I don't believe this will work as a stored procedure as the text_io package is not available on the server, and the server doesn't have access to the client filesystem anyway. But I needed to create a data file and this works fine.

Pete

PROCEDURE exp_notes IS

	file_out TEXT_IO.FILE_TYPE;
	q CONSTANT VARCHAR(1) := '"';
	t CONSTANT VARCHAR(3) := '","';
BEGIN
	file_out := TEXT_IO.FOPEN('C:\TEMP\OUTPUT_notes.txt','W');
	FOR x IN ( SELECT proj_id,task_seq,note_id,note_date,note_text
		FROM notes)
	LOOP
		TEXT_IO.PUT(file_out,q||x.proj_id||t||TO_CHAR(x.task_seq)||t||
		TO_CHAR(x.note_id)||t||TO_CHAR(x.note_date)||t||x.note_text||q);
		TEXT_IO.NEW_LINE(file_out);
    	END LOOP;
	TEXT_IO.FCLOSE(file_out);

END; Keith M Parks wrote:
>
> I'd like to be able to export the database in ascii format. I've
> looked
> at the documentation and only see import, export, and the loader tool.
> Import and export only work as binary files and loader only loads. I'd
> also like to be able to export the results of a query to a ASCII file.
>
> Thanks for any info,
> -KP
 
-- 
Peter Adams
Systems SW Developer
Stanford University Libraries
vc: 415-725-7909
fx: 415-725-4902
em: padams_at_sulmail.stanford.edu
http://www-sul.stanford.edu
Received on Fri May 30 1997 - 00:00:00 CEST

Original text of this message