Home » SQL & PL/SQL » SQL & PL/SQL » Re: Reading Text File to Oracle Table by PL/SQL Code
Re: Reading Text File to Oracle Table by PL/SQL Code [message #36809] Sat, 22 December 2001 20:44
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, 'r');
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: Error in Trigger
Next Topic: *** .txt file to Table data transfer ***
Goto Forum:
  


Current Time: Fri Jun 05 15:21:26 CDT 2020