Laerte Junior
Laerte Junior

Reputation: 382

sql loader requires dat file to load the data

I have a folder with several file s but they are not .dat. For my surprise i Could load one file but only when I renamed to .dat . What Am I doing wrong or I need to rename all my files to .dat ? My Files does not have extensions

Thanks guys

controlfile

load data 
infile 'D:\pageviews\year=2016\month=06\*' 
replace
into table test
fields terminated by whitespace
trailing nullcols
(
c1,
c2,
c3,
c4
)

Upvotes: 1

Views: 1658

Answers (1)

Littlefoot
Littlefoot

Reputation: 142710

As far as I can tell, INFILE clause you use is wrong.

You should name a file you're loading. Asterisk is used when data (you're about to load) is contained within the control file itself (after the BEGINDATA keyword).

If you don't specify a file extension, then it defaults to .dat (that's why you managed to load the file).

Possible cases (copied from the documentation):

  • Data contained in the control file itself: INFILE *
  • Data contained in a file named foo with a default extension of .dat: INFILE foo
  • Data contained in a file named datafile.dat with a full path specified: INFILE 'c:/topdir/subdir/datafile.dat'

Do read documentation; it'll be much more clear what you should (not) do.

Upvotes: 1

Related Questions