Home » Developer & Programmer » Forms » create multiple text files from one master text file
create multiple text files from one master text file [message #181295] Sat, 08 July 2006 05:25 Go to next message
shadab_111
Messages: 3
Registered: July 2006
Junior Member
Hi All,
I have one master text file...from that text file i need to create multiple text file based on the contents of the master text file ,,,for eg the contents of my master text file could be like this:

HDR 003 030506 FROM 002 TO 003
DTL 00000178 00000120000 00000005120215
TRL 00000001 00000000120000

HDR 009 030506 FROM 002 TO 009
DTL 00000939 00000500000 00200000012769
DTL 00044582 00000114000 00050000021004
TRL 00000002 00000000614000

HDR 012 030506 FROM 002 TO 012
DTL 00000939 00000502200 00200000012769
DTL 00044582 00000114000 00050000021004
TRL 00000002 0000000061422

so for each HDR and TRL i need to create a seperate text file...and should name it according to the code that comes after the HDR ie 003,009,012,
i know this could be possible through WEBUTIL.CLEINT_TEXT_IO ,,but as i've not done anything like this before ,,,i request someone to guide me through,,,,thanks in advance

Regards,
Shad
Re: create multiple text files from one master text file [message #181297 is a reply to message #181295] Sat, 08 July 2006 05:34 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Is this remotely related to Forms?

MHE
Re: create multiple text files from one master text file [message #181298 is a reply to message #181295] Sat, 08 July 2006 05:38 Go to previous messageGo to next message
RJ.Zijlstra
Messages: 104
Registered: December 2005
Location: Netherlands - IJmuiden
Senior Member
Hi Shad,

I fail to see the problem. If what you call 'text file' is a plain old ascii file, then you do not need oracle skills at all. Either you program an external exe to do the job, or if you want/have to do it in pl/sql you just read the file with utl_file and write to three other files also with utl_file. Again, no databse knowledge necessary, only a bit of plain old fashioned programming skill.

Have a nice weekend

Rob Zijlstra
Re: create multiple text files from one master text file [message #181301 is a reply to message #181298] Sat, 08 July 2006 05:54 Go to previous messageGo to next message
shadab_111
Messages: 3
Registered: July 2006
Junior Member
thanks for the reply,
But i want everything to be carried out through forms,,,so as you suggested i'll try using utl...but still can i store those child text files into the client system?

Thanks,
Regards,
Shadab
Re: create multiple text files from one master text file [message #181306 is a reply to message #181301] Sat, 08 July 2006 06:59 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
And this is the point where you indicate the forms version and whether you work client/server or web based.

MHE
Re: create multiple text files from one master text file [message #181309 is a reply to message #181306] Sat, 08 July 2006 07:13 Go to previous messageGo to next message
shadab_111
Messages: 3
Registered: July 2006
Junior Member
Hi MHE,
Sorry that i didn't mention it,we work on Forms 10g ,web based and i want those files to be generated in the client system and that is the reason i said whether webutil.cleint_text_io should be used,,,but my problem is that i haven't done anything similar to this before,,so i request you to guide me through the process on how to do it..
Thanks,
Regards,
Shad
Re: create multiple text files from one master text file [message #181343 is a reply to message #181309] Sat, 08 July 2006 17:49 Go to previous messageGo to next message
safwanmehmood
Messages: 14
Registered: August 2005
Junior Member
Hi Shad,

i think text_io is server side package .. and it can not used from client side. for network envirmnt UTL_FILE is used.

although i can give an example of text_io. just change query according to ur need. i think so this will he helpful.

Safwan

=======================================
For One Table Data Export To One File
=======================================
1)First Create Alert "EXPORTED"

2)Export Button Code

declare

fh_handle TEXT_IO.FILE_TYPE;

clkbut number;

begin --acquire the file handle

fh_handle := TEXT_IO.FOPEN('d:\data\data.txt', 'W');

for i in (select empno||','||ename||','||job||','||mgr||','||hiredate||','||sal||','||comm||','||deptno emp_data from emp)
loop TEXT_IO.PUT_LINE(fh_handle, i.emp_data);
end loop;

--close the file handle
TEXT_IO.FCLOSE(fh_handle);

clkbut:=show_alert('exported');
end;

======================================
For Two Table Data Export To One File
======================================
1)First Create Alert "EXPORTED"

2)Export Button Code
declare
fh_handle TEXT_IO.FILE_TYPE;
clkbut number;
begin --acquire the file handle
fh_handle := TEXT_IO.FOPEN('d:\data\data.txt', 'W');
for i in (select empno||','||ename||','||job||','||mgr||','||hiredate||','||sal||','||comm||','||deptno emp_data from emp)
loop TEXT_IO.PUT_LINE(fh_handle, i.emp_data);
end loop;

for i in (select deptno||','||dname||','||loc emp_data from dept)
loop TEXT_IO.PUT_LINE(fh_handle, i.emp_data);
end loop;
--close the file handle
TEXT_IO.FCLOSE(fh_handle);
clkbut:=show_alert('exported');
end;

================================================
For Two Table Data Export To Two Different Files
=================================================
declare
fh_handle1 TEXT_IO.FILE_TYPE;
fh_handle2 TEXT_IO.FILE_TYPE;
clkbut number;
begin --acquire the file handle
fh_handle1 := TEXT_IO.FOPEN('d:\data\data1.txt', 'W');
for i in (select empno||','||ename||','||job||','||mgr||','||hiredate||','||sal||','||comm||','||deptno emp_data from emp)
loop TEXT_IO.PUT_LINE(fh_handle1, i.emp_data);
end loop;

fh_handle2 := TEXT_IO.FOPEN('d:\data\data2.txt', 'W');
for i in (select deptno||','||dname||','||loc emp_data from dept)
loop TEXT_IO.PUT_LINE(fh_handle2, i.emp_data);
end loop;
--close the file handle
TEXT_IO.FCLOSE(fh_handle1);
TEXT_IO.FCLOSE(fh_handle2);

clkbut:=show_alert('exported');
end;
=======================================
Re: create multiple text files from one master text file [message #182362 is a reply to message #181343] Fri, 14 July 2006 08:12 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Yes there is a client_text_io facility in web_util. Get a copy of webutil from the Oracle website. Install it on your PC and run the demo. Then modify your form. Also search this forum for 'web_util' and 'webutil' to see what other people have done.

David
Previous Topic: getting an url
Next Topic: Regarding Webutil
Goto Forum:
  


Current Time: Fri Sep 20 10:35:22 CDT 2024