0

Based on what I'm reading, this should work, but it's failing with "missing SELECT keyword". Is it clear what I'm doing wrong? I'm trying to add records into an ORACLE table from a local CSV file with the same columns.

LOAD DATA
INFILE 'c:\Inst.csv'
APPEND INTO TABLE STG.RATE_ARCHIVE
FIELDS TERMINATED BY ","
(X_COOR,Y_COOR,Start_Dttm,End_Dttm,VAL);
user3108489
  • 363
  • 1
  • 4
  • 15

2 Answers2

1

Oracle doesn't have a LOAD DATA INFILE command. Instead, you'll need to use SQL*Loader to import the data.

See this answer for more info: Oracle: Import CSV file

Community
  • 1
  • 1
Mr. Llama
  • 20,202
  • 2
  • 62
  • 115
  • Following your link: http://www.orafaq.com/wiki/SQL%2aLoader_FAQ#How_does_one_use_the_SQL.2ALoader_utility.3F seems to show similar code. It mentions a "loader.ctl" file. Is this something I have to create with the "load data infile" code? – user3108489 Feb 02 '16 at 16:42
  • 1
    note that this code is all for the sqlldr utility that is installed with your client, but does not run through sqlplus. it is a separate utility. – Michael Broughton Feb 02 '16 at 16:45
  • I'm still not clear on syntax. Ok, do I have this right? In ORACLE, the code will resemble (using my info): sqlldr username@server/password control=c:\loader.ctl. The loader.ctl file will contain: LOAD DATA INFILE 'c:\Inst.csv' APPEND INTO TABLE STG.RATE_ARCHIVE FIELDS TERMINATED BY "," (X_COOR,Y_COOR,Start_Dttm,End_Dttm,VAL); Correct? – user3108489 Feb 02 '16 at 17:32
  • @user3108489 - That looks okay, but you'll run it from the command line or shell, not from within Oracle. – Mr. Llama Feb 02 '16 at 17:34
  • You're right. Actually running this within Toad Data Point. Still a bit new to this world so my terminology isn't up to par. Going to give this a try now... – user3108489 Feb 02 '16 at 17:37
  • Well, after several more attempts, I learned that my machine doesn't even have sqlldr.exe on it, so there is no way I can run these commands. @Michael Broughton hinted at this, but it didn't occur to me I might not have it. I apologize and appreciate everyone's input. How do I close an unanswerable thread? – user3108489 Feb 03 '16 at 15:19
  • Sqlldr comes with the Oracle client, which comes bundled with your DB so if you don't have the client installed your DBA has it and should be able to provide it to you. Or go download it from Oracle. – Michael Broughton Feb 03 '16 at 15:22
  • And I believe that TOAD Data Point has its own built-in import utility to load data from a file. I've never used it, but dig into it and see what it can do – Michael Broughton Feb 03 '16 at 15:27
-1

check that you spelled your infile correctly: 'c:\Inst.csv'

MaxU - stand with Ukraine
  • 205,989
  • 36
  • 386
  • 419