| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> UTL_FILE(HELP)
Hi All,
Nice to be in this Forum.
I have questions to ask on UTL_FILE :roll:
Let me explain the concept.
1.When the net is down the user will take the records into one
floppy(CLIENT)
2.When the net is up he will update the database(SERVER) with all the
trasaction including the records which he taken into the floppy.
He creates one text file in the floppy. The records in that text file will be as follows.
( '12-Dec-2004','D
','1','111111111111','11',11111,11111,'',0,'Z','N','M','
','N',11111,0,' ','12-Dec-2004',' ',0,' ',' ',' ',' ',0,'
','12-Dec-2004','
( '12-Dec-2004','D
','2','222222222222','22',1254,1254,'',0,'Z','N','M',' ','N',1254,0,'
','12-Dec-2004',' ',0,' ',' ',' ',' ',0,'
Questions
It will be very useful if you send in any sample code of same issue. Iam here with pasting you the procedure which I have implemented.But it is not working due to the above mentioned Errors(Questions).
BEGIN
vSFile := utl_file.fopen('A:', file_name,'r');
LOOP
BEGIN
utl_file.get_line(vSFile, vNewLine);
DBMS_OUTPUT.PUT_LINE(vNewLine);
vTDate = substr(vNewLine,1,13)
vTNo := SUBSTR(vNewLine,21,1);
vMach := SUBSTR(vNewLine,77,3);
FOR I IN (SELECT TRNNO, CONS_NO,MACHINE FROM CDYYMMDD1
WHERE TRNDATE = vTDate AND
(TRNNo = vTNo AND MACHINE = vMach)) LOOP
IF I = 0 then
INSERT INTO CDYYMMDD1 VALUES(vNewLine);
END IF;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
RAISE_APPLICATION_ERROR (-20057, 'Internal Error');
WHEN utl_file.file_open THEN
RAISE_APPLICATION_ERROR (-20059, 'File Already Opened');
WHEN utl_file.invalid_maxlinesize THEN
RAISE_APPLICATION_ERROR(-20060,'Line Size Exceeds 32K');
WHEN utl_file.invalid_filename THEN
RAISE_APPLICATION_ERROR (-20061, 'Invalid File Name');
WHEN utl_file.access_denied THEN
RAISE_APPLICATION_ERROR (-20062, 'File Access Denied By');
WHEN others THEN
RAISE_APPLICATION_ERROR (-20099, 'Unknown UTL_FILE Error');
END read_demo;
/
![]() |
![]() |