views:

109

answers:

2

Hi,

I just wonder if you know where to find a tutorial or samples of a Ruby script using sql *loader?

A: 

Sqlldr is a command line utility that uses a control file to guide it.

http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_concepts.htm#g1013706

An example using system and referencing the loader.ctl control file would be:

system("sqlldr username@server/password control=loader.ctl")
Dougman
thx, I tried that and it works but the problem here is that I only can load the first row of my data. The data file is something like this:text1|text2|text3text4|text5|text6and so on. But I can just load the first row. How can I tell sqlldr to continue after newline?Thx in advanced!
Niklas
@Niklas: What does your sqlldr control file look like?
Dougman
This is my .ctl file:LOAD DATAINFILE 'text.dat'TRUNCATEINTO TABLE dbas_teFIELDS TERMINATED BY "str '|\n'"( STRISDN INTEGER EXTERNAL, STRIMSI INTEGER EXTERNAL, ACCOUNT_TYPE INTEGER EXTERNAL, PROD_TYPE CHAR(7))By the way, I have some swedish charecters in my test.dat file like ä, ö... but those chars are not visible in DB either.Thx for you are patient with me. As I told before I'm a beginner in programming and grateful for all help I can get.
Niklas
Plzzz, somebody :-(Is it possible to change the charset in parfile? If yes, how can I change the charset to include swedish chars?
Niklas
Problem solved by adding CHARACTERSET UTF8 in .ctl file. It was so easy :-)Thx anyway!
Niklas
A: 

First you have to make sure your configuration (sqlloader commandline switches + controlfile + datafile) works outside Ruby. Then you can call it via system() as previous answer said.

Juraj