Home » Developer & Programmer » Forms » text io packages
text io packages [message #77689] Sun, 04 November 2001 19:40 Go to next message
satish
Messages: 112
Registered: September 2000
Senior Member
Hi,
how do i put if conditions using text_io packages.like if i have a text file and i want to take only certain info and not the whole, on to another text file, how do i do it ?

thanks
satish
---------------------
DECLARE

tfile1 text_io.file_type;
tfile2 text_io.file_type;

str varchar2(100);

BEGIN

tfile1 := text_io.fopen('file1.txt','r');
tfile2 := text_io.fopen('file2.txt','w');

text_io.get_line(tfile1,str);
text_io.put_line(tfile2,str);

text_io.fclose(tfile1);
text_io.fclose(tfile2);

END;
------------------

But i want to write a code to delete some data from the text file1. How ???

----------------------------------------------------------------------
Re: text io packages [message #77798 is a reply to message #77689] Wed, 21 November 2001 19:00 Go to previous messageGo to next message
waris
Messages: 115
Registered: November 2001
Senior Member
Hi satish...

text_io.get_line(tfile1,str);

deleted_text:=substr(str,1,n);

hope this gets u going

cheers
waris

----------------------------------------------------------------------
Re: text io packages [message #77949 is a reply to message #77689] Sat, 22 December 2001 20:26 Go to previous message
shahid azizi
Messages: 3
Registered: December 2001
Junior Member
DECLARE
OPEN_FILE Text_IO.File_Type;
LINE_VALUE VARCHAR2(80);
FILENAME VARCHAR2(10) :='C:XYZ.txt';

BEGIN
OPEN_FILE := Text_IO.Fopen(FILENAME, 'a');
LOOP
Text_IO.Get_Line(OPEN_FILE, LINE_VALUE);
Text_IO.Put(LINE_VALUE);

IF SUBSTR(LINE_VALUE,1,3) = 'CTR' THEN
INSERT INTO CONT VALUES(SUBSTR (LINE_VALUE,4,14));
END IF;
Text_IO.New_Line;
END LOOP;
COMMIT;

EXCEPTION
WHEN no_data_found THEN
SET_ALERT_PROPERTY
('MESS',ALERT_MESSAGE_TEXT,'FILE IS GOING TO CLOSE');
MESS;
Text_IO.Fclose(OPEN_FILE);

END;

----------------------------------------------------------------------
Previous Topic: forms4.5...keyout
Next Topic: Problem using Object Libraries in Forms 6i
Goto Forum:
  


Current Time: Thu Mar 28 08:53:44 CDT 2024