Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2003
    Posts
    7

    Unanswered: Using utl_file to import files into oracle

    how do i use the funktion "utl_file" when i wanna import a "tab sepreted" file into oracle..

    (i have enabled utl_file in init.ora file)

    tnx alot in adv

    Carben

  2. #2
    Join Date
    Jan 2003
    Posts
    7
    ps. i want to make a log aswell.. to se if it goes acording to plan

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Using utl_file to import files into oracle

    Originally posted by Carb3n
    how do i use the funktion "utl_file" when i wanna import a "tab sepreted" file into oracle..

    (i have enabled utl_file in init.ora file)

    tnx alot in adv

    Carben
    UTL_FILE doesn't do any of the work for you in separating fields out of tab-separated records. Have you considered using SQL Loader instead?

    Anyway, using UTL_FILE the logic is:

    - Open the file (using UTL_FILE.FOPEN)

    - LOOP

    - Get next record (UTL_FILE.GET_LINE)
    (When there are no more records, GET_LINE will raise NO_DATA_FOUND)

    - Process the record

    - END LOOP

    - Close the file (UTL_FILE.FCLOSE)

    Now, you would have to code your own logic for the "Process the record" part, using INSTR and SUBSTR:

    INSTR(text,CHR(9),n) returns the position of the nth TAB

    SUBSTR(text,pos,len) gets a portion of the record.

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Originally posted by Carb3n
    ps. i want to make a log aswell.. to se if it goes acording to plan
    Again, SQL Loader does that!

  5. #5
    Join Date
    Jan 2003
    Posts
    7
    ok ty!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •