Home » Developer & Programmer » Forms » load a text-file without using a DB
|
|
|
Re: load a text-file without using a DB [message #82000 is a reply to message #81928] |
Tue, 08 April 2003 10:18 |
shadow
Messages: 15 Registered: April 2003
|
Junior Member |
|
|
PROCEDURE FILTER IS
in_file TEXT_IO.FILE_TYPE;
your_file VARCHAR2(50) := 'C:RAPORLAMATEMPBEKLEYEN.TXT';
text_line VARCHAR2(400);
MUSTERI VARCHAR2(100);
LOKASYON VARCHAR2(15);
i number :=0;
CUST_ID NUMBER;
BEGIN
--ERASE(:GLOBAL.COUNTER);
IF :BEKSIP.MUSTERI IS NOT NULL THEN
MUSTERI :=:BEKSIP.MUSTERI;
LOKASYON :=:BEKSIP.LOCATION;
ELSE
in_file := TEXT_IO.FOPEN(your_file, 'r');
TEXT_IO.GET_LINE(in_file, text_line);
MUSTERI :=RTRIM(SUBSTR(TEXT_LINE,169,60));
--
CUST_ID := CUSTOMER_ID(MUSTERI);
--CREATE_LOC_LOV (CUST_ID);
LOKASYON :=RTRIM(SUBSTR(TEXT_LINE,362,15));
TEXT_IO.FCLOSE(in_file);
END IF;
in_file := TEXT_IO.FOPEN(your_file, 'r');
GO_BLOCK('BEKSIP');
CLEAR_BLOCK();
MESSAGE(MUSTERI);
--MESSAGE(LOKASYON);
LOOP
TEXT_IO.GET_LINE(in_file, text_line);
IF MUSTERI = RTRIM(SUBSTR(TEXT_LINE,169,60)) THEN-- AND LOKASYON =RTRIM(SUBSTR(TEXT_LINE,362,15)) THEN
i:=i+1;
MESSAGE(I);
:BEKSIP.IL:=SUBSTR(TEXT_LINE,1,18);
:BEKSIP.BOLGE:=SUBSTR(TEXT_LINE,20,20);
:BEKSIP.SATIS_TEMSILCISI:=SUBSTR(TEXT_LINE,41,5);
:BEKSIP.URUN_KODU:=SUBSTR(TEXT_LINE,47,20);
:BEKSIP.URUN_ADI:=SUBSTR(TEXT_LINE,68,100);
:BEKSIP.MUSTERI:=SUBSTR(TEXT_LINE,169,60);
:BEKSIP.TARIH:=SUBSTR(TEXT_LINE,230,12);
:BEKSIP.SIP_MIKTARI:=SUBSTR(TEXT_LINE,243,12);
:BEKSIP.BEKLEYEN:=SUBSTR(TEXT_LINE,256,12);
:BEKSIP.BEK_TUT:=SUBSTR(TEXT_LINE,269,12);
:BEKSIP.DEPO:=SUBSTR(TEXT_LINE,282,5);
:BEKSIP.ANLASMA:=SUBSTR(TEXT_LINE,288,15);
:BEKSIP.SIP_NO:=SUBSTR(TEXT_LINE,304,12);
:BEKSIP.FATURALANAN:=SUBSTR(TEXT_LINE,317,12);
:BEKSIP.YUKLENEN:=SUBSTR(TEXT_LINE,330,12);
:BEKSIP.SIP_TUT:=TO_NUMBER(SUBSTR(TEXT_LINE,343,18));
:BEKSIP.LOCATION:=SUBSTR(TEXT_LINE,362,15);
NEXT_RECORD;
END IF;
END LOOP;
TEXT_IO.FCLOSE(in_file);
EXCEPTION
WHEN NO_DATA_FOUND THEN
TEXT_IO.FCLOSE(in_file);
FIRST_RECORD;
:global.counter:=i;
END;
|
|
|
Goto Forum:
Current Time: Fri Jan 31 11:22:55 CST 2025
|