help how to ignore the header record in the input file

Hi gurus,

Kindly help here.

I'll have to generate the output to CSV file by getting data from the file 'INFILE.csv', a record header in it.

I would like to know to go to the header record during playback using utl_file.get_line package.please suggest.

examples of data 'INFILE.csv ':

NUMBER: the header
318000000000
318000000121
2005002999
3187209699

script:


DECLARE
fINFILE UTL_FILE. TYPE_DE_FICHIER;
fOUTFILE1 UTL_FILE. TYPE_DE_FICHIER;

vINFILE_PATH VARCHAR2 (200): = NULL;
vOUTFILE_PATH VARCHAR2 (200): = NULL;

vINFILE_NAME VARCHAR2 (100): = "INFILE.csv";
vOUTFILE_NAME1 VARCHAR2 (100): = "OUTFILE.csv";

vGLOBAL_NAME VARCHAR2 (100): = NULL;
vINPUT_REC VARCHAR2 (1000): = NULL;

nNEW_NUMBER NUMBER (16): = NULL;
nMERCH_ID NUMBER (8): = NULL;

BEGIN
vINFILE_PATH: = ' / home/RPT / ";
vOUTFILE_PATH: = ' / home/RPT / ";

BEGIN

fOUTFILE1: = UTL_FILE.fopen (vOUTFILE_PATH, vOUTFILE_NAME1, 'W');
EXCEPTION
WHILE OTHERS THEN
UTL_FILE. FCLOSE_ALL;
RETURN;
END;

BEGIN
fINFILE: = UTL_FILE. FOPEN (vINFILE_PATH, vINFILE_NAME, "R");
EXCEPTION
WHILE OTHERS THEN
UTL_FILE. FCLOSE_ALL;
RETURN;
END;

BEGIN
LOOP

nNEW_NUMBER: = NULL;

UTL_FILE. GET_LINE (fINFILE, vINPUT_REC);

BEGIN
SELECT MERCH_ID
IN nMERCH_ID
PROD. MERCH
WHERE NEW_NUMBER = LPAD (nNEW_NUMBER, 12, 0);

-Creation of the output file for
BEGIN
UTL_FILE. Put_line (fOUTFILE1,
LPAD (nMERCH_ID, 8, 0)
);

EXCEPTION
WHILE OTHERS THEN
dbms_output.put_line (' error when writing to the outfile1: ' |) SUBSTR (SQLERRM, 1, 250));
END;

EXCEPTION
WHILE OTHERS THEN
dbms_output.put_line (' error finding MID for merchant - ' | nNEW_NUMBER |) » '|| SUBSTR (SQLERRM, 1, 250));

END;
END LOOP;

EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line ('finished - End of file');
WHILE OTHERS THEN
dbms_output.put_line (' error reading I / p file ');
END;

IF UTL_FILE.IS_OPEN (fOUTFILE1) THEN
UTL_FILE. FCLOSE (fOUTFILE1);
END IF;

IF UTL_FILE.IS_OPEN (fINFILE) THEN
UTL_FILE. FCLOSE (fINFILE);
END IF;

END;
/

Hello

978485 wrote:

Thanks Frank.

where should I call the get_line., in my script, I started after the loop as above

Immediately after open from finifile is a good place:

...

fINFILE: = UTL_FILE. FOPEN (vINFILE_PATH, vINFILE_NAME, 'R');

-The first line always is a header, to be ignored

UTL_FILE. GET_LINE (fINFILE, vINPUT_REC);

...

Or you could do later as immediately before the LOOP.

Tags: Database

Similar Questions

  • How to exclude the missing files or library locations that are on a network backup and restore of Windows 7 Professional drive

    How to exclude the missing files or library locations that are on a network backup and restore of Windows 7 Professional drive. To give you more information, I have photos stored on a network drive to the following address: Wirelessspace\LaCie\MyPhotoGallery\Family. This folder is a location of library under the images. Because this folder is on a network drive backup backup not file Wizard.

    In addition, the following file locations is not found because they no longer exist. So why the backup wizard continues to look for and how to remove the backup set? I guess the error code following each line means simply that records cannot be found. Is this correct?

    Backup has encountered a problem during backup of the C:\Windows\System32\config\systemprofile\Searches\Google file. Error: (the system cannot find the specified file. (0 x 80070002))
    Backup has encountered a problem during backup of the C:\Windows\System32\config\systemprofile\SyncUP file. Error: (the system cannot find the specified file. (0 x 80070002))
    Backup has encountered a problem during backup of the C:\Windows\System32\config\systemprofile\Podcasts file. Error: (the system cannot find the specified file. (0 x 80070002))

    Hello

    I suggest you to follow the steps in the article below and check if it helps.

    Error code 0 x 80070002 when you back up files in Windows 7: http://support.microsoft.com/kb/979281

    Hope this information is useful.

  • How to access the textedit files in Icloud on time machine

    Hi all

    Bad, I need your help! I'm trying to access all my text edit files, which I had saved on ICloud.
    My laptop does not run successfully. I was proposed to restore and re - install the op system. So I run a Machine back up full time and I restored my laptop. I should all have backed up, right?
    Problem is: I'm trying to get all my work on Tex Edit, but I can't find it on Time Machine. Does anyone know how can I recover these files? I have two important years of drafting work there!
    It would be good to have your suggestion.

    Thanks in advance for your help

    Did you you save the files in the correct format - OS X Server: how to modify the configuration files - Apple support?

  • Re: How to save the video file to a DVD-R for Equium A200

    I have the Equium A200. Someone can tell me how to save the video file to a DVD-R on my computer in order to use it later, or use it in windows movie maker and must not simply copy on another DVD-R right?

    My cursor also has disappered in the suite of windows media, that makes life quite difficult.

    Any ideas?

    Thank you.

    You mean, you want to copy the original DVD movie to HARD drive?
    Well, you can copy the contents of the entire DVD to the HARD drive. It means that you have to copy a lot of data.
    I would recommend shrinking the DVD movies using a tool called DVD shrink.
    It would decrease the data and would also copy the content to the HARD drive.

    But if you want to use these files later in windows movie maker, so you must convert these using a 3rd party tool.
    Google a bit and you should find many free applications that would help you to do this work.

    Good bye

  • How to get the bak files?

    Original title: Bak files.

    How to retrieve the bak files. They were e-mail messages that went somehow in the trash. I got the files, but they have bak next to them. Nothing I do will open to them. Thank you

    Microsoft MSDN can help, try this link.

    http://social.msdn.Microsoft.com/search/en-us?query=opening%20BAK%20Files&emptyWatermark=true&AC=5

  • How to display the .dcm file

    How to display the .dcm file

    Hello

    This should help you.

    http://www.FileInfo.com/extension/DCM

    See you soon.

  • How to open the pdf files from hotmail.

    OMG no body can help with this question, how to open the pdf files from hotmail

    OMG no body can help with this question, how to open the pdf files from hotmail

    Told you that you need Adobe Reader, which is designed to open pdf files?

    Download Adobe Reader:

    http://www.Adobe.com/products/reader.html

  • How to shorten the music file to match the selected slides

    I created a slide show with windows vista movie maker.  How to shorten the music files to match both of the selected slides.  Using the fade out option did not work

    Hello

    You can try the following methods and check if it helps.

    Method 1:

    (a) open your filmmaking program and create the slide show using your photos. Choose the options you want for changes between the photos and the duration of each photo display. If you need help, then check out the help file in your theater program.

    (b) open the import file dialog box. In Windows Movie Maker, it is in the part of '"movie tasks', section"vidéo Capture." Browse your files to find the mp3 file you want to import, select and import it. Will import it into filmmaking program but it will not in the video.

    (c) search for the file in your filmmaking program and import it into the film. In Windows Movie Maker, you can drag and drop the file in the position in the window of time movie online, where you want that song to start playing.

    (d) scroll through the timeline until the end of the song. Drag the end of the song in a position to match the end of your slide show. This will be the end of the song at the same time exactly like your slide show.

    (e) read your film completely from the beginning to the end and ensure that everything is with the song the way you want that there. If you are satisfied with the finished product, then export the movie to the right format and the file will be ready to play.

    Method 2: Work with clips in Windows Movie Maker

    http://Windows.Microsoft.com/en-us/Windows-Vista/work-with-clips-in-Windows-Movie-Maker

    Reference:--

    http://Windows.Microsoft.com/en-us/Windows-Vista/getting-started-with-Windows-Movie-Maker#

    http://Windows.Microsoft.com/en-us/Windows-Vista/adjusting-audio-in-Windows-Movie-Maker-frequently-asked-questions

  • How to display the hidden files and folders even if I've already enabled "Show hidden files, folders and drives" to "Advanced settings"?

    How to display the hidden files and folders even if I've already enabled "Show hidden files, folders and drives" to "Advanced settings"?

    After I enabled "Show hidden files, folders and drives" in 'Advanced settings', I can't yet see in the folder but I know there is a file in this program of WinRAR folder form as pictured below where I opened the case both at the same time.

    Hope you can help in this case...

    It would be possible that the file is marked as a system folder (which is just a check box in properties such as the hidden check box). So in your folder options, uncheck the "Hide protected operating system files" and see if it will be visible.

    Or another thing to try: remonter back a level, hold down SHIFT while you right-click the complete file and choose "Open command window here", then type DIR to see if the file is listed.

  • How to find the library files that are not due to problems of indexing

    I need help to know how to find the library files that are not as a result of indexing problems?

    I use Windows 7

    Thank you

    Charlene

    Try to open the folder that the library uses directly.  For example, if it is your Documents folder, open C:\Users\Charlene\Documents

  • How to display the pdf file in the apex region

    How to view pdf file in an apex html region. pdf files are stored in the column of type blob of a table. Please note this is not a static file. I am able to create a link to download and view the pdf in a new window. But it's not my priority. I need to see the full pdf file in the html area.

    I looked around the forums but couldn't find a good answer. All suggestions will be useful. Thank you

    Hi Alexandre-Oracle,

    Alexander-Oracle wrote:

    How to display the pdf file in an html apex region. PDF files are stored in the column of type blob of a table. Please note this is not a static file. I am able to create a link to download and view the pdf in a new window. But it's not my priority. I need to see the full pdf file in the html area.

    I looked around the forums but couldn't find a good answer. All suggestions will be useful. Thank you

    See the following thread I explained how to display PDF in the region HTML using the embed tag:

    Re: Display pdf

    I hope this helps!

    Kind regards

    Kiran

  • How to find a specific record in what data file?

    Hi all

    The basic version: 11 GR 2

    I am inserting a table a record called "xx". and the table is in a tablespace that has lets say 10 files of data. How to find the data file which stores this record "xx".

    Thank you
    Arun

    Arun wrote:
    Yes... I get file_id for three data files... How to find the exact?

    If the tablespace contains multiple data files and data in the table can be in the data files.

    And to find the ID of the particular LINE belongs to the data file, you must play with package
    SQL > select dbms_rowid.rowid_to_absolute_fno (rowid, 'SCHEMANAME', 'TABLENAME') of tablename;

  • How to import the .sql file in oracle apex?

    I am new to oracle apex...

    How to import the .sql file in oracle apex?

    I have to import a table in apex...

    This script I have to write in the .sql file...

    pls help...

    Published by: 794244 on January 31, 2011 21:31

    Hi Manu

    You can import and browse workshop SQL, SQL Scripts .sql files. If you have multiple SQL statements in your script, make sure that they are separated by the / character

    Andy

  • How to export the XFDF file from PDF file?

    I need to export as long as XFDF file from the PDF file and then record the xfdf file at the same location through javascript. I used this.exportAsXFDF (); for export. But I do not know how to save the xfdf file in a script. Kindly advice me. It comes to Acrobat professional 8.0 and windows platform.

    mariaprabu wrote:

    I need to export as long as XFDF file from the PDF file and then record the xfdf file at the same location through javascript. I used this.exportAsXFDF (); for export. But I do not know how to save the xfdf file in a script. Kindly advice me. It comes to Acrobat professional 8.0 and windows platform.

    In the documentation, you will notice the for exportAsXFDF cPath parameter to specify a path and name of the file to save to.

  • How to move the MSWMM files and keep the data on my computer?

    I downloaded digital film from my camera to a destination on my D drive as a file MSWMM (collections), and whenever I try to move the downloaded film (collection), it does not recognize the movie more.

    How to move the MSWMM files and keep the data on my computer?

    The mswmm file is the project file, not a video.
    Think of it as a recipe for a cake, it only tells you what to do with the ingredients, but does not include the ingredients.
    The mswmm file tells the computer to look in a certain folder to use a video or audio file.
    If you move the file, then MM knows not where is the file, then you must tell it, by right clicking on a red x on the timeline and then choose search for the file.

Maybe you are looking for

  • Best software security for ElCapitan (OS 10.11.3)

    I am currently using a free version of the AVG software.  I tried to find something that is a good choice for my MacBook Pro running ElCapitan.  So much are really made for PC (according to ME) and I don't know, I get the best bang for my buck.  Can

  • Satellite A210 - touch FN causes BSOD (Vista Premium)

    Greetings, I just got my Satellite yesterday and unfortunately already fallen on a serious problem. Just to note: I've been googling and used the search on the forum, but I have not found a similar opportunity... However, the problem is easy to expla

  • How to play 'beep' of the PC speaker

    I used the Beep function in CVI, but the sound card generates the soud BEEP. I want speaker PC generates the sound SIGNAL. Please help me. Thank you.

  • Windows8 tile problem - when I click on a tile, it opens, then closes instantly...

    Windows8 tile problem. When I click on a tile, it opens, then closes instantly. I have studied the site of Microsoft to solve this problem, but all attempts have failed. I tried to click with the right button on tile and used the feature, turn off, t

  • virtual - profile aaa - order support

    Hello Can someone tell me what version of IOS is supported the virtual aaa command - profile. We had problems try with 12.3 (7) T3, 12.3 (9), 12.3 (10) Although release notes it is supported. However, when trying to enter on our 3745 is not there as