how to upload (export) the text file to database? [message #340414] |
Tue, 12 August 2008 12:25 |
|
how to upload (export) the text file to database?
create table t_export_test (name varchar2(10),phone number);
my text file name is "c_dir.txt"
------------------------------------
text file contents
------------------------------------
Vetri;12345;
vel;302303;sudha;123456;
control file "c_dir_test.ctl"
-------------------------------------
LOAD DATA
INFILE c_dir.dat
INSERT
INTO TABLE t_export_test
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(name,
phone
)
sql>sqlldr control =D:\c_dir_test.ctl;
I am getting sql statement invalid
please help me how to export(upload) text file to database?
|
|
|
|
|
|
|
|
|
|
Re: how to upload (export) the text file to database? [message #340801 is a reply to message #340428] |
Thu, 14 August 2008 06:46 |
|
i tried it but still nothing uploaded on my table.and i didnt get any error while executing the sqlldr query?can u please give some example will try same thing?
can you please send me with example like below:
test table
test.ctl controlfile
test.txt datafile
SQL>sqlldr control=test.ctl;
Thanks,
Victory
|
|
|
|
Re: how to upload (export) the text file to database? [message #340855 is a reply to message #340801] |
Thu, 14 August 2008 11:47 |
|
Barbara Boehmer
Messages: 9102 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
victoryhendry wrote on Thu, 14 August 2008 04:46 |
can you please send me with example like below:
test table
test.ctl controlfile
test.txt datafile
SQL>sqlldr control=test.ctl;
|
-- test table:
SCOTT@orcl_11g> create table test (name varchar2(10),phone number)
2 /
Table created.
-- test.ctl controlfile:
LOAD DATA
INFILE test.txt
INSERT
INTO TABLE test
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(name,
phone
)
-- test.txt datafile:
Vetri;12345
vel;302303
sudha;123456
-- load data:
SCOTT@orcl_11g> HOST sqlldr scott/tiger control=test.ctl log=test.log
-- results:
SCOTT@orcl_11g> select * from test
2 /
NAME PHONE
---------- ----------
Vetri 12345
vel 302303
sudha 123456
SCOTT@orcl_11g>
-- test.log (check this if you have problems or need details about your load):
SQL*Loader: Release 11.1.0.6.0 - Production on Thu Aug 14 09:42:00 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Control File: test.ctl
Data File: test.txt
Bad File: test.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table TEST, loaded from every logical record.
Insert option in effect for this table: INSERT
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
NAME FIRST * ; CHARACTER
PHONE NEXT * ; CHARACTER
Table TEST:
3 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 33024 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 3
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Thu Aug 14 09:42:00 2008
Run ended on Thu Aug 14 09:42:01 2008
Elapsed time was: 00:00:00.94
CPU time was: 00:00:00.07
victoryhendry is currently offline victoryhendry's Profile
Date Registered: Sun, January 14, 2007
Message Count: 38 Messages(s) (0.07 average messages per day)
Show all messages by victoryhendry
Real Name: vetri
Status: Member
Last Message: Thu, 14 August 2008 04:46
Re: how to upload (export) the text file to database?
Last Visited: Thu, 14 August 2008 04:47
E-mail: [Click here to e-mail the user]
Private Message:
Buddy: add to buddy list
Homepage: http://Reading Books
Gender: Male
Location: Bangalore
Occupation: Engineer
Interests: Reading Books
Biography: Reading Books
Date Of Birth: April 29, 1982
AIM Handle: Reading Books
Yahoo Messenger: Reading Books
MSN Messenger: Reading Books
Jabber: Reading Books
Google Talk: Reading Books
Skype: Reading+Books
Read this:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28319/part_ldr.htm#i436326
It is a lot like a book. It even has chapters. You just click on them and read them on your screen instead of turning pages.
|
|
|