Sql loader syntax issue
SQL*Loader: Release 11.1.0.7.0 - Production on Thu Mar 18 07:21:37 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL*Loader-350: Syntax error at line 1.
Expecting keyword LOAD, found "ÐÏ".
ÐÏࡱá
^
My sqlldr file looks like this:
sqlldr control=C:\data\ctl\ss.ctl log=C:\data\logs\ss.log userid=User/Password errors=999 discard=C:\data\discard\ss.dis
control file looks like this:
LOAD DATA
INFILE 'C:\data\SS.TXT' "STR '\r\n'"
REPLACE
INTO TABLE SS
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
ACCOUNT_NBR CHAR,
ADDR1 CHAR,
ADDR2 CHAR,
ADDR3 CHAR,
ADDR4 CHAR,
CITY CHAR,
STATE CHAR,
ZIPCODE CHAR ,
more columns all of the are the same syntax column name and char
I can load this table using the enterprise manager but when using the sqlldr its not working.
Anything stand out?
Edited by: mlojan on Mar 18, 2010 5:33 AM
Only thing I can think of is there is some character set issue between the control file and the operating syste/oracle server.
You did you create the control file using a text based editor such as notepad or wordpad didn't you? You haven't used something like MS Word?
Similar Messages
-
How do i get sql loader to recognize recognize AM/PM. My control file is below. The error I get is syntax error at line 14. Expecting field-name, found ")".
OPTIONS ( SKIP=0)
LOAD DATA
INFILE '/ftp_data/labor_scheduling/kronos_punch_temp/kronos_punches.csv'
BADFILE '/ftp_data/labor_scheduling/kronos_punches/kronos_punches.bad'
DISCARDFILE '/ftp_data/labor_scheduling/kronos_punches/kronos_punches.dsc'
INTO TABLE "STAFFING"."KRONOS_TEMP_PUNCHES"
TRUNCATE
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
(EMPLOYEE_ID,
SCHEDULE_DATE DATE "MM/DD/YY",
PUNCH DATE "MM/DD/YY HH:MI AM"
)Hi Gary,
Could your problem be with this?
(EMPLOYEE_ID,You have no data type for that field.
Regards
Peter -
Hello
Using Oracle 11g, I am trying to load a table from data in csv files with oracle SQL Loader,
table : purchase
control file : purchase.ctl
Even if I am giving the right path for control file I still get the error :
SQL*Loader-500: Unable to open file (purchase.dat)
SQL*Loader-553: file not found
SQL*Loader-509: System error: The system cannot find the file specifiedSo why is SQL Loader looking for the file purchase.dat??
Any help is appreciatedTalend is the right solution to load data. Now about your problem, have you configured Talend in order to transfer the data? Because Talend can easily transfer the files.
Maybe you might be able to go to the Talend website to get more information there: http://www.talend.com/ -
SQL*Loader permission issue?
I have set up a run_all script on LINUX to invoke SQL*Loader for each table to be loaded. I can run this as the Oracle owner just fine. When I try to let the developer run this on dev, they get the following:
SQL*Loader: Release 9.2.0.1.0 - Production on Tue Apr 25 08:55:18 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL*Loader-128: unable to begin a session
ORA-01034: ORACLE not available
ORA-27121: unable to determine size of shared memory segment
Linux Error: 13: Permission denied
They can use SQL*Plus on the command line with the userid and password from the SQL*Loader file. I don't want to have to run these for them every time, so any help or ideas would be greatly appreciated!Hi
Has the same ORACLE_HOME variable value of the Oracle owner and the developer?
Ott Karesz
http://www.trendo-kft.hu -
Hi,
When I load a flat file with SQL*Loader (V 8.1.7 on Windows), I get output something like,
Commit point reached - logical record count 2352
Commit point reached - logical record count 2364
Commit point reached - logical record count 2376
Commit point reached - logical record count 2388
Commit point reached - logical record count 2400
If I want to change this, say I want this message for each 1000 records inserted, how can I do that?
I have tried options line bindsize or rows, but looks like they are for changing internal operation, but not this screen output.
Off course, I am talking about conventional path load.
Any ideas?
Thanksset rows=1000 and increase the bindsize drastically.
From the docs here
If that size fits within the bind array maximum, the load continues--SQL*Loader does not try to expand the number of rows to reach the maximum bind array size. If the number of rows and the maximum bind array size are both specified, SQL*Loader always uses the smaller value for the bind array. -
SQL*LOADER connection issue
I have oracle 9i installed, if i'm to connect to the database using the sys account i getv a message saying have to connect as sysdba or sysoper. Ok so i use "username/password@database as sysdba", and that works fine i'm able to connect. But this does not work at the inital login screen, i have to connect as using this other account i created then log in useing the string above. My problem is now im using SQL*LOADER to load data into a table and it won't accept the connection string. If it use that connction string listed above i get the error "ORA-12154:could not resolve service name" and if i remove "as sysdba" from the end of the string i get error "ORA-01017: invalid username/password". I use to be able to just log on with just "sys" username is there any way to change it back or any other way to log on to SQL*LOADER. Any help would be appreciated. Thanks
When you are working with SQL*Loader, SQL*Plus and other utilities you can specify what is the database to be connected through local naming (client, server ) or seeting an enviroment variable in the session. If you are getting connection in the server and you have problems resolving local naming, I recommend you to do this:
1.- Set the ORACLE_SID enviroment variable and do not use local naming resolving with tnsnames.ora entries
2.- Configure very well the tnsnames.ora & sqlnet.ora files to get connection.
If you are working directly in the server the first option is easier.
Setting the variable in Windows:
SET ORACLE_SID=<database_sid>
Setting the variable in Unix/Linux:
export ORACLE_SID=<database_sid>
if you need more help to do this step by step I can help you.
Joel Pérez -
Hi guru's .!!!!!!!!!!
can anybody tell me abt advantage of sq loader in 11g over sql loader in 10g ..!!!!!!
please help me in this regard..!!!!!!user13490153 wrote:
Hi guru's .!!!!!!!!!!
can anybody tell me abt advantage of sq loader in 11g over sql loader in 10g ..!!!!!!
please help me in this regard..!!!!!!not sure there is really any difference b/w 11g and 10g versions!!!!!!!!
Better would be to use external tables.
http://www.morganslibrary.org/reference/externaltab.html
... and keep all your processing within the database rather than from the command line. -
Sql loader - to_date() issue
How do I load the date field from the CSV *"03-Dec-09 10.06.58.00 PM"* into oracle tables using sql loader ?
The contol file is as follows:
LOAD DATA
INTO TABLE
CUSTOMER
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(CUST_ID,
ORDER_DATE "to_date(:ORDER_DATE, 'DD-MON-YY HH:MI:SS.TT AM')"
but it doesn't work, I also tried _ORDER_DATE "DD/MM/YYYY"_ with no luck, any suggestion ?
I am kind of new in using SQL LOADER.
thanks.The CSV sample you provided uses " *.* " in the time-component [ 10.06.58.00 ] while your SQL Loader Control file is expecting " *:* " [ HH:MI:SS.TT ]. These two formats are obviously not the same. Update your control file and try again.
CUST_ID, ORDER_DATE
1,03-Dec-10 10.06.58.00 PM
2,03-Dec-09 10.07.18.00 PM
3,03-Dec-11 04.07.18.00 AM
4,01-Dec-07 10.07.18.00 PM
5,03-Dec-10 10.07.18.00 AM
6,12-Dec-10 10.07.18.00 PM
CONTROL FILE Which "doesn't work "
LOAD DATA
INTO TABLE
CUSTOMER
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(CUST_ID,
ORDER_DATE "to_date(:ORDER_DATE, 'DD-MON-YY HH:MI:SS.TT AM')"
{code}
Edited by: user130038 on Sep 9, 2011 6:56 AM -
SQL loader import issue..
Hi,
I am working on 10g database on ibm AIX ..
i need to use sql loader and insert some data in to table using a input file.
The input file contains follwing format..- data.dat
001 901 200 1611196 "dis
ltype
gu" Mhamicddu kuasa 12as king
all these values are tab deliminated and one column value "disltypegu" is enclosed by " " and in next line. This "disltypegu" shuld be inserted in to one column.
I am using following control file..
LOAD DATA
INFILE '/home/oracle/data.dat'
INSERT INTO TABLE emp
(e1,e2,e3,e4,e5,e6,e7,e8,e9)
any idea ...wht all things i need to include in my control file to perform this insert...
I am using below control file ..
LOAD DATA
INFILE '/home/oracle/data1.csv'
APPEND
INTO TABLE emp
FIELDS TERMINATED BY X'09'
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(ename,edd,emob)
By using this control file , we can import tab delemenated and enclosed by "" column ...it is working ..
Only thing is if some column data is in next row , it is treating it as a second row and inserting in to new row..
How to insert data in to one row..
This is my data file ... with 3 column values .. ( ename -Robin , edd - Address , emob - 13)
Robin "Address"
13
but it is inserting emob value (13) in ename ...like next line as a new row...oradba11 wrote:
Hi,
I am working on 10g database on ibm AIX ..
i need to use sql loader and insert some data in to table using a input file.
The input file contains follwing format..- data.dat
001 901 200 1611196 "dis
ltype
gu" Mhamicddu kuasa 12as king
all these values are tab deliminated and one column value "disltypegu" is enclosed by " " and in next line. This "disltypegu" shuld be inserted in to one column.
I am using following control file..
LOAD DATA
INFILE '/home/oracle/data.dat'
INSERT INTO TABLE emp
(e1,e2,e3,e4,e5,e6,e7,e8,e9)
any idea ...wht all things i need to include in my control file to perform this insert...
I am using below control file ..
LOAD DATA
INFILE '/home/oracle/data1.csv'
APPEND
INTO TABLE emp
FIELDS TERMINATED BY X'09'
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(ename,edd,emob)
By using this control file , we can import tab delemenated and enclosed by "" column ...it is working ..
Only thing is if some column data is in next row , it is treating it as a second row and inserting in to new row..
How to insert data in to one row..
This is my data file ... with 3 column values .. ( ename -Robin , edd - Address , emob - 13)
Robin "Address"
13
but it is inserting emob value (13) in ename ...like next line as a new row...How is this data file created and what processes (automated AND manual) does it pass through before coming to sqlloader? It looks to me like it is getting manually copied and pasted from notepad with line wrap turned on. You really need to address why the data is being wrapped across multiple lines (records).
Edited by: EdStevens on Mar 13, 2012 7:48 AM -
Hello,
I'm having an issue with the formatting of a date. My csv file, exported from another ora table, has the date in full date format ()
I get the error:
Record 12: Rejected - Error on table LOAN_VER_REQ_ARCH, column ORIGINATION_DATE.
ORA-01843: not a valid monthand two other fields that are date fields get similar errors.
Dates in .csv file appear as such:
For example - 10/26/2001 0:00:00
The question is in my ctl file, how do I format?
I've tried to_char(ORIGINATION_DATE,'MM-DD-YYYY') or
to_date(ORIGINATION_DATE,'MM-DD-YYYY') These dont' work. I don't recall doing any of this stuff in Ora 9i, but perhaps I wasn't loading date fields before in any tables I uploaded data into.
Any tips would be appreciated. I get a message on the command prompt about:
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 39
Commit point reached - logical record count 78but that's incorrect because no records are going into the table. I'll worry about that part later though if I can get this date thing resolved.
Thanks!user515689 wrote:
Hello,
I'm having an issue with the formatting of a date. My csv file, exported from another ora table, has the date in full date format ()
I get the error:
Record 12: Rejected - Error on table LOAN_VER_REQ_ARCH, column ORIGINATION_DATE.
ORA-01843: not a valid monthand two other fields that are date fields get similar errors.
Dates in .csv file appear as such:
For example - 10/26/2001 0:00:00
The question is in my ctl file, how do I format?
I've tried to_char(ORIGINATION_DATE,'MM-DD-YYYY') or
to_date(ORIGINATION_DATE,'MM-DD-YYYY') These dont' work. I don't recall doing any of this stuff in Ora 9i, but perhaps I wasn't loading date fields before in any tables I uploaded data into.
Any tips would be appreciated. I get a message on the command prompt about:
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 39
Commit point reached - logical record count 78but that's incorrect because no records are going into the table. I'll worry about that part later though if I can get this date thing resolved.
Thanks!Well, the sample string you've provided doesn't match the formats you've been attempting to use. Yours are separated with a hyphen whereas your sample data is separated by a slash.
Is ALL the data in the same format?
If so, perhaps this (based on your sample string)....
TUBBY_TUBBZ?select to_date('10/26/2001 0:00:00', 'mm/dd/yyyy HH24:MI:SS') from dual;
TO_DATE('10/26/20010
26-OCT-2001 12 00:00
1 row selected.
Elapsed: 00:00:00.01As for specifying this in the control file
http://download.oracle.com/docs/cd/B10501_01/server.920/a96652/ch09.htm#1011137
(you mentioned Oracle 9, so i'm not sure if that's the version you are still on or not).
Edited by: Tubby on Jul 27, 2010 11:50 AM
Added link to documentation. -
Sql* Loader syntax to load data into a partitioned table
Hi All,
I was trying to load data from a csv file to a partitioned table.
The table name is countries_info
columns :
country_code ,
country_name,
country_language
The column country_code is list partitioned with partition p1 for values 'EN','DE','IN' etc
and partition p2 for 'KR','AR','IT' etc.
I tried to load data into this table, but I was getting some error Message (not mapping to partitioned key).
I tried syntax
load data
infile 'countries.csv'
append
into table countries_info
partition(p1) ,
partition(p2)
fields terminated by ','
country_code ,
country_name,
country_language
What is the correct syntax- I searched a lot but have not been able to find out.Peeush_Rediff wrote:
Hi All,
I tried to load data into this table, but I was getting some error Message (not mapping to partitioned key).It's not some error message, it's relevant information for resolving problems you encounter while using Oracle.
In your case, although you didn't specifiy the exact ORA you recived, it sounds like [ORA-14400|http://forums.oracle.com/forums/search.jspa?threadID=&q=ORA-14400&objID=f61&dateRange=all&userID=&numResults=15&rankBy=10001]
What is the correct syntax- I searched a lot but have not been able to find out.It's not about correct syntax , it's about understanding message that was trying to tell you that something went wrong.
That message was (i guess) ORA-14400.
So, refering to that ORA message , you will need to add new partition ,
where the data from your csv file that currently don't map to any of the specified partition would fit ,
or add partition that would be able to accept data range in which value/s for which you received that ORA message could fit into. -
Hello,
I have got some problemes with sql loader syntax.
I'm trying to import some data into my table. And I want that the sysdate is import in my table automatically.
This is my char.ctl file :
LOAD DATA
INFILE *
INTO TABLE CHANGE_REQUEST
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(CHAR_ID,DATE_CREATION SYSDATE,STATUS,ABSTRACT,USER_ID_FK,SYSTEM_ID_FK,PRIORITY)
BEGINDATA
1,PENDING,Need to have the firsname when listing users,1,Medium
But I still get the error : ORA-00947: not enough values
I have try different line like :
1, ,PENDING,Need to have the firsname when listing users,1,Medium
or
1,SYSDATE,PENDING,Need to have the firsname when listing users,1,Medium
But nothing is working.
Where is the mistake?
Regards.Another way, wich does not require an alter table is something like this:
LOAD DATA
INFILE *
INTO TABLE CHANGE_REQUEST
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(CHAR_ID,
stATUS,
ABSTRACT,
uSER_ID_FK,SYSTEM_ID_FK,PRIORITY,
DATE_CREATION "sysdate"
BEGINDATA
1,PENDING,Print issue,1,1,High
I putted DATE_CREATION in last position only for example.
Hope this can help someone.
Bye bye.
Antonio -
SQL*LOADER(8I) VARIABLE SIZE FIELD를 여러 TABLE에 LOAD하기 (FILLER)
제품 : ORACLE SERVER
작성날짜 : 2004-10-29
==================================================================
SQL*LOADER(8I) VARIABLE SIZE FIELD를 여러 TABLE에 LOAD하기 (FILLER)
==================================================================
PURPOSE
SQL*LOADER 에서 variable length record와 variable size field를 가진 data
file 을 여러 table에 load하는 방법을 소개하고자 한다.
( 8i new feature인 FILLER 절 사용)
Explanation
SQL*LOADER SYNTAX
여러 table에 load하고자 할때에는 control file에 아래와 같이 하면 된다.
INTO TABLE emp
INTO TABLE emp1
fixed length field을 가진 data file을 여러 table에 같은 data을 load하고자
한다면 아래와 같다.
INTO TABLE emp
(empno POSITION(1:4) INTEGER EXTERNAL,
INTO TABLE emp1
(empno POSITION(1:4) INTEGER EXTERNAL,
위와 같이 양쪽 table의 empno field에 각각의 load할 data로부터 1-4까지를
load 할수 있다. 그러나 field의 길이가 가변적이라면 위와 같이 POSITION 절을
각 field에 사용할 수 없다.
Example
예제 1>
create table one (
field_1 varchar2(20),
field_2 varchar2(20),
empno varchar(10) );
create table two (
field_3 varchar2(20),
empno varchar(10) );
load할 record가 comma로 나누어지며 길이가 가변적이라고 가정하자.
<< data.txt >> - load할 data file
"this is field 1","this is field 2",12345678,"this is field 4"
<< test.ctl >> - control file
load data infile 'data.txt'
discardfile 'discard.txt'
into table one
replace
fields terminated by ","
optionally enclosed by '"' (
field_1,
field_2,
empno )
into table two
replace
fields terminated by ","
optionally enclosed by '"' (
field_3,
dummy1 filler position(1),
dummy2 filler,
empno )
dummy1 field는 filler로 선언되었다. filler로 선언하면 table에 load하지 않는다.
two라는 table에는 dummy1이라는 field는 없으며 position(1)은 current record의
처음부터 시작해서 첫번째 field을 dummy1 filler item에 load한다는 것을 말한다.
그리고 두번째 field을 dummy2 filler item에 load한다. 세번째 field인, one이라는
table에 load되었던 employee number는 two라는 table에도 load되는 것이다,
<< 실행 >>
$sqlldr scott/tiger control=test.ctl data=data.txt log=test.log bindsize=300000
$sqlplus scott/tiger
SQL> select * from one;
FIELD_1 FIELD_2 EMPNO
this is field 1 this is field 2 12345678
SQL> select * from two;
FIELD_3 EMPNO
this is field 4 12345678
예제 2>
create table testA (c1 number, c2 varchar2(10), c3 varchar2(10));
<< data1.txt >> - load할 data file
7782,SALES,CLARK
7839,MKTG,MILLER
7934,DEV,JONES
<< test1.ctl >>
LOAD DATA
INFILE 'data1.txt'
INTO TABLE testA
REPLACE
FIELDS TERMINATED BY ","
c1 INTEGER EXTERNAL,
c2 FILLER CHAR,
c3 CHAR
<< 실행 >>
$ sqlldr scott/tiger control=test1.ctl data=data1.txt log=test1.log
$ sqlplus scott/tiger
SQL> select * from testA;
C1 C2 C3
7782 CLARK
7839 MILLER
7934 JONES
Reference Documents
<Note:74719.1> -
SQL Load from Oracle into 64 bit Essbase 9.3.1 - issue
I have a sql load that works fine in 32 bit Essbase 7.1.5
Now I have setup the same sql load in a new 64 bit Essbase 9.3.1 environment. SQL runs. However when it retrieves it is not retrieving some fields "correctly". For example I have some extract functions in the SQL to extract the month or year from a date field. These are returning "0" now for the month or year. (the function syntax is correct as it works in the 7.1.5 environment. Plus for all my fields that are returning numeric dollar values, they are returning a value of "0" instead of the correct value (which it returns in the 7.1.5 environment).
The sql works correctly if run in SQLPlus. So Essbase is having the issue.
Any ideas?
Edited by: Sean V on Jun 5, 2009 7:48 AMHi Sean,
If you can do it yourself or someone else who can do it for you,
create a view in your db schema you are connected to and use a tool like Oracles SQLDeveloper (it's for free) or something similar to check your query result by select from your view.
This way you can hide your internal logic behind this view and no one has to worry about it.
From my POV this approach has no drawback but only advantage for you.
If it works as expected put the view into your rules file (I do assume you are using rules files)
Example (you need the CREATE VIEW privilege for you account(schema)):
CREATE v_dataload as
SELECT DIM_COL1 as year , DIM_COL2 as month, DIM_COL3 as market , DATA_COL1 as profit, DATA_COL2 as costs .... etc.,
In you rules file you then just put in the SELECT box: year,month, profit, costs ...
and in the table box: v_dataload
If you name you columns like the Dimension (Gen1) you have the comfort that essbase automatically maps the columns tho the appropriate dimension. (But remember a colum in Oracle can have only up to 30 Characters)
Back to you question:
If you get a correct result from you view when using SQLDeveloper but not in you rules file I would say it's very likely a ODBC driver problem.
If so, please check if you have installed the correct driver for your system. MERANT driver is the best choice as fare as I know.
In normal cases you never should have to cast anything into a VARCHAR, since exactly this is the job of the ODBC driver.
However, if everything fails and a cast (like Glen said) is the only way you can make it work put this cast into your view too.
CREATE v_dataload as
SELECT TO_CHAR(DIM_COL1) as year , TO_CHAR(DIM_COL2) as month, TO_CHAR(DIM_COL3) as market ,TO_CHAR( DATA_COL1) as profit, TO_CHAR(DATA_COL2) as costs .... etc.,
Regards
Andre
Edited by: andreml on Dec 16, 2009 12:52 PM -
How to load XML file to table (non-XML) with SQL*Loader -- issue with nulls
I have been attempting to use SQL*Loader to load an XML file into a "regular" Oracle table. All fields work fine, unless a null is encountered. The way that nulls are represented is shown below:
<PAYLOAD>
<FIELD1>ABCDEF</FIELD1>
<FIELD2/>
<FIELD3>123456</FIELD3>
</PAYLOAD>
In the above example, FIELD2 is a null field and that is the way it is presented. I have searched everywhere and have not found how I could code for this. The issue is that if FIELD2 is present, it is coded like: <FIELD2>SOMEDATA</FIELD2>, but the null is represented as <FIELD2/>. Here is a sample of the control file I am using to attempt the load -- very simplistic, but works fine when fields are present:
load data
infile 'testdata.xml' "str '<PAYLOAD>'"
TRUNCATE
into table DATA_FROM_XML
FIELD1 ENCLOSED BY '<FIELD1>' AND '</FIELD1>',
FIELD2 ENCLOSED BY '<FIELD2>' AND '</FIELD2>',
FIELD3 ENCLOSED BY '<FIELD3>' AND '</FIELD3>')
What do I need to do to account for the way that nulls are presented? I have tried everything I could glean from the web and the documentation and nothing has worked. Any help would be really appreciated.I hadn't even got that far. can you direct me to where the docs are to import data that is stored within xml but that you don't need any xml functionality, that just happens to be the format the data is stored in? thx
Maybe you are looking for
-
Restoring iPod Shuffle using windows vista if the device is not showing on itunes?
Hello fellow iPod users I had this problem in the past, using different computers. Whenever I change the computer, this happens with my iPod... and the solution is always to restore it to factory default. Currently my iPod shuffle first generation is
-
Create multiple addresses in master data
Hi all, Can anyone tell me if it's possible to create in the master data multiple addresses for the same supplier? Thanks in advance, Ana
-
Hello experts Is there any way to make negative posting when Good issue cancellation (VL09)? Paresh Jivani
-
Hi I am getting myself confused with the TCAM tables and access-lists. From reading the switching book I can see that the access-lists are compiled into the TCAM. What is confusing me is how a switch does a lookup in parallel when the access lists ar
-
Using oracle reports designer can we export data to excel sheet
using oracle reports designer can we export oracle data to excel sheet