Home » RDBMS Server » Server Utilities » I want to invoke sql*loader in my C/C++ program, but don't use the command-line,how can i do?
icon9.gif  I want to invoke sql*loader in my C/C++ program, but don't use the command-line,how can i do? [message #134119] Tue, 23 August 2005 10:57 Go to next message
seafoam
Messages: 5
Registered: July 2005
Location: CHINA
Junior Member

hi, all
i want to invoke sql*loader in my program,
but i don't want to use command-line,how can I do?
is there some interface just like the API?
Re: I want to invoke sql*loader in my C/C++ program, but don't use the command-line,how can i do? [message #134131 is a reply to message #134119] Tue, 23 August 2005 11:14 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
No.
sql*loader has no other API involved.
THe sole functionality of sql*Loader is to bring the foreign/external data from a text file into an oracle table.
If you are looking the same functionality there are options.
1. use UTL_FILE.
you can read the textfile line by line and load into a table.
It has all API you need.
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#998101
2. Use an external table.
using this, you consider the external text file as an oracle table!.
so no API or whatsover is required ( restrictions apply).

Jared Still's article here talks about this
http://www.dbazine.com/oracle/or-articles/still1
Re: I want to invoke sql*loader in my C/C++ program, but don't use the command-line,how can i do? [message #134552 is a reply to message #134131] Thu, 25 August 2005 09:17 Go to previous messageGo to next message
seafoam
Messages: 5
Registered: July 2005
Location: CHINA
Junior Member

Hi Mahesh,

Thanks for your work, I will try it right now

It's very kind of you
Re: I want to invoke sql*loader in my C/C++ program, but don't use the command-line,how can i do? [message #135723 is a reply to message #134131] Fri, 02 September 2005 03:23 Go to previous messageGo to next message
seafoam
Messages: 5
Registered: July 2005
Location: CHINA
Junior Member

hi, i had worked it out

but it occured a error when I load data from a text with about 1,000,000 records

it prompted:
"..found record longer than bufer size surported,65536..."

is it load all the date once?

can I change the bufer size?

thanks
Re: I want to invoke sql*loader in my C/C++ program, but don't use the command-line,how can i do? [message #135745 is a reply to message #135723] Fri, 02 September 2005 06:57 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>> i had worked it out
Worked out what?
You have provided no information here.
which method you used?
Post relevant information ( sqlldr controlfile / sample data/ table ddl / full error message ( because the sequence in which it originates is important) / oracle version / os , if using UTL_FILE your code , if using temporary table , then table ddl, your code)????
Re: I want to invoke sql*loader in my C/C++ program, but don't use the command-line,how can i do? [message #135865 is a reply to message #135745] Sat, 03 September 2005 07:12 Go to previous messageGo to next message
seafoam
Messages: 5
Registered: July 2005
Location: CHINA
Junior Member

sorry, my poor english

I used the External Tables

firstly, I create the directory and the table

the table ddl like this:


=================================================
create or replace directory bdump
as 'E:\DBData\oradata\ORADIR\bdump';

drop table et_test;

create table et_test (f1 varchar2(100),
f2 varchar2(100),
f3 varchar2(100),
f4 varchar2(100),
f5 varchar2(100),
f6 varchar2(100),
f7 varchar2(100),
f8 varchar2(100),
f9 varchar2(100),
f10 varchar2(100),
f11 varchar2(100),
f12 varchar2(100)
)
organization external (
type oracle_loader
default directory bdump
access parameters (
records delimited by newline
nobadfile
nodiscardfile
nologfile
fields terminated by ','
optionally enclosed by '"'
)
location('et_test.txt')
)
reject limit unlimited
/

=================================================

then, the data file et_test.txt like this(1,000,000 records)

"0031","0031","136200","test"," "," "," "," "," ","0000091912"," "," "
"0031","0031","136200","test"," ","3613998"," "," "," ","0000091913"," ","3613998"
"0031","0031"," ","test"," ","6225056"," "," "," ","0000091914"," ","6225056"
"0031","0031"," ","test"," ","6226228"," "," "," ","0000091915"," ","6226228"
"0031","0031","136200","test"," "," "," "," "," ","0000091916"," "," "
"0031","0031","136200","test"," ","3234095"," "," "," ","0000091917"," ","3234095"
"0031","0031","136200","test"," ","3225659"," "," "," ","0000091918"," ","3225659"
"0031","0031"," ","test"," ","6226245"," "," "," ","0000091919"," ","6226245"
"0031","0031","136200","test"," ","3224216"," "," "," ","0000091920"," ","3224216"
"0031","0031","136200","test"," ","3611022"," "," "," ","0000091921"," ","3611022"
"0031","0031","136200","test"," "," "," "," "," ","0000091922"," "," "
"0031","0031","136200","test"," ","3227588"," "," "," ","0000091923"," ","3227588"
"0031","0031","136200","test"," "," "," "," "," ","0000091924"," "," "
"0031","0031","136200","test"," "," "," "," "," ","0000091925"," "," "
"0031","0031","136200","test"," ","3229918"," "," "," ","0000091926"," ","3229918"
"0031","0031","136200","test"," "," "," "," "," ","0000091927"," "," "
"0031","0031","136200","test"," ","3220383"," "," "," ","0000091928"," ","3220383"
"0031","0031","136200","test"," "," "," "," "," ","0000091929"," "," "
"0031","0031"," ","test"," ","6229767"," "," "," ","0000091930"," ","6229767"

......


then, I query the data with the sql statement:

select * from et_test;

a error occured with this infomation:

"found record longer than buffer size supported,65506,in
E:\DBData\oradata\ORADIR\bdump\et_test.txt"

what can I do with the buffer size

how can I get all the records for the data file?
Re: I want to invoke sql*loader in my C/C++ program, but don't use the command-line,how can i do? [message #135916 is a reply to message #135865] Sun, 04 September 2005 14:26 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9101
Registered: November 2002
Location: California, USA
Senior Member
The data that you provided loads fine when I test it in my environment. Is this the exact data that causes the error? Where does your data come from? It could be that the newline character is not what is expected, resulting in it trying to read the whole file as one record. Also, posting to these forums may even alter it, invalidating any testing using copied and pasted data. Instead of RECORDS DELIMITED BY NEWLINE, you might try experimenting with other delimiters like:

RECORDS DELIMITED BY 0x'0a'
Re: I want to invoke sql*loader in my C/C++ program, but don't use the command-line,how can i do? [message #138173 is a reply to message #135916] Tue, 20 September 2005 10:09 Go to previous message
seafoam
Messages: 5
Registered: July 2005
Location: CHINA
Junior Member

Hi Mahesh, you are right!

I am able to load the text file after using: RECORDS DELIMITED BY 0x'0a'

Thank you very much!
Previous Topic: importing dmp file
Next Topic: error in EXPORTING ..
Goto Forum:
  


Current Time: Thu Dec 26 05:47:05 CST 2024