Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    1

    Unanswered: Using Variables in SQL*Loader

    I am loading some files with the first twelve positions of each record containing the key value.

    When generating the file to be loaded into the database, the programmer starts with 1 for the key value and increments by one.

    My situtation is that I need to override what the programmer plugs into the key with a beginning value for the first record being loaded, (and incrementing by 1 for each subsequent record).

    I have done this with SQL Server and had a variable at the beginning of the script that I would put the beginning key and it would automatically increment by one for each subsequent record loaded. However, it's been awhile and I don't have an example and imagine if it can be achieved in SQL*Loader, it is probably different.

    Any guidance with this is appreciated.

    Neil

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Use RECNUM in SQL*Loader control fie like:
    Code:
    load data
    infile 'MyFile.dat'
    into table ...
    (...
    , colx RECNUM)
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

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