SQLLDR

DBA Geral (instalação, configuração do banco, scripts do Sql*Plus, shell scripts, batch scripts, etc...)
Post Reply
zenfra
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 23
Joined: Fri, 20 Jul 2007 12:49 pm
Location: São Paulo - SP

Environment information:
* Oracle version: 9 I
* Operating system: Windows 2003

Good morning

Someone could tell me how I do to say what the delimiter character in the uses of the sqlldr to import data from a txt file to the table in my database?

I am doing as follows

C:> SQLLDR User / PWD Control = 'C: \ file.txt' log = 'C: \ Log_Arquivo. txt 'bad =' c: \ file.bad 'discard =' ??c: \ file.disc '

The delimiter character in my txt file is #

Did anyone know tell me?
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

So I gave a search here in the forum and found this link below:
http://en.glufke.net/oracle/viewtopic.p ... ght=sqlldr

In it there is another link, with documentation Oracle itself on SQL * Loader.

Any questions, just return.
Tineks
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 365
Joined: Tue, 24 May 2005 2:24 pm
Location: Araraquara - SP
Cristiano (Tineks)
Araraquara - SP

In the control file c: \ file.txt you can inform the delimiter .. follows there an example ..

Select all

 
. 
. 
Into Table cotacao 
Append 
Fields Terminated By '#' 
Trailing NullCols 
(  
  NRO_MOEDA  
, DAT_INI_VALIDADE      date "DD/MM/YYYY" 
) 
[]'s
zenfra
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 23
Joined: Fri, 20 Jul 2007 12:49 pm
Location: São Paulo - SP

I understood ..
Poxa worked

Now tell me one thing
I have a 40 where the records are separated by year / month
Can not I make load of a file at a time?
Do I have to create a files only with everything?

When I do a file and then I try to make another one, it says the table needs to be empty!
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Zenfra,

Take a look at this link below:

[B [url=http://www.orafaq.com/faqloadr.htm]SQL Loader / b].

He has a FAQ, containing the main topics on the tool.

there I saw that can be imported more than one table etc ...
Tineks
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 365
Joined: Tue, 24 May 2005 2:24 pm
Location: Araraquara - SP
Cristiano (Tineks)
Araraquara - SP

Zenfra,

The insert error is appearing because you must be using the INSERT command in your control file. If you are inserting a file at a time you can use the Append command.

[] 's !!
zenfra
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 23
Joined: Fri, 20 Jul 2007 12:49 pm
Location: São Paulo - SP

How it works with Append
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Example:

Select all

 
  LOAD DATA 
   INFILE 'mail_orders.txt' 
   BADFILE 'bad_orders.txt' 
   APPEND 
   INTO TABLE mailing_list 
   FIELDS TERMINATED BY "," 
   (  addr, 
      city, 
      state, 
      zipcode, 
      mailing_addr   "decode(:mailing_addr, null, :addr, :mailing_addr)", 
      mailing_city   "decode(:mailing_city, null, :city, :mailing_city)", 
      mailing_state 
   ) 
zenfra
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 23
Joined: Fri, 20 Jul 2007 12:49 pm
Location: São Paulo - SP

Show
User avatar
fbifabio
Moderador
Moderador
Posts: 199
Joined: Tue, 22 Feb 2011 1:51 pm
Location: São Paulo - SP
Contact:

Personally, below the link of an article that I published in my blog about SQL Loader, which maybe help to take some doubts:

http://www.fabioprado.net/2010/10/carga ... o-sql.html
]

Fábio Prado
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest