Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Load multiple csv into ORACLE database using SQLLDR with NAMES of the loaded files

User_4UIMNFeb 17 2022

I need to load a banch of .csv files from a certain directory. Problem is I also need filenames as they contain information.
I'm managed to load files using similar command:

FOR %c in (C:\tmp\loader\*.csv) DO (
   c:\oracle\db\dbhome_1\BIN\sqlldr <user>@<sid>l/<password> control=C:\tmp\loader\loader.ctl data=%c
   )

C:\tmp\loader\loader.ctl is (again it's an example)

OPTIONS (ERRORS=0,SKIP=1)
LOAD DATA
  APPEND  
  INTO TABLE scott.td_region_position
  FIELDS TERMINATED BY '$$' TRAILING NULLCOLS
  ( POSITION_KEY,
    POSITION_NAME ,
    CHANNEL,
    LVL,
    IS_PARTNER,
    MARKET_CODE
  )

Can I add the name of files somehow to the loaded information?

Comments
Post Details
Added on Feb 17 2022
0 comments
573 views