SQL Loader with decimal commas
Dear All,
I am loading data for a German client and the delivered files contain numeric data with decimal commas. For example 123,5 instead of 123.5
I've been googling like mad on this one and there is a lot of chatter about setting NLS_LANG and/or NLS_NUMERIC_CHARACTERS but none of this seems to work in the SQL Loader environment.
I imagine that I will end up cobbling together a complicated thing with TO_NUMBER or with another function but I really can't believe that SQL Loader doesn't have a simple switch to flip from point to comma.
Or have I overlooked something?
Any tips would be a great help.
Regards,
Alan Searle
I am on a client's PC and don't have access to administrative settings.
And also, I cannot be sure that whoever runs the load function in the future will check this.
It is therefore important that I find a way to set this in SQL Loader without any other dependencies.
I think I will probably end up processing it as a string and then translating it to numeric. But this seems like a sledge hammer to crack a nut.
Regards and thanks,
Alan
Similar Messages
-
How to use SQL loader with DBF fixed format record
Hi everybody!
My situation is that: I want to use SQL loader with Foxpro DBF format, it similar to case 2 study (Fixed format record) but DBF file has header, how can I tell SQL loader skip header.
Thank you in advanceAnother option is to apply SQL operators to fields
LOAD DATA
INFILE *
APPEND
INTO TABLE emp
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' (
empno,
ename,
job,
mgr,
hiredate DATE(20) "DD-Month-YYYY",
sal,
comm,
deptno CHAR TERMINATED BY ':',
projno,
loadseq "my_seq.nextval")This is a modified control file of Case Study 3 which originally demonstrated the use of the Sequence parameter -
Problem using SQL Loader with ODI
Hi,
I am having problems using SQL Loader with ODI. I am trying to fill an oracle table with data from a txt file. At first I had used "File to SQL" LKM, but due to the size of the source txt file (700MB), I decided to use "File to Oracle (SQLLDR)" LKM.
The error that appears in myFile.txt.log is: "SQL*Loader-101: Invalid argument for username/password"
I think that the problem could be in the definition of the data server (Physical architecutre in topology), because I have left blank Host, user and password.
Is this the problem? What host and user should I use? With "File to SQL" works fine living this blank, but takes to much time.
Thanks in advanceI tried to use your code, but I couldn´t make it work (I don´t know Jython). I think the problem could be with the use of quotes
Here is what I wrote:
import os
retVal = os.system(r'sqlldr control=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.ctl log=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.log userid=MYUSER/myPassword @ mySID')
if retVal == 1 or retVal > 2:
raise 'SQLLDR failed. Please check the for details '
And the error message is:
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 5, in ?
SQLLDR failed. Please check the for details
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.h.y(h.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source) -
Sql Loader with TSN environment variable.
Sql loader command works fine if I have TSN entry in my system,Can I use SQL Loader with in any other way ie by use of some environment variable???
What are the different ways I can use sql ldr ???952189 wrote:
Sql loader command works fine if I have TSN entry in my system,Can I use SQL Loader with in any other way ie by use of some environment variable???
What are the different ways I can use sql ldr ???
>Sql loader command works fine if I have TSN entry in my system,Can I use SQL Loader with in any other way ie by use of some environment variable???
What are the different ways I can use sql ldr ???
if sqlldr is run on DB Server system, then no tnsnames.ora file is required. -
SQL*Loader with multiple files
Gurus,
I search the documentation and this forum and haven't found a solution to my issue yet...
I am not expert of SQL*Loader. I have used SQL*Loader to copy from one file to a table many times. But I have not copied multiple files into one table especially with different names.
More specifically....
I need to load data from multiple files into a table. But the file names will be different each time. A file will be created every hour. The file name will consist of the root file name appended by a time stamp. For example, a file created on 10/07/2010 at 2:15 P.M. would be filea100720101415.txt while a file created on 10/08/2010 at 8:15 A.M. would be filea100820100815.txt. All the files will be in one directory.How can I load the data from the files using SQL*Loader?
My database: Oracle 10g Release 2
Operating System: Windows 2003 Server
Please assist.
Robertsect55 wrote:
Gurus,
I search the documentation and this forum and haven't found a solution to my issue yet...
I am not expert of SQL*Loader. I have used SQL*Loader to copy from one file to a table many times. But I have not copied multiple files into one table especially with different names.
More specifically....
I need to load data from multiple files into a table. But the file names will be different each time. A file will be created every hour. The file name will consist of the root file name appended by a time stamp. For example, a file created on 10/07/2010 at 2:15 P.M. would be filea100720101415.txt while a file created on 10/08/2010 at 8:15 A.M. would be filea100820100815.txt. All the files will be in one directory.How can I load the data from the files using SQL*Loader?
My database: Oracle 10g Release 2
Operating System: Windows 2003 Server
Please assist.
RobertToo bad this isn't in *nix, where you get a powerful shell scripting capability.
That said, here is the core of the solution .... you will also need a way to identify files that have been processed vs. new ones. Maybe rename them, maybe move them. But with this sample you can see the basics. From there it is really an issue of DOS scripting, which would better be found by googling around a bit.
cd c:\loadfiles
FOR %%datfile IN (*.txt) DO SQLLDR CONTROL=sample.ctl, LOG=sample.log, BAD=baz.bad, DATA=%%datfileTry googling "dos scripting language". You'll find lots of tutorials and ideas on "advanced" (well, as advanced as DOS gets) techniques to solve your problem.
Edited by: EdStevens on Dec 1, 2010 5:03 PM -
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 with ZONED EXTERNAL in a delimited file
I have a text file delimited with '|' and numeric data with trailing signs, e.g somedata|12.00-|13.01|42.01-
My table columns are defined as number(9,2) and I defined the datatype in the control file as zoned external. However, I get the dreaded ORA-01722: invalid number error.
Does anyone have any suggestions?As Bravid says, you can't do that from within SQL*Loader, unless the control files are dynamically generated by a script and the filename included as the default value for that particular column as a hardcoded literal.
It's easier if you use external tables as the table definition contains the "location" which is the list of filenames it is accessing, and the value can be queried as well as being dynamically changed (though if you're dynamically changing it, then you'll programatically know the filename anyway. hint hint!)
;) -
SQL Loader with date formatting
Hi,
I'm trying to get sql loader to insert a date into a column. After much browsing, reading trial and error I still get an array of errors.
I'm using oracle XE
my control file looks like this
LOAD DATA
INFILE 'posmeters/meters.csv'
INTO TABLE position_meters
FIELDS terminated by ","
ID CONSTANT '0',
POSITION_ID,
DATETIME DATE "DD/MM/YYYY HH24:MI:SS",
CASH_IN,
CASH_OUT,
NOTES_IN,
CHANGE_OUT,
WINNINGS,
VTP,
REFILL,
TOKEN_IN,
TOKEN_OUT,
ELEC_PAY,
ELEC_CREDIT,
REMOTE_PAY,
REMOTE_CREDIT,
INSERT_TS EXPRESSION "TO_CHAR(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')",
FIFTY_PND,
TWENTY_PND,
TEN_PND,
FIVE_PND,
TWO_PND,
ONE_PND,
FIFTY_P,
TWENTY_P,
TEN_P,
FIVE_P
It is the DATETIME field which gives me grief. I have a test data file that looks like this
0,1010,29/09/2011 10:23:24,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
and my table is defined as follows
ID NUMBER NOT NULL,
POSITION_ID NUMBER,
DATETIME TIMESTAMP(6) DEFAULT localTIMESTAMP NOT NULL,
CASH_IN NUMBER,
CASH_OUT NUMBER,
NOTES_IN NUMBER,
CHANGE_OUT NUMBER,
WINNINGS NUMBER,
VTP NUMBER,
REFILL NUMBER,
TOKEN_IN NUMBER DEFAULT (0) NOT NULL,
TOKEN_OUT NUMBER DEFAULT (0) NOT NULL,
ELEC_PAY NUMBER DEFAULT (0) NOT NULL,
ELEC_CREDIT NUMBER DEFAULT (0) NOT NULL,
REMOTE_PAY NUMBER DEFAULT (0) NOT NULL,
REMOTE_CREDIT NUMBER DEFAULT (0) NOT NULL,
INSERT_TS TIMESTAMP(6) DEFAULT (localtimestamp) NOT NULL,
FIFTY_PND NUMBER DEFAULT 0,
TWENTY_PND NUMBER DEFAULT 0,
TEN_PND NUMBER DEFAULT 0,
FIVE_PND NUMBER DEFAULT 0,
TWO_PND NUMBER DEFAULT 0,
ONE_PND NUMBER DEFAULT 0,
FIFTY_P NUMBER DEFAULT 0,
TWENTY_P NUMBER DEFAULT 0,
TEN_P NUMBER DEFAULT 0,
FIVE_P NUMBER DEFAULT 0
I have tried defining the control file with
DATETIME DATE "DD/MM/YYYY HH24:MI:SS",
DATETIME EXPRESSION "TO_DATE(:DATETIME, 'DD/MM/YYYY HH24:MI:SS')",
DATETIME EXPRESSION "TO_TIMESTAMP(:DATETIME, 'DD/MM/YYYY HH24:MI:SS')",
I get errors such as
Record 1: Rejected - Error on table "SITE_MAIN"."POSITION_METERS", column DATETIME.
ORA-01861: literal does not match format string
SQL*Loader-291: Invalid bind variable DATETIME in SQL string for column DATETIME.
any help would greatfully appreciated.It seems that the problem was caused by the constant at the beginning of the record and had nothing to do with date formats.
My control file now looks like this
LOAD DATA
INFILE 'posmeters/meters.csv'
APPEND INTO TABLE position_meters
FIELDS terminated by ","
POSITION_ID ,
DATETIME date "DD/MM/YYYY HH24:MI:SS",
CASH_IN ,
CASH_OUT ,
NOTES_IN ,
CHANGE_OUT ,
WINNINGS ,
VTP ,
REFILL ,
TOKEN_IN ,
TOKEN_OUT ,
ELEC_PAY ,
ELEC_CREDIT ,
REMOTE_PAY ,
REMOTE_CREDIT ,
INSERT_TS "TO_TIMESTAMP(SYSDATE, 'DD/MM/YYYY HH24:MI:SS')",
FIFTY_PND ,
TWENTY_PND ,
TEN_PND ,
FIVE_PND ,
TWO_PND ,
ONE_PND ,
FIFTY_P ,
TWENTY_P ,
TEN_P ,
FIVE_P
all is good :o) -
Problems using SQL*Loader with Oracle SQL Developer
I have been using TOAD and able to import large (milllions of rows of data) in various file formats into a table in an Oracle database. My company recently decided not to renew any more TOAD licenses and go with Oracle SQL Developer. The Oracle database is on a corporate server and I access the database via Oracle client locally on my machine. Oracle SQL Developer and TOAD are local on my desktop and connected through TNSnames using the Windows XP platform. I have no issues with using SQL*Loader via the import wizard in TOAD to import the data in these large files into an Oracle table and producing a log file. Loading the same files via SQL*Loader in SQL Developer, freezes up my machine and I cannot get it to produce a log file. Please help!
I am using SQL Developer version 3.0.04. Yes, I have tried it with a smaller file with no success. What is odd is that the log file is not even created. What is created is a .bat file a control file and a .sh file but no log file. The steps that I take:
1.Right click on the table I want to import to or go to actions
2. Import Data
3. Find file to import
4. Data Preview - All fields entered according to file
5. Import Method - SQL Loader utility
6. Column Definitions - Mapped
7. Options - Directory of files set
8. Finish
With the above steps I was not able to import 255 rows of data. No log file was produced so I don't know why it is failing.
thanks.
Edited by: user3261987 on Apr 16, 2012 1:23 PM -
Bad clocks generated, with a locale with decimal comma
I noticed that I have to call 'vivado' with the LANG=C locale to get a decimal point, if I want the Clock Wizard in Vivado to work fine.
My system locale sets up decimal comma, but most numbers in vivado use decimal point. In the case of the Clock Wizard, if the Input Clock of the Zynq CPU is set to 33.33333MHz, it will do all PLL factors calculations considering it as 33MHz, causing major breakage in the built system.
For example, a request of 666MHz for the CPU clock would result in 676MHz.
(This is with Vivado 2014.4 on Linux)I doubt vivado is tested on any localized OS so it's probably a good idea to stick with the North American settings
-
How to use sql loader with sequence?
Hi,
I have create a sequence and I would like to use when I am using sql loader when import some data into table.
Please give me some idea.
ThanksAnother option is to apply SQL operators to fields
LOAD DATA
INFILE *
APPEND
INTO TABLE emp
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' (
empno,
ename,
job,
mgr,
hiredate DATE(20) "DD-Month-YYYY",
sal,
comm,
deptno CHAR TERMINATED BY ':',
projno,
loadseq "my_seq.nextval")This is a modified control file of Case Study 3 which originally demonstrated the use of the Sequence parameter -
Oracle 11G Direct SQL Load with Data Guard
Does SQL Loader in direct mode always bypass the writing of redo logs ?
If the database has force logging on, will SQL Loader in direct mode bypass the writing of redo logs ?
Is there a way to run SQL Loader in direct mode that will create redo logs that can be applied by Data Guard to the backup database ?846797 wrote:
Does SQL Loader in direct mode always bypass the writing of redo logs ?
If the database has force logging on, will SQL Loader in direct mode bypass the writing of redo logs ?
Is there a way to run SQL Loader in direct mode that will create redo logs that can be applied by Data Guard to the backup database ?In case of data guard setup , redo logs will always be generated. -
SQL * Loader with Spanish data!
Hi All,
I have a requirement to load Spanish data into a table. I am using SQL*Loader control file to load the data.
Everything is fine, but the Spanish charecters are not inserting as they have to. It is inserting some junk charecters.
How can I solve this issue?
Thanks in advance.Hello,
Are you using init.ora (pfile) or spfile? Anyway you can do this
sqlplus "/as sysdba"
sql> create pfile='/location_to_pfile/init.ora' from spfile;
File Created
Modify init.ora file and add parameter to support spanish characters
sql>shutdown immediate;
sql>startup pfile='/path_to_pfile/init.ora'; -- YOu should be able mount and open and successfully
Test your data using sqlldr and if it is doing what you are expected it do then.
sql>shutdown immediate;
sql>create spfile from pfile='/path_to_pfile/init.ora';
File Created
sql>startup;
sql>show parameter you_parameter_nameor you can try this to
sqlplus "/as sysdba"
sql> alter system set parameter_name=value scope=both sid='*';
or
sql>alter system set paramter_name=value sid='*';
sql> show parameter parameter_name;
Test your data using sqlldr Regards -
Hi All,
I have 20 text files which have large amount of data. I need to load these data into oracle db. Each of these text files having header as column name which are same in order. Now my manager ask me to load these data in database like that last column should be the file name, so that he can track from which text file data is from. Can anybody help me to do this using sql loader.
Example:
temp1.txt temp2.txt
col1 col2 col1 col2
118 'B' 100 'J'
245 'D' 110 'K'
160 'A' 200 'N'
Now i need to load data into a database table from these text file as-------
Table Name: Temp
col1 col2 FileName
118 'B' temp1
245 'D' temp1
160 'A' temp1
100 'J' temp2
110 'K' temp2
200 'N' temp2you can load from multiple input files provided that the files use the same record format by repeating the INFILE clause. Here is an example:
load data
infile file1.dat
infile file2.dat
infile file3.dat
fields terminated by "," optionally enclosed by '"' trailing nullcols
( column1,
column2 ) -
SQL*Loader with Stored Procedure slow
I have a situation where if SQL*Loader is running then stored procedures returning cursors are excruciatingly slow (about 3 minutes) if the same stored procedure is run via SQL statements it runs fine. The stored procedures also run fine if SQL*Loader is not running. Has anyone seen this before, any thoughts?
Thanks,
edMy query was:
SELECT *
FROM scheme.table@as400 a
WHERE a.vlvalr = to_char(p_vlvalr)
and a.vlvals = to_char(p_vlvals);
Without the to_char! When I add the to_char, the problem is solved!
Maybe you are looking for
-
I'm trying to find an easy way to import my MP3 collection into iTunes without moving, copying or changing it. I can't believe that iTunes doesn't have this feature, as even the most basic music players always have this. I only use iTunes to sync my
-
What's new with iTunes 6.0.2?
Usually the website says what the new features are, but not this time.
-
RMAN Backup for Failover_Yuvi
Hi All Pros, I am a newbie in Oracle, presently using Oracle 11g XE. Just wanted to know that if i can create a Clone copy of Database to other physical server from the Backup taken by RMAN Script provided by default Start>All Programs>Oracle DB 11G
-
Oracle Fusion Middleware Forms Services title need to be change in JRE
Hi, When i run the form in the Runtime(JRE) . I ran the form in separateFrame=true and it is working fine ,but it show "Oracle Fusion Middleware Forms Services" in the title of the JRE .. I need to change the title and ICON of the JRE. Where do i nee
-
Hello all! I am a new Ipad owner and am really enjoying what I have so far. (I am not so brave as to try an update to OS4 yet). My question here though, is when I search ibook store how can I get it to display only books written in English? Also, whe