Suggest Me SQLLDR
Dear All ^O^
I've one table that have 2 columns, one is "Invoice ID" and the other is "Invoice Number".
"Invoice ID" will generate automatically by Procedure01 but I've "Invoice Number" in CSV file. i'm used sqlldr to load "Invoice Number".
Can i used Procedure01 with sqlldr to load my CSV file in my DB ...
or anyone can suggest me...
Pls. help me
Best Regards
No. SQL Loader is a command line utility for uploading data.
You should ideally use External Tables and then you will be able to query the data from the CSV file using SQL.
A search for External Tables on this forum or the internet will yield many examples.
Similar Messages
-
I am trying to load fixed length flat file into Oracle table in ODI by using LKM File to Oracle (SQLLDR).
But getting below error in Call sqlldr step,
org.apache.bsf.BSFException: exception from Jython:
Traceback (most recent call last):
File "<string>", line 22, in <module>
Load Error: See C:\Aditya\ODI\SQL_Loader/TARIFF_SERVICE.log for details
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:322)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2472)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:47)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:662)
Caused by: Traceback (most recent call last):
File "<string>", line 22, in <module>
Load Error: See C:\Aditya\ODI\SQL_Loader/TARIFF_SERVICE.log for details
at org.python.core.PyException.fillInStackTrace(PyException.java:70)
at java.lang.Throwable.<init>(Throwable.java:181)
at java.lang.Exception.<init>(Exception.java:29)
at java.lang.RuntimeException.<init>(RuntimeException.java:32)
at org.python.core.PyException.<init>(PyException.java:46)
at org.python.core.PyException.doRaise(PyException.java:219)
at org.python.core.Py.makeException(Py.java:1166)
at org.python.core.Py.makeException(Py.java:1170)
at org.python.pycode._pyx13.f$0(<string>:59)
at org.python.pycode._pyx13.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1204)
at org.python.core.Py.exec(Py.java:1248)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:172)
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:144)
... 19 more
TARIFF_SERVICE.log is not getting created.
Code generated is,
import java.lang.String
import java.lang.Runtime as Runtime
from jarray import array
import java.io.File
import os
import re
ctlfile = r"""C:\Aditya\ODI\SQL_Loader/TARIFF_SERVICE.ctl"""
logfile = r"""C:\Aditya\ODI\SQL_Loader/TARIFF_SERVICE.log"""
outfile = r"""C:\Aditya\ODI\SQL_Loader/TARIFF_SERVICE.out"""
oracle_sid=''
if len('XE')>0: oracle_sid = '@'+'XE'
loadcmd = r"""sqlldr 'HR/<@=snpRef.getInfo("DEST_PASS") @>%s' control='%s' log='%s' > "%s" """ % (oracle_sid,ctlfile, logfile, outfile)
rc = os.system(loadcmd)
if rc <> 0 and rc <> 2:
raise "Load Error", "See %s for details" % logfile
# Init Vars
nbIns = 0
nbRej = 0
nbNull = 0
strprt = ""
maxAllowedError = r"""0"""
c = 0
flag = 0
# Open log file
f = open(logfile, "r")
try:
lines = f.readlines()
for line in lines:
if line.rstrip().upper().endswith(r"""HR.TC$_0SAS_TARIFF_SERVICEREPLACE:""".upper()):
flag = 1
c = 0
if flag == 1:
if c > 0 and c <= 4:
if c == 1 :
nbIns = int(re.findall("\d+", line)[0])
elif c == 2:
nbRej = int(re.findall("\d+", line)[0])
elif c == 4:
nbNull = int(re.findall("\d+", line)[0])
break
c+=1
strprt = "\n\tIns:\t%s\n\tReject:\t%s\n\tNullField:\t%s" % (nbIns, nbRej, nbNull)
finally:
f.close()
# if some rows has been rejected due to invalide data, check KM option LOA_ERRORS
if rc == 2:
if nbRej > int(maxAllowedError):
raise strprt
break
Can anyone suggest how to resolve this issue?
Thanks,
AdityaHi
i am facing same issue did any body find any solution for it
Hi 1005380,
Thanks for quick respond.
Source(position based file so i cant change the phsical length)
name,type,physical length,logical length,-,-,recordCount
pading
String
1
1
50
null
2
journal_name
String
2
50
50
null
journal_line_number
String
52
6
50
null
segment1
String
58
6
50
null
segment2
String
64
8
50
null
segment3
String
72
5
50
null
segment4
String
77
3
50
null
segment5
String
80
1
50
null
segment6
String
81
4
50
null
segment7
String
85
3
50
null
segment8
String
88
5
50
null
line_desc
String
93
240
50
null
debit_amount
String
333
15
50
null
credit_amount
String
348
15
50
null
Target(DB)
order,name,type,logicalLength,scale,Source mapping fields
55
ENTERED_DR
NUMBER
0
-127
Debit_amt(sorce)
56
ENTERED_CR
NUMBER
0
-127
credit_amt(source)
60
REFERENCE1
VARCHAR2
100
0
journalname(source)
142
CUSTOM_ATTRIBUTE1
VARCHAR2
150
0
segment1(s)
143
CUSTOM_ATTRIBUTE2
VARCHAR2
150
0
segment2(s)
144
CUSTOM_ATTRIBUTE3
VARCHAR2
150
0
segment3(s)
145
CUSTOM_ATTRIBUTE4
VARCHAR2
150
0
segment4(s)
146
CUSTOM_ATTRIBUTE5
VARCHAR2
150
0
segment5(s)
147
CUSTOM_ATTRIBUTE6
VARCHAR2
150
0
segment6(s)
148
CUSTOM_ATTRIBUTE7
VARCHAR2
150
0
segment7(s)
149
CUSTOM_ATTRIBUTE8
VARCHAR2
150
0
segment8(s)
i am omitting padding and line_desc from source for mapping.
Note : 1)even i am mapping single column eg: journal_name and reference1 for more than 1000 records i am getting the Error(Number format exception).for 999 records it is picking up and it is not throwing any error.
2)for 999 records i mapped all the fields its working fine,if pass more than 999 records it throwing error.
knowledge Modules:
LKM File to SQL and IKM SQL Control Append
Execution Steps:
loading Drop work table ,Create work table and error at Load data
Error code:
Source Code:
select
journal_name
C3_JOURNAL_NAME,
segment1
C4_SEGMENT1,
segment2
C5_SEGMENT2,
segment3
C6_SEGMENT3,
segment4
C7_SEGMENT4,
segment5
C8_SEGMENT5,
segment6
C9_SEGMENT6,
segment7
C10_SEGMENT7,
segment8
C11_SEGMENT8,
debit_amount
C1_DEBIT_AMOUNT,
credit_amount
C2_CREDIT_AMOUNT
from
TABLE
/*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=ADA_ENTRY_STG_LINESSNP$CRLOAD_FILE=/C:/DavidNithin/GL_Abstraction/adaoasisla.dat.07012013_13h23.txtSNP$CRFILE_FORMAT=FSNP$CRFILE_SEP_FIELD=0x0009SNP$CRFILE_SEP_LINE=0ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=padingSNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=1SNP$CRLENGTH=1SNP$CRPRECISION=50SNP$CRREC_CODE_LIST=2SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=journal_nameSNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=2SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=journal_line_numberSNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=52SNP$CRLENGTH=6SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=segment1SNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=58SNP$CRLENGTH=6SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=segment2SNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=64SNP$CRLENGTH=8SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=segment3SNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=72SNP$CRLENGTH=5SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=segment4SNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=77SNP$CRLENGTH=3SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=segment5SNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=80SNP$CRLENGTH=1SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=segment6SNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=81SNP$CRLENGTH=4SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=segment7SNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=85SNP$CRLENGTH=3SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=segment8SNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=88SNP$CRLENGTH=5SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=line_descSNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=93SNP$CRLENGTH=240SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=debit_amountSNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=333SNP$CRLENGTH=15SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=credit_amountSNP$CRTYPE_NAME=STRINGSNP$CRLINE_OFFSET=348SNP$CRLENGTH=15SNP$CRPRECISION=50SNP$CR$$SNPS_END_KEY*/
Target Code:
insert into ODI.C$_0MNA_ENTERY_STG_LINES_ADA
C3_JOURNAL_NAME,
C4_SEGMENT1,
C5_SEGMENT2,
C6_SEGMENT3,
C7_SEGMENT4,
C8_SEGMENT5,
C9_SEGMENT6,
C10_SEGMENT7,
C11_SEGMENT8,
C1_DEBIT_AMOUNT,
C2_CREDIT_AMOUNT
values
:C3_JOURNAL_NAME,
:C4_SEGMENT1,
:C5_SEGMENT2,
:C6_SEGMENT3,
:C7_SEGMENT4,
:C8_SEGMENT5,
:C9_SEGMENT6,
:C10_SEGMENT7,
:C11_SEGMENT8,
:C1_DEBIT_AMOUNT,
:C2_CREDIT_AMOUNT
Error message:
java.lang.NumberFormatException: For input string: "1,000"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Inte -
Getting Error while using LKM File to Oracle(SQLLDR) KM in ODI
Hi All ,
Could anyone please help me out on this error which i am getting while using LKM File to Oracle(SQLLDR)
My Scenario :
1. I have my CSV file created in one location with some records .
2. Created a new interface having this CSV file as source(File Technology) and Table as target (Oracle technology)
3. Here i want to get the contents from csv and store into the target table by using SQLLDR .For that i am using this KM- LKM File to Oracle(SQLLDR)
4. By Executing the Interface i am getting following error at step 6 -call sqlldr
org.apache.bsf.BSFException: exception from Jython:
Traceback (most recent call last):
File "<string>", line 22, in <module>
Load Error: See E:\demo1\file/SALES.log for details
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:322)
at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2472)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:47)
at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:577)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:468)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:662)
Caused by: Traceback (most recent call last):
File "<string>", line 22, in <module>
Load Error: See E:\demo1\file/SALES.log for details
at org.python.core.PyException.fillInStackTrace(PyException.java:70)
at java.lang.Throwable.<init>(Throwable.java:181)
at java.lang.Exception.<init>(Exception.java:29)
at java.lang.RuntimeException.<init>(RuntimeException.java:32)
at org.python.core.PyException.<init>(PyException.java:46)
at org.python.core.PyException.doRaise(PyException.java:219)
at org.python.core.Py.makeException(Py.java:1166)
at org.python.core.Py.makeException(Py.java:1170)
at org.python.pycode._pyx2.f$0(<string>:59)
at org.python.pycode._pyx2.call_function(<string>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1204)
at org.python.core.Py.exec(Py.java:1248)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:172)
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:144)
... 19 more
Here the sales.log file is not created in the above directory .I am not getting where it is actually went wrong.
I searched for the solution and i could not find any.Please help me out as it is high priority for me.
I tried to run SQL*Loader through command prompt and i am able to generate the data in the target table and not getting it through ODI.
Atleast is there any workaround .Please suggest me.
Environment Details: ODI_11.1.1.7.0, Oracle DB 11g
Thanks,
keerthiWhich agent are you using to execute?
Standalone? If standalone, did you start it with OPMN? I've seen such issues with standalone agent started with OPMN.
Generally these kind of issues occur when you try to run with standalone agent started with OPMN.
Because OPMN does not have access to the environment shell variables PATH or ORACLE_HOME and therefore the sqlldr.exe binary (or other Oracle product binary) is not found for execution.
In this case, you need to specify PATH and ORACLE_HOME variables in opmn.xml file like below for your agent(say "MyStandaloneAgent" in this case)
<ias-component id="MyStandaloneAgent">
<process-type id="odiagent" module-id="CUSTOM">
<environment>
<variable id="ORACLE_HOME" value="C:\oracle\product\11.2.0\client_1"/>
<variable id="PATH" value="C:\oracle\product\11.2.0\client_1\BIN;$PATH"/>
After that, start and stop the agent and try the execution once again. -
Sqlldr: Message 2100 not found - No msg files in my RDBMS\Mesg dir
Hi All,
I am trying to use sqlldr on an WIN2003R3 server. This is not working and I get an error message:
MESSAGE 2100 NOT FOUND: WHEN ATTEMPTING TO START SQLLDR.
I searched the internet and there it states that this should have to do with my ORACLE_HOME or ORACLE_BASE environment variables or path. I checked those, but they seem fine.
On metalink it states two possiblities, for WIN NT,
- Removing the ORACLE_HOME env. variable
- Copy the files from another Oracle installation
(Metalink Note:171648.1 and Note:1081848.6).
I tried the first, but still doesnot work. Unfortunately I can't try the second, because all other Oracle installations I have access to are the same version, so they all have the same files in the RDBMS\Mesg directory.
My questions are:
- How many files should there be in the mentioned directory? (Now I've got 4: kgpus.msb, ocius.msb, oraus.msb, smgus.msb )
- Where can I get the missing files, or is there any other way to get around this?
- any ohter suggestions?
Thanks in advance. Any help will be appreciated,
Regards,
Toin.
Message was edited by:
Toin
Fixed a typo.
Message was edited by:
ToinThe problem is that my SQL Loader is not working under WIN NT. This is a known issue, one of the suggestions I found on metalink is to manually copy the message files that should be in ORACLE_HOME\DBMS\Mseg from another Oracle installation.
I cannot do this, because all my Oracle installations are the same. So the questions is where can I find the appropriate message files, so I can get my SQL Loader to run??
Thanks.
Toin. -
Host('sqlldr') is not working in oracle forms 10g
oracle database version:10.1.2.0
oracle forms version:10g
client ans server are on the same machine.
when i am trying to load the file in to oracle,i wrote the when-button-pressed trigger as
host('sqlldr');
when i run the form its not giving any result.
i tried by using batch file also itn is giveing the error like
message 2100 not foundWhat happens when you run "SQLLDR" from a command window? It sounds like the directory where the SQLLDR executable is located is not in your PATH. You can either add it to your path or fully qualify the path to the executable as Christian suggests.
Craig... -
Best practice for sqlldr -- direct to core or to stage first?
We want to begin using sql loader to load simple (but big) tables that have, up to this point, been loaded via perl and it's DBI connection to Oracle. The target tables typically receive 10-20 million rows per day (parsed log data from many thousands of machines) and at any one time can hold more than a billion total records PER TABLE. These tables are pretty simple (typically 5-10 columns, 2 or 3 part primary keys). They are partitioned BY MONTH (DAY is always one of the primary key columns) and set up on very large SAN disk arrays, stripped, etc. I can use sqlldr to load the core tables directly, OR, I could use sqlldr to load a staging table on a daily basis, then PL/SQL and SQL+ to move data from the staging table to the core. My instinct tells me that the second route is SAFER, that is there is less chance that something catastrophic could corrupt the core table, but obviously this would (a) take more time to develop and (b) reduce our over-all throughput.
If I go the first route, loading the core directly with sqlldr, what is the worst thing that could possibly happen? That is, in anyone's experience, can a sqlldr problem corrupt a very large table? Does the likelihood of a catastrophic problem increase in proportion to the number of rows already in the target table? Are there strategies that will mitigate potential catastrophies besides going to staging and then to core via pl/sql? For example, if my core is partitioned by month, might I limit potential damage only to the current month? Are there any known potential pitfalls to using sqlldr directly in this fashion?
Thanks
matthew rapaport
[email protected]Wow, thanks everyone!
1. External tables... I'd thought of this, but in our development group we have no direct access to the DBMS server so we'd have to do some workflow to move the data files to the dbms server and then write the merge. If sql loader will do the job directly (to the core) without risk, then that seems to be the most straight-forward way to go.
2. The data in the raw files is very clean, this being done in the step that parses the raw logs (100-500mb each) to the "insert files" (~20mb each), and there would be no transformations in moving data from staging to core, so again that appears to argue for direct-to-core loading.
3. The data is collected by DAY, but reported on mostly by MONTH (e.g., select day, sum(col), count(col), from TABLE where day between A and B, group by day, order by day, etc where A and B are usually the first and last day of the month) and that is why the tables are partitioned by month, but perhaps this is not the best practice (???). I'm not the DBA, but I can make suggestions... What do you think?
4. Time to review my sqlldr docs! I haven't used it in a couple of years, and I'm keeping my fingers crossed that it can handle the particular delimiter used in these files (pipe-tab-pipe expressed in perl as "|\t|". If I recall it can, but I'm not sure how to express the tab...
Meanwhile, thank you very much, you have all been a BIG help... Strange no one asked me how it was that a Microsoft company was using Oracle :-) ... I work for DANGER INC (was www.danger.com if anyone interested) which is now owned (about 9 months now) by Microsoft, and this is the legacy reporting system... :-)
matthew rapaport
[email protected]
[email protected] -
Using sqlldr to load old UNIFY data into oracle 11g
I have a dump of an old UNIFY database whitch I need to build a controlfile to import to oracle using sql loader.
the main problem is that the file is containing records for 64 tables
the dumpfile is starting with the name of the table, and then data for each column in that table. like this:
RSLT|0|26/09/2005|1281|2|LD|S1|0|0| 223|223.000000|Centra|27/09/2005|10:13|Centra|27/09/2005|10:13|3|0|3984|180|24069844193|379650048|247075485|134233305|0|
SMPL|0|26/09/2005|1281|3||5|ALLE|2|1|177|0||26/09/2005|**:**|svi2|||**/**/****|**:**||0||0|0|**/**/****|00:01||286138573|2560|
I have build the ny datamodel in oracle, and it is the same as in the old UNIFY system. so that is not a problem.
but HOW do I tell sqlldr that there is not data from just one table but 64..??
the tablenames and how to difference them is the main problem..
This is an urgent issue.. I need helt fast.
any suggestions?Hi,
You can do something like that
--- Control file--------------
cat aa.ctl
LOAD DATA
INFILE '/home/oracle/MYSHELL/aa.txt'
TRUNCATE
INTO TABLE RSLT
WHEN DBNAME = 'RSLT'
FIELDS TERMINATED BY '|'
DBNAME,
col_1,
col_2,
col_3,
col_4
INTO TABLE SMPL
WHEN DBNAME = 'SMPL'
FIELDS TERMINATED BY '|'
DBNAME position(1),
col_1,
col_2,
col_3,
col_4
-- dat file----------
cat aa.txt
RSLT|0|26/09/2005|1281|2
SMPL|0|26/09/2005|1281|3
SQL> host sqlldr me/** control=aa.ctl
SQL*Loader: Release 11.2.0.2.0 - Production on Wed Aug 14 02:15:37 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 2
SQL> select * from SMPL;
DBNAME COL_1 COL_2 COL_3 COL_4
SMPL 0 26/09/2005 1281 3
SQL> select * from RSLT;
DBNAME COL_1 COL_2 COL_3 COL_4
RSLT 0 26/09/2005 1281 2
HTH -
How to load xml with large base64 element using sqlldr
Hi,
I am trying to load xml data onto Oracle 10gR2. I want to use standard sqlldr tool if possible.
1) I have registered my schema with succes:
- Put the 6kbytes schema into a table
- and
DECLARE
schema_txt CLOB;
BEGIN
SELECT text INTO schema_txt FROM schemas;
DBMS_XMLSCHEMA.registerschema ('uddkort.xsd', schema_txt);
END;
- Succes: I can create table like:
CREATE TABLE XmlTest OF XMLTYPE
XMLSCHEMA "uddkort.xsd"
ELEMENT "profil"
- USER_XML_TABLES shows:
TABLE_NAME,XMLSCHEMA,SCHEMA_OWNER,ELEMENT_NAME,STORAGE_TYPE
"XMLTEST","uddkort.xsd","THISE","profil","OBJECT-RELATIONAL"
2) How can I load XML data into this?
- One element of the schema is <xs:element name="billede" type="xs:base64Binary" minOccurs="0"/>
- This field in data can be 10kbytes or more
I have tried many control files - searching the net, but no luck so far.
Any suggestions?
/Claus, DK- One element of the schema is <xs:element name="billede" type="xs:base64Binary" minOccurs="0"/>
- This field in data can be 10kbytes or moreThe default mapping in Oracle for this type is RAW(2000), so not sufficient to hold 10kB+ of data.
You'll have to annotate the schema in order to specify a mapping to BLOB datatype.
Something along those lines :
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
<xs:element name="image" xdb:defaultTable="IMAGES_TABLE">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="content" type="xs:base64Binary" xdb:SQLType="BLOB"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb05sto.htm#sthref831
Then :
SQL> begin
2 dbms_xmlschema.registerSchema(
3 schemaURL => 'image.xsd',
4 schemaDoc => '<?xml version="1.0"?>
5 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
6 <xs:element name="image" xdb:defaultTable="IMAGES_TABLE">
7 <xs:complexType>
8 <xs:sequence>
9 <xs:element name="name" type="xs:string"/>
10 <xs:element name="content" type="xs:base64Binary" xdb:SQLType="BLOB"/>
11 </xs:sequence>
12 </xs:complexType>
13 </xs:element>
14 </xs:schema>',
15 local => true,
16 genTypes => true,
17 genTables => true,
18 enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
19 );
20 end;
21 /
PL/SQL procedure successfully completed
SQL> insert into images_table
2 values(
3 xmltype(bfilename('TEST_DIR', 'sample-b64.xml'), nls_charset_id('AL32UTF8'))
4 );
1 row inserted
where "sample-b64.xml" looks like :
<?xml version="1.0" encoding="UTF-8"?>
<image>
<name>Collines.jpg</name>
<content>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QlMUGhvdG9zaG9wIDMuMAA4QklNA+0KUmVzb2x1dGlvbgAA
AAAQASwAAAABAAEBLAAAAAEAAThCSU0EDRhGWCBHbG9iYWwgTGlnaHRpbmcgQW5nbGUAAAAABAAA
AHg4QklNBBkSRlggR2xvYmFsIEFsdGl0dWRlAAAAAAQAAAAeOEJJTQPzC1ByaW50IEZsYWdzAAAA
O9r8FHXdH4LDSSUHoImAmcIcQPwWAkkh3ogKI404WGkkkO8Po/EpmmCYWEkkru7z/FJg9sRqsFJJ
XR3iPZMJN1HmsFJJXT6u+3UQdJUJj7lhpJKHV32dh96i3Qx8lhJJK7u9w4jw7p+SCsBJJDukQ7Tu
VM6Ln0klHo7rjEeak0rASST0f//Z</content>
</image>BTW, open question to everyone...
XMLTable or XMLQuery don't seem to work to extract the data as BLOB :
SQL> select x.image
2 from images_table t
3 , xmltable('/image' passing t.object_value
4 columns image blob path 'content'
5 ) x
6 ;
ERROR:
ORA-01486: size of array element is too large
no rows selectedhowever this is OK :
SQL> select extractvalue(t.object_value, '/image/content') from images_table t;
EXTRACTVALUE(T.OBJECT_VALUE,'/IMAGE/CONTENT')
FFD8FFE000104A46494600010201012C012C0000FFED094C50686F746F73686F7020332E30003842
494D03ED0A5265736F6C7574696F6E0000000010012C000000010001012C0000000100013842494DIs there a known restriction when dealing with LOB types?
Edited by: odie_63 on 17 nov. 2011 19:27 -
Hi,
I've been having this problem for the last couple of days and have read all the threads on using the sqlldr command with HOST through Forms 9i to load data from application server into the database.
I've tried most of the suggestions but have still come up with a blank. Basically, this is the problem, I have a form that has to load a file that is on the c:\temp into the temp_table table in the database. I have the control file in the c:\temp folder on the application server. sqlldr works fine when I execute it from the command line in the application server with the exact same command I'm passing through the HOST command. But when I execute it through the HOST command, sqlldr doesn't even get loaded because, the log file specified is not even getting created.
The AS has 2 Oracle homes, 1 for 10g Suite and another for the oracle client which includes sqlldr. Both the paths are setup for the path variable in the .env file. I've also tried creating a bat file on the application server which runs perfectly when executed on the application server, but executes everything except the sqlldr command in the bat file. My bat file looks like this -
REM tam.bat
sqlldr>tam3.txt
path>tam4.txt
Out of this, tam3.txt gets created as a blank file, while tam4.txt contains the correct path, including the path to the sqlldr.exe
Is there anything I have missed in configuring this? My HOST command I was using which didn't work, looked something like -
sqlldr user/pass@db control=c:\temp\tam.CTL LOG=c:\temp\tam.LOG DATA=01.txt
Works perfectly when executed on the AS from a command prompt, but just won't work through the HOST command. The HOST command is able to produce other results just perfectly though.
Would really appreciate any help on this, have really been frustrated with this. I know this has been long and windy, but thought I'd give all the facts straight out.
Best regards
TamimIt appears that you are using Windows and not a Unix platform.
At least two things need to happen in order for SqlLoader to work using HOST:
CHANGE THE SERVICE PROPERTIES
1. Open the Windows Management Console for Services and locate the service for the Mid Tier Oracle Process Manager (OPMN).
2. Open the properties for this service and select the Log on tab. Check the box labeled "Allow service to interact with Desktop". Apply and save changes. This will require that OPMN be restarted.
SCRIPT THE SQLLOADER CALL
Shells started with HOST do not contain any of the system variables. This means that PATH, CLASSPATH, ORACLE_HOME, etc are not set. So when you make a call to an app like SqlLoader which expects certain environment variables to be set, it will likely fail. The problem is that HOST does not report this failure back to the form. You need to script the call to SqlLoader. You must first set all the needed variables. Here are just a few:
PATH
ORACLE_HOME
ORACLE_SID
TNS_ADMIN
See Metalink Note 221533.1 for more info. -
Sqlldr does not understand unicode characters in file names
Hello,
I am trying to call sqlldr from a .net application on Windows to bulk load some data. The parameter, control, data, log files used by sqlldr, are all located in the C:\Configuración directory (note the unicode character in the directory name).
Here is my parfile:
control='C:\Configuración\SystemResource.ctl'
direct=true
errors=0
log='C:\Configuración\SystemResource.log'
userid=scott/tiger@orasrv
When I make a call as
sqlldr -parfile='C:\Configuración\SystemResource.par'I am getting
SQL*Loader-100: Syntax error on command-line
If I run it as
sqlldr -parfile='C:\Config~1\SystemResource.par'I am getting
SQL*Loader-522: lfiopn failed for file (C:\Configuraci├│n\SystemResource.log)
If I remove the log= parameter from the parameter file, I am getting
SQL*Loader-500: Unable to open file (C:\Configuraci├│n\SystemResource.ctl)
SQL*Loader-553: file not found
SQL*Loader-509: System error: The system cannot find the file specified.
Can anyone suggest a way to handle unicode/extended ASCII characters in file names?
Thanks,
Alex.Werner, thank you for replying to my post.
In my real application, I actually store the files in %TEMP%, which on Spanish and Portuguese Windows has "special" characters (e.g. '...\Administrador\Configuración local\Temp\'). In addition, you can have a user with the "special" characters in the name which will become part of %TEMP%.
Another problem is that 8.3 name creation may be disabled on NTFS partitions.
Problem #3 is that the short file names that have "special" characters are not converted correctly by GetShortPathName windows API, e.g. "Configuración" will be converted to "Config~1", but for "C:\ración.txt" the api will return the same "C:\ración.txt", even though dir /x displays "RACIN~1.TXT". Since I am creating the parameter and control files programmatically from a .net application, I have to PInvoke GetShortPathName.
Any other ideas?
Thanks,
Alex. -
Hi all
The current requirement we have is to Load data from Excel File to oracle Databases.
The Excel file has around 30 Sheets , each corresponds to a table, ( means 30 tables in the database) .
Currently we are using sqlldr commands to load data from CSV files to the Oracle Database. The only problem is that sometime the DBA has to go out or is busy workign on somthing else, so May i kindy get some expert suggestions on how to automate this DataLoading Task.
Somebody has suggested to My Manager ( who is not aware of oracle and IT at all) that data can be loaded via ODBC. It is suggested to him that all we need to do is to place the CSV files on the Server at a particular folder and Oracle will do the rest.
I am not that proficient in Data loading methods.. so may i know any technique which will simplify/automate the Task.
I mean how can we automate so that every time , the the sql loader scripts run at command promt. I think data base ( Oracle ) as nothing to do with command promt i feel. isnt it ..
Kindly have ur expert./experienced suggestions.
I would be highly grateful to all
RegardsTo automate sqlldr scripts, you would usually write a OS script file that will periodically looks for files in a given directory and run the sqlldr commands:
- on Windows: .bat or .wsh files to be scheduled with "at" command or windows scheduled tasks tool
- on Unix: a script shell in the crontab.
Much more complicate but without any OS script:
- write a PL/SQL code to read, parse the file to be loaded using UTL_FILE
package
- this PL/SQL code must also generate INSERT statements and process errors ...
- this PL/SQL code can be scheduled with DBMS_JOB package to run a periodic intervals.
Message was edited by:
Pierre Forstmann -
Error in Loading Data with SQLLDR in Oracle 10G
Hello,
Can any one suggest whats the problem in the below mentioned Control file used for loading data through SQL*LOADER
LOAD DATA
INFILE 'D:\test\temt.txt'
BADFILE 'test.bad'
DISCARDFILE 'test.dsc'
INTO TABLE "TEST"
INSERT
(SRNO INTEGER(7),
PROD_ID INTEGER(10),
PROMO_ID INTEGER(10),
CHANNEL_ID INTEGER(10),
UNIT_COST INTEGER(10),
UNIT_PRICE INTEGER(10)
I am trying to load data in SCOTT schema as user scott.
Why do i get such an error, please refer the attach Log file.
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Mar 20 14:43:35 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: D:\test\temt.ctl
Data File: D:\test\temt.txt
Bad File: test.bad
Discard File: test.dsc
(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
Column Name Position Len Term Encl Datatype
SRNO FIRST 7 INTEGER
PROD_ID NEXT 10 INTEGER
PROMO_ID NEXT 10 INTEGER
CHANNEL_ID NEXT 10 INTEGER
UNIT_COST NEXT 10 INTEGER
UNIT_PRICE NEXT 10 INTEGER
Record 1: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 2: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 3: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 4: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 5: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 6: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 7: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 8: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 9: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 10: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 11: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 12: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 13: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 14: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 15: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 16: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 17: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 18: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 19: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 20: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 21: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 22: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 23: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 24: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 25: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 26: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 27: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 28: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 29: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 30: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 31: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 32: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 33: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 34: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 35: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 36: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 37: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 38: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 39: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 40: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 41: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 42: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 43: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 44: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 45: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 46: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 47: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 48: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 49: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 50: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
Record 51: Rejected - Error on table "TEST".
ORA-01460: unimplemented or unreasonable conversion requested
MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
Table "TEST":
0 Rows successfully loaded.
51 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: 3648 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 64
Total logical records rejected: 51
Total logical records discarded: 0
Run began on Fri Mar 20 14:43:35 2009
Run ended on Fri Mar 20 14:43:43 2009
Elapsed time was: 00:00:07.98
CPU time was: 00:00:00.28
Below is the method of using SQLLDR and table details,
SQL> desc test
Name Null? Type
SRNO NUMBER(7)
PROD_ID NUMBER(10)
PROMO_ID NUMBER(10)
CHANNEL_ID NUMBER(10)
UNIT_COST NUMBER(10)
UNIT_PRICE NUMBER(10)
Method for using sqlldr is :
cmd promt,
d:\> sqlldr scott/tiger
control = D:\test\temt.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Mar 20 15:55:50 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 64
I even tried few examples,
Which of the below mentioned Control file make sense,
--1
LOAD DATA
INFILE 'D:\test\temt.txt'
BADFILE 'test.bad'
DISCARDFILE 'test.dsc'
INTO TABLE "TEST"
INSERT
FIELD TERMINATED BY (,)
(SRNO INTEGER(7),
PROD_ID INTEGER(10),
PROMO_ID INTEGER(10),
CHANNEL_ID INTEGER(10),
UNIT_COST INTEGER(10),
UNIT_PRICE INTEGER(10)
--2
LOAD DATA
INFILE 'D:\test\temt.txt'
BADFILE 'test.bad'
DISCARDFILE 'test.dsc'
INTO TABLE "TEST"
INSERT
FIELD TERMINATED BY (,) optionally enclosed by '"'
(SRNO INTEGER(7),
PROD_ID INTEGER(10),
PROMO_ID INTEGER(10),
CHANNEL_ID INTEGER(10),
UNIT_COST INTEGER(10),
UNIT_PRICE INTEGER(10)
*For code--1 i get below mentioned error..*
D:\>sqlldr scott/tiger
control = D:\test\temt.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Mar 20 16:36:00 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL*Loader-350: Syntax error at line 8.
Expecting "(", found "FIELD".
FIELD TERMINATED BY (,)
^
*And for code--2 i get the below error,*
D:\>sqlldr scott/tiger
control = D:\test\temt.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Mar 20 16:39:22 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL*Loader-350: Syntax error at line 8.
Expecting "(", found "FIELD".
FIELD TERMINATED BY (,) optionally enclosed by '"'
^
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------below is the data i am trying to load through sqlldr
1,14,999,3,89098,111287
2,14,999,2,88645,110899
3,14,999,2,90418,117623
4,14,999,3,89272,115999
5,14,999,4,86364,117623
6,15,999,3,87522,101399
7,15,999,4,84671,99999
8,15,999,4,84671,99999
9,15,999,4,86364,101399
10,15,999,4,88735,100399
11,15,999,2,90418,101399
12,15,999,3,89272,101399
13,15,999,2,90418,101399
14,17,999,2,9694,155099
15,17,999,3,97618,155099
16,17,999,3,97618,155099
17,18,999,3,11333,169783
18,18,999,2,11479,163279
19,18,999,3,11333,163279
20,18,999,3,115141,173504
21,18,999,2,117086,165565
22,18,999,2,116856,17532
23,18,999,2,117086,169783
24,19,999,4,489,6237
25,19,999,3,4968,6302
26,20,999,2,52876,60839
27,20,999,3,52202,59999
28,20,999,3,53246,59999
29,20,999,3,54205,60209
30,20,999,3,54205,60209
31,21,999,4,76204,106773
32,21,999,4,76204,106773
33,21,999,3,7877,105299
34,21,999,4,76204,106773
35,21,999,4,77576,105668
36,21,999,3,7877,105299
37,21,999,4,76204,105299
38,21,999,2,81377,107595
39,21,999,2,81377,107595
40,21,999,4,77728,107595
41,22,999,3,2187,2656
42,22,999,2,2216,2661
43,22,999,3,2187,2656
44,22,999,2,2251,2632
45,22,999,3,2187,2656
46,22,999,4,2154,2628
47,22,999,3,2187,2656
48,22,999,3,2231,2661
49,22,999,3,2231,2624
50,22,999,2,2296,2632
51,22,999,3,2231,2661
52,22,999,4,2158,2661
53,23,999,3,1913,2408
54,23,999,3,1951,2375
55,23,999,3,1987,2383
56,23,999,3,1951,2408
57,24,999,4,3946,4943
58,24,999,3,4073,4883
59,24,999,2,4053,4934
60,24,999,2,4053,4866
61,24,999,4,3946,4943
62,24,999,3,4001,4943
63,24,999,3,4154,4892
64,24,999,4,4025,4875
65,24,999,4,4025,4875
66,24,999,2,4134,4875
67,24,999,3,4081,4943
68,24,999,2,4134,4934
69,24,999,4,4025,4943
70,24,999,4,4025,4875
71,24,999,3,4081,4943
72,25,999,3,983,12655
73,25,999,3,983,12655
74,25,999,2,9958,12655
75,25,999,3,983,12655
76,25,999,2,9958,12832
77,25,999,3,10027,12832
78,25,999,2,10157,12774
79,25,999,4,9888,12655
80,25,999,2,10157,12832
81,25,999,4,9888,12832
82,25,999,4,9888,12832
83,26,999,3,1305,17034
84,26,999,3,1305,16799
85,26,999,3,13551,16858
86,27,999,3,3992,4927
87,27,999,3,4064,4876
88,29,999,3,43761,56175
89,29,999,2,44942,55621
90,29,999,4,42335,55399
91,29,999,2,44322,55399
92,29,999,2,45208,56175
93,29,999,2,45208,56175
94,29,999,4,43182,56175
95,29,999,3,44636,56175
96,29,999,4,43182,56175
97,29,999,4,43182,56175
98,30,999,3,869,1094
99,30,999,4,857,1079
100,30,999,2,898,1079
---------------------------------------------------------------------------------------------------------------------------------------------------------------------- -
How to call Oracle sqlldr in Java
Hi All:
I am using windows 2000 server with Eclipse.
In the dost prompt, I ran the file run_sqlldrTest2.cmd and it loaded record into the Oracle database.
I tried to do the same thing in java calling the run_sqlldrTest2.cmd. In java it states the "The command line job - -executed successfully."
However, I donot see the record being loaded into the database.
What am I doing wrong?
If I comment out the "cmd[2]=set PATH=C:\\OraHome_1\\bin;" line and ran RunCmd.java, on the line for P.waitFor() it would freeze there forever:
Any help for suggestions would be greatly appreciated!!
Yours,
Frustrated.
RunCmd.java:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class RunCmd
public static void main(String[] args)
Process P;
Runtime r;
r = Runtime.getRuntime();
try {
String[] cmd = new String[4];
cmd[0] = "cmd.exe";
cmd[1] = "/C";
cmd[2]="set PATH=C:\\OraHome_1\\bin;";
cmd[3]="C:\\test2009\\scripts\\run_sqlldrTest2.cmd";
try {
P = r.exec(cmd);
int Exitcode = P.waitFor();
if (Exitcode != 0)
System.out.println("The command line job did not execute successfully");
else
System.out.println("The command line job - " +
" - executed successfully."); //break
catch (Exception e)
System.out.println(" 1 e.getMessage():"+e.getMessage());
} catch (Exception e)
System.out.println("2 e.getMessage():"+e.getMessage());
run_sqlldrTest2.cmd:
set PATH=C:\\OraHome_1\\bin;
C:\test2009\scripts\run_sqlldr.cmd test2009/test2009@orcl control=C:\test\scripts\ctl\amcare.ctl log=C:\test\scripts\log\NAC20090150005112.txt.log data=C:\test\scripts\data\NAC20090150005112.txt bad=C:\test\scripts\bad_files\NAC20090150005112.txt.bad discard=C:\test\scripts\dis_files\NAC20090150005112.txt.dis;
run_sqlldr.cmd:
echo %* > C:\test2009\scripts\log\sqlldr.log
sqlldr %* >> C:\test2009\scripts\log\sqlldr.logcmd does not support multiple commands on the same line. Your program is trying to set the path as in cmd[2] and ignoring the rest of the line. Try commenting/removing this line.
-
SQLLDR: Is it possible to import CSV using column defined in CVS?
Hello,
We are in 11gR1 ...and I have just practiced easy SQLLDR import ... So I feel quite new in the domain.
We receive CSV files with, at their first line, the column titles, ...
These CSV have their columns never at the same place ... and we experience difficulties to import their data...
The column titles are the same, but not their position in the file...
Here are small examples :
CSV1 :
Project;Customer;Title *;Description *;Submitted By;Submitted On
Maintenance 1 2 3;CUST_A;Analysis;Description of the Analysis;Bob Dylan;19/08/2008
Maintenance B;CUST_B;Development;Description of the project;Bob Dylan;19/08/2008
CSV2 :
Title *;Description *;Project;Customer;Submitted On;Submitted By
Admin; Description of Administration; Proj1; Cust_A; 25/12/2008; Prince
CSV3 :
Description *;Customer;Title *;Project;Submitted By;Submitted On
Desc profile;Cust_B;Analysis;Projet_A; Phil Collins; 11/03/2009
I hope that their is a solution ...
I suppose that someone got a similar issue ...
Thanks in advance for your help,
OlivierHello,
Yes, you are correct ...
like in the examples I provided, the column titles are giving the position of the column data .. but there can have different positions
So, at the moment, I play with the Unix script to decide with CTL I should take ....
So, it looks like, there is no other issue than duplicating the code and the CTL files ...
Any other suggestions or advices ?
Thanks in advance,
Olivier -
SQL*Loader sqlldr removes zeros from character field
Hello,
I am using SQL*Loader to load an Oracle table, and am having a problem. One of the fields is defined as VARCHAR2 and contains comments entered by a user. There may be numbers or dollar amounts included in this text. When I execute the sqlldr script below, the result is that all of the zeros on the text field disappear. There is a translate function invoked for this field (bolded statement) in an attempt to remove imbedded newlines from the text. Wherever there was a zero in the original text, it ends up being removed after I run this script. Can anyone suggest why this is occurring, and how to prevent it? Can it be related to the translate function?
Thanks for your help!
OPTIONS (READSIZE=20971520, BINDSIZE=20971520, ROWS=20000)
LOAD DATA
INFILE 'R24.REGION.ERL.N1E104' "str X'5E5E220A'"
BADFILE 'LOGS/N1E104_BUT_RS_ASSGN_TXT_BADDATA.TXT'
DISCARDFILE 'LOGS/N1E104_BUT_RS_ASSGN_TXT_DISCARDDATA.TXT'
REPLACE
INTO TABLE TESTM8.CONV_BUT_RS_ASSGN_TXT
FIELDS TERMINATED BY '~' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
RST_RS_EXT_TXT_OID DECIMAL EXTERNAL,
RST_RS_ASSGN_OID DECIMAL EXTERNAL NULLIF RST_RS_ASSGN_OID = 'NULL',
RST_TXT_SEQ_NBR INTEGER EXTERNAL,
RST_RS_COMM_OID DECIMAL EXTERNAL,
RST_DIF_ASSGN_OID DECIMAL EXTERNAL NULLIF RST_DIF_ASSGN_OID = 'NULL',
RST_EXTENDED_TXT "SUBSTR(TRANSLATE(:RST_EXTENDED_TXT, '#0x0A', '#'), 1, 248)"
--------------------------------------------Never mind, found my mistake. In the TRANSLATE function, I had assumed that the 0x0A would be interpreted as a single hex value. Instead, it is interpreted literally as the character '0', the character 'x', the character 'A', etc. The result is that the transformed text had no '0', 'x', or 'A' characters, which is exactly what I inadvertently told it to do. I changed it to the following, which works better ;-)
RST_EXTENDED_TXT "SUBSTR(TRANSLATE(:RST_EXTENDED_TXT, '#'||CHR(10), '#'), 1, 250)"
Maybe you are looking for
-
If someone has wiped my ipad and changed passwords on icloud how do i get my data back
if someone has wiped my ipad and changed passwords on icloud how do i get my data back? please could someone help me out thanks
-
Cannot install iTunes 9 no matter what I do
I have been trying to install iTunes 9 for the past few days and with no luck. I keep getting the same error message. "Unable to install the GEAR driver set at this time. The GEAR AspiWDM service used by the GEAR driver set is scheduled to be deleted
-
Do i have to delete all files on my external hard drive, to make a Backup of my Macbook?
Hi! I Have a MacBook Pro, and i want to make a Backup of it (with help from Time Machine.) - To a external hard drive, but, i have one little issue, and that is that i already have other files on that external hard drive, (from other computers..) but
-
Can i change the subnet used by hotspot?
Since upgrading to iOS 7, when I use the hotspot functionality of my iPhone, my PC shuts down every time I join the hotspot network. The subnet is 172.20.10.x. My PC seems to have issue with certain 172.x.x.x subnets. This did not happen prior to the
-
How to stop BOBJ 4.1 SP4 to not prompt for the latest JAVA update
Currently our my users are on a version of Java that is supported with BOBJ 4.1 SP4. Each time Java releases a new security update, users are being prompt to update Java to its latest version. We cannot go beyond this current version as it will bre