Sql Loader INFILE name value in table column Value
Hi,
Here is my Sql Loader Script
LOAD DATA
infile '%1'
APPEND INTO TABLE XX_SUPPLIER_UPD
FIELDS TERMINATED BY ";" OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
ACTION Char
,ADDRESS_TYPE Char
,REGION Char "LTRIM(RTRIM(:REGION))"
,PO_BOX Char
,,WWW_ADDRESS Char
,status Char "NVL(:status,'X')"
,filename Char "replace(:infile,'\"','')"
I am getting the infile name as the parameter and i want to insert that parameter value in the column name fillename. Can any one guide me to how to do.
Cheers!
Jayaraj.S
If you were to use external tables instead of SQL*Loader, you can dynamically change the location of the external table (i.e. the filename) using a simple ALTER TABLE statement.
External tables also mean that all the control is inside the database rather than relying on external utilities and external scripts.
;)
Similar Messages
-
SQL*Loader-418: Bad datafile datatype for column XMLDOC
Hi,
I am trying to load a xml document into a xmltype column in a table using SQL*Loader and I receive this error:
SQL*Loader-418: Bad datafile datatype for column XMLDOC
My ctl is:
LOAD DATA INFILE 'marginalpdbc_xml_20030529.xml'
APPEND INTO TABLE PRUEBA_CARGA
( XMLDOC LOBFILE (CONSTANT 'marginalpdbc_xml_20030529.xml')
TERMINATED BY EOF,
NOMBFICH CONSTANT 'marginalpdbc_xml_20030529.xml' )
And the table is:
create table prueba_carga (NOMBFICH VARCHAR2(200),xmldoc xmltype);
What is wrong with my ctl?
I am using SQL*Loader: Release 9.2.0.1.0 and Oracle9i Enterprise Edition Release 9.2.0.1.0
Thanks in advance.Looks like there is data which takes > 8 digits for the 'DTE_ADDED' column.
Plz check that first.
Can you provide a couple of lines of data for sampling ??? -
How i pass table column value to string variable or return to java applete
Hi Master,
How do I pass a table column value into string variable. See my code below:
import java.sql.*;
public class Waheed {
public Waheed() {
public static void main (String args [])
String s = "9 23 45.4 56.7";
System.out.println ("going for connection");
// DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select accid from accbal");
System.out.println ("going for connection");
while (rset.next())
s= rset.getString("accid"); this line give me error
System.out.println (rset.getString("accid"));
System.out.println (s);
catch(Exception e){
e.printStackTrace();
This line give me an error:
s= rset.getString("accid");
s is string variable
Plese give me an idea how I can pass accid in s variable.
Thanks.
AamirSee the code sample in the following thread (try using upeercase).
JDBC connection
Kuassi -
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> -
Popup is not getting launched click on command link in table column value
Hi
We have a scenario where we bring the pop-up clicking on command link in the table column value. It was working fine before but from last few labels this is not working.
Here is the code snippet that we are using,
<af:table>
<af:column>
<af:commandLink>
<af:outputText value=”product name” />
<af:showPopupBehavior TriggerType=”click” PopupId=”::p1”/>
<af:commandLink>
</af:column>
</table>
<af:popup id=”p1”>
<af:dialog>
</af:dialog>
</af:popup>
Thanks,
NageshIt is important to set partialSubmit="true" in the <af:commandLink> tag. A full submit will be made otherwise and the popup will not show. Use also tryggerType="action" instead of triggerType="click" and use the proper chararcter case of the tag attribute names. Try with this:
<af:commandLink text="product name" partialSubmit="true">
<af:showPopupBehavior popupId="::p1" triggerType="action"/>
</af:commandLink>Dimitar -
I am not able to read the xslt table column value.
Hi,
I have the scenario like this.
I have two irpt pages first.irpt and second.irpt and saperate xslt tables for each page and common js file for two pages.
when I click on first.irpt page xslt table row that opens the second.irpt as a popup window then I click on the column in second.irpt xslt row after that column value should be inserted in to first.irpt xslt table column.
In above I have done everything except I am not able to update the first.irpt xslt table column as Even I am not able to read that value.
For your reference:
/* This function will be called when we select the row in first.irpt xslt table here SelectBatch_b.irpt means second.irpt
function getBatch(row)
var id=row;
var material=document.getElementById('Material_'+row).value;
var location=document.getElementById('StoreLoc_'+row).value;
var plant=1000;
var strUrl = "SelectBatch_b.irpt";
strUrl = "?plant="plant"&""location="location"&""material="material;
window.open (strUrl,"mywindow");
/*This function will be called when we select the row in second.irpt (SelectBatch_b.irpt)
function getBatchID(row)
var Batch=document.getElementById('Batch_'+row).value; // reading second.irpt xslt table column value
document.getElementById('Batchc1').value=Batch; // reading first.irpt xslt table column value and inserting.
window.close(); // here I am getting error like object expected.
Please help me in this .
Edited by: rajkumar12345 on Feb 29, 2012 1:45 PMHi Rajkumar,
Please find below the method to pass the variable back and forth in .irpt page.
First Page:
var Toaccessinchildpage = "value";
function getBatch(row)
var id=row;
var material=document.getElementById('Material_'+row).value;
var location=document.getElementById('StoreLoc_'+row).value;
var plant=1000;
var strUrl = "SelectBatch_b.irpt";
strUrl += "?plant="plant"&"+"location="location"&"+"material="+material;
window.open (strUrl,"mywindow");
function populate(strBatch)
document.getElementById('Batchc1').value=strBatch;
Second Page:
function getBatchID(row)
var Batch=document.getElementById('Batch_'+row).value;
window.opener.populate(Batch);
window.close();
You have to call parent page function from child page.
No need to use common js.
If you want to access variable from parent page use
window.opener.<variable name>.
Example
window.opener.Toaccessinchildpage
You have to declare that variable as global variable in Parent page js file.
Refer First page code.
Regards,
Selva -
Hello all,
I am getting error while running below sql loader command...
load data
infile *
into TABLE AP_SUPPLIER_SITES_INT
REPLACE
fields terminated by ","
OPTIONALLY ENCLOSED BY '"'
VENDOR_INTERFACE_ID expression "to_char('select VENDOR_INTERFACE_ID from AP_SUPPLIERS_INT where CUSTOMER_NUM=:CUSTOMER_NUM')",
VENDOR_SITE_INTERFACE_ID "to_char(ap_supplier_sites_int_s.NEXTVAL)",
LAST_UPDATE_DATE "SYSDATE",
LAST_UPDATED_BY,
VENDOR_SITE_CODE,
CREATION_DATE "SYSDATE",
CREATED_BY,
PURCHASING_SITE_FLAG,
PAY_SITE_FLAG,
ADDRESS_LINE1,
ADDRESS_LINE2,
ADDRESS_LINE3,
CITY,
STATE,
ZIP,
COUNTRY,
PHONE,
FAX,
PAYMENT_METHOD_LOOKUP_CODE,
TERMS_ID,
CREATE_DEBIT_MEMO_FLAG,
HOLD_UNMATCHED_INVOICES_FLAG,
EMAIL_ADDRESS,
MATCH_OPTION,
EXCLUDE_FREIGHT_FROM_DISCOUNT,
INVOICE_CURRENCY_CODE,
PAYMENT_CURRENCY_CODE,
COUNTRY_OF_ORIGIN_CODE,
FREIGHT_TERMS_LOOKUP_CODE,
PAY_GROUP_LOOKUP_CODE,
PAY_DATE_BASIS_LOOKUP_CODE,
ALWAYS_TAKE_DISC_FLAG,
ORG_ID)
begindata
1005,,SYSDATE,1132,Test MA Site_1,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120
Log file:
Table "AP"."AP_SUPPLIER_SITES_INT", loaded from every logical record.
Insert option in effect for this table: REPLACE
Column Name Position Len Term Encl Datatype
VENDOR_INTERFACE_ID EXPRESSION
SQL string for column : "to_char('select VENDOR_INTERFACE_ID from AP_SUPPLIERS_INT where CUSTOMER_NUM=:CUSTOMER_NUM')"
VENDOR_SITE_INTERFACE_ID FIRST * , O(") CHARACTER
SQL string for column : "to_char(ap_supplier_sites_int_s.NEXTVAL)"
LAST_UPDATE_DATE NEXT * , O(") CHARACTER
SQL string for column : "SYSDATE"
LAST_UPDATED_BY NEXT * , O(") CHARACTER
VENDOR_SITE_CODE NEXT * , O(") CHARACTER
CREATION_DATE NEXT * , O(") CHARACTER
SQL string for column : "SYSDATE"
CREATED_BY NEXT * , O(") CHARACTER
PURCHASING_SITE_FLAG NEXT * , O(") CHARACTER
PAY_SITE_FLAG NEXT * , O(") CHARACTER
ADDRESS_LINE1 NEXT * , O(") CHARACTER
ADDRESS_LINE2 NEXT * , O(") CHARACTER
ADDRESS_LINE3 NEXT * , O(") CHARACTER
CITY NEXT * , O(") CHARACTER
STATE NEXT * , O(") CHARACTER
ZIP NEXT * , O(") CHARACTER
COUNTRY NEXT * , O(") CHARACTER
PHONE NEXT * , O(") CHARACTER
FAX NEXT * , O(") CHARACTER
PAYMENT_METHOD_LOOKUP_CODE NEXT * , O(") CHARACTER
TERMS_ID NEXT * , O(") CHARACTER
CREATE_DEBIT_MEMO_FLAG NEXT * , O(") CHARACTER
HOLD_UNMATCHED_INVOICES_FLAG NEXT * , O(") CHARACTER
EMAIL_ADDRESS NEXT * , O(") CHARACTER
MATCH_OPTION NEXT * , O(") CHARACTER
EXCLUDE_FREIGHT_FROM_DISCOUNT NEXT * , O(") CHARACTER
INVOICE_CURRENCY_CODE NEXT * , O(") CHARACTER
PAYMENT_CURRENCY_CODE NEXT * , O(") CHARACTER
COUNTRY_OF_ORIGIN_CODE NEXT * , O(") CHARACTER
FREIGHT_TERMS_LOOKUP_CODE NEXT * , O(") CHARACTER
PAY_GROUP_LOOKUP_CODE NEXT * , O(") CHARACTER
PAY_DATE_BASIS_LOOKUP_CODE NEXT * , O(") CHARACTER
ALWAYS_TAKE_DISC_FLAG NEXT * , O(") CHARACTER
ORG_ID NEXT * , O(") CHARACTER
value used for ROWS parameter changed from 64 to 31
Record 1: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
ORA-01722: invalid number
Please guide me what could be an issue...
Is there any other way to pass function in sql loader..
Thanks and Regards
MuthukumarI created function like below...... retrun value as number
create or replace function VDR_INF_F(V_NUM number)
return number is
VDR_INF_id AP_SUPPLIERS_INT.VENDOR_INTERFACE_ID%type;
begin
select VENDOR_INTERFACE_ID
into VDR_INF_id
from AP_SUPPLIERS_INT
where CUSTOMER_NUM = V_NUM;
return VDR_INF_id;
end;
And attached that into loader program...
load data
infile *
into TABLE AP_SUPPLIER_SITES_INT
REPLACE
fields terminated by ","
OPTIONALLY ENCLOSED BY '"'
VENDOR_SITE_INTERFACE_ID "to_char(ap_supplier_sites_int_s.NEXTVAL)",
LAST_UPDATE_DATE "SYSDATE",
LAST_UPDATED_BY,
VENDOR_SITE_CODE,
CREATION_DATE "SYSDATE",
CREATED_BY,
PURCHASING_SITE_FLAG,
PAY_SITE_FLAG,
ADDRESS_LINE1,
ADDRESS_LINE2,
ADDRESS_LINE3,
CITY,
STATE,
ZIP,
COUNTRY,
PHONE,
FAX,
PAYMENT_METHOD_LOOKUP_CODE,
TERMS_ID,
CREATE_DEBIT_MEMO_FLAG,
HOLD_UNMATCHED_INVOICES_FLAG,
EMAIL_ADDRESS,
MATCH_OPTION,
EXCLUDE_FREIGHT_FROM_DISCOUNT,
INVOICE_CURRENCY_CODE,
PAYMENT_CURRENCY_CODE,
COUNTRY_OF_ORIGIN_CODE,
FREIGHT_TERMS_LOOKUP_CODE,
PAY_GROUP_LOOKUP_CODE,
PAY_DATE_BASIS_LOOKUP_CODE,
ALWAYS_TAKE_DISC_FLAG,
ORG_ID,
VENDOR_INTERFACE_ID expression "VDR_INF_F(':CUSTOMER_NUM')"
begindata
1005,,SYSDATE,1132,Test MA Site_1,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1005
1005,,SYSDATE,1132,Test MA Site_2,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1005
1005,,SYSDATE,1132,Test MA Site_3,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1005
1006,,SYSDATE,1132,Test1 M Site_1,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1006
1007,,SYSDATE,1132,Test1 B Site_1,SYSDATE,1132,Y,Y,No#907 62nd Street ,10th Sector,KK Nagar,Chennai,TamilNadu,600078,IN,+91 44 33333333,044 40404040,CHECK,10000,Y,N,[email protected],R,Y,INR,INR,IN,TBD,STANDARD,DISCOUNT,Y,120,1007
Even now sql loader giving same error..
like below.....
able "AP"."AP_SUPPLIER_SITES_INT", loaded from every logical record.
Insert option in effect for this table: REPLACE
Column Name Position Len Term Encl Datatype
VENDOR_SITE_INTERFACE_ID FIRST * , O(") CHARACTER
SQL string for column : "to_char(ap_supplier_sites_int_s.NEXTVAL)"
LAST_UPDATE_DATE NEXT * , O(") CHARACTER
SQL string for column : "SYSDATE"
LAST_UPDATED_BY NEXT * , O(") CHARACTER
VENDOR_SITE_CODE NEXT * , O(") CHARACTER
CREATION_DATE NEXT * , O(") CHARACTER
SQL string for column : "SYSDATE"
CREATED_BY NEXT * , O(") CHARACTER
PURCHASING_SITE_FLAG NEXT * , O(") CHARACTER
PAY_SITE_FLAG NEXT * , O(") CHARACTER
ADDRESS_LINE1 NEXT * , O(") CHARACTER
ADDRESS_LINE2 NEXT * , O(") CHARACTER
ADDRESS_LINE3 NEXT * , O(") CHARACTER
CITY NEXT * , O(") CHARACTER
STATE NEXT * , O(") CHARACTER
ZIP NEXT * , O(") CHARACTER
COUNTRY NEXT * , O(") CHARACTER
PHONE NEXT * , O(") CHARACTER
FAX NEXT * , O(") CHARACTER
PAYMENT_METHOD_LOOKUP_CODE NEXT * , O(") CHARACTER
TERMS_ID NEXT * , O(") CHARACTER
CREATE_DEBIT_MEMO_FLAG NEXT * , O(") CHARACTER
HOLD_UNMATCHED_INVOICES_FLAG NEXT * , O(") CHARACTER
EMAIL_ADDRESS NEXT * , O(") CHARACTER
MATCH_OPTION NEXT * , O(") CHARACTER
EXCLUDE_FREIGHT_FROM_DISCOUNT NEXT * , O(") CHARACTER
INVOICE_CURRENCY_CODE NEXT * , O(") CHARACTER
PAYMENT_CURRENCY_CODE NEXT * , O(") CHARACTER
COUNTRY_OF_ORIGIN_CODE NEXT * , O(") CHARACTER
FREIGHT_TERMS_LOOKUP_CODE NEXT * , O(") CHARACTER
PAY_GROUP_LOOKUP_CODE NEXT * , O(") CHARACTER
PAY_DATE_BASIS_LOOKUP_CODE NEXT * , O(") CHARACTER
ALWAYS_TAKE_DISC_FLAG NEXT * , O(") CHARACTER
ORG_ID NEXT * , O(") CHARACTER
VENDOR_INTERFACE_ID EXPRESSION
SQL string for column : "VDR_INF_F(':CUSTOMER_NUM')"
value used for ROWS parameter changed from 64 to 31
Record 1: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
ORA-01722: invalid number
Record 2: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
ORA-01722: invalid number
Record 3: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
ORA-01722: invalid number
Record 4: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
ORA-01722: invalid number
Record 5: Rejected - Error on table "AP"."AP_SUPPLIER_SITES_INT", column VENDOR_INTERFACE_ID.
ORA-01722: invalid number
Please guide me, how to clear this issue?
Thanks and Regards,
Muthu -
SQL*Loader- Records Rejected - Error on table ORA-01722: invalid number
Getting the following errors :
Please tell me where I am going wrong?
Attached is the log file and snippets of datafile along with the control file !!
Also please direct me how can i upload 4900 records at one go?
SQL*Loader: Release 11.1.0.7.0 - Production on Fri Oct 14 03:06:06 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Control File: sample.ctl
Data File: Cities.csv
Bad File: Cities.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table CITY, loaded from every logical record.
Insert option in effect for this table: INSERT
Column Name Position Len Term Encl Datatype
ID FIRST * , CHARACTER
NAME NEXT 35 , ' CHARACTER
COUNTRYCODE NEXT 3 , ' CHARACTER
POPULATION NEXT * WHT CHARACTER
Record 1: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 2: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 3: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 4: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 5: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 6: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 7: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 8: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 9: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 10: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 11: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 12: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 13: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 14: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 15: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 16: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 17: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 18: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 19: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 20: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 21: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 22: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 23: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 24: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 25: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 26: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 27: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 28: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 29: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 30: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 31: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 32: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 33: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 34: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 35: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 36: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 37: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 38: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 39: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 40: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 41: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 42: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 43: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 44: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 45: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 46: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 47: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 48: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 49: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 50: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
Record 51: Rejected - Error on table CITY, column POPULATION.
ORA-01722: invalid number
MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
Table CITY:
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: 35840 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 Oct 14 03:06:06 2011
Run ended on Fri Oct 14 03:06:12 2011
Elapsed time was: 00:00:06.18
CPU time was: 00:00:00.03
my control file (sample.ctl):
load data infile 'Cities.csv'
into table city
fields terminated by ','
(id integer external,
name char(35) enclosed by "'",
countrycode char(3) enclosed by "'",
population integer external terminated by '\n'
my datafile (Cities.csv) (it contains 4900 records, but I am showing here just 4 records for ease)
3830,'Virginia Beach','USA',425257
3831,'Atlanta','USA',416474
3832,'Sacramento','USA',407018
3833,'Oakland','USA',399484
Thanks in advance!!Look that when I change a little bit your datafile as follows
1,'Kabul','AFG',1780000
2,'Qandahar','AFG','237500'
3,'Herat','AFG','186800' I got the same error (2 last rows rejected for the same error invalid number)
mhouri > select * from cities;
ID NAME COU POPULATION
1 Kabul AFG 1780000
SQL*Loader: Release 10.2.0.3.0 - Production on Fri Oct 14 10:38:06 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: cities.ctl
Data File: cities.dat
Bad File: cities.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table CITIES, loaded from every logical record.
Insert option in effect for this table: INSERT
Column Name Position Len Term Encl Datatype
ID FIRST * , CHARACTER
NAME NEXT 35 , ' CHARACTER
COUNTRYCODE NEXT 3 , ' CHARACTER
POPULATION NEXT * WHT CHARACTER
Record 4: Rejected - Error on table CITIES, column ID.
Column not found before end of logical record (use TRAILING NULLCOLS)
Record 2: Rejected - Error on table CITIES, column POPULATION.
ORA-01722: invalid number
Record 3: Rejected - Error on table CITIES, column POPULATION.
ORA-01722: invalid number
Table CITIES:
1 Row successfully loaded.
3 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: 35840 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 4
Total logical records rejected: 3
Total logical records discarded: 0
Run began on Fri Oct 14 10:38:06 2011
Run ended on Fri Oct 14 10:38:06 2011
Elapsed time was: 00:00:00.23
CPU time was: 00:00:00.09Population value within the data file should be a number
Best regards
Mohamed Houri -
Sql Loader - Decimal numbers showing in null column
Greetings,
My apologies if this is in the wrong forum section. It seemed to be the most logical.
I have added new column to a control file used in a sql loader upload and I am getting unexpected results. Long story short, I copy foxpro tables from a network directory to my local pc. A foxpro exe converts these tables to .dat files. Sql loader then uploads the .dat files to matching oracle tables. I've run this program from my pc for years with no problems.
Problem now: We added a new column to a foxpro table and to the matching oracle table. This column in FoxPro in null for now - no data at all. I then added the new column to my ctl file for this table. The program runs, sql loader does it's thing with no errors. However, in the new field in Oracle, I'm finding decimal numbers in many of the records, when all records should have null values in this field. I've checked all other columns in the oracle table and the data looks accurate. I'm not sure why I'm getting these decimal values in the new column.
My log and bad files show no hints of any problems. The bad file is empty for this table.
At first I thought the positioning of the new column in the fox table, .ctl file and the oracle table were not lining up correctly, but I checked and they are.
I've double checked the FoxPro table and all records for this new column are null.
I'm not sure what to check for next or what to test. I am hoping someone in this forum might lend a clue or has maybe seen this problem before. Below is my control file. The new column is the last one: fromweb_id. It is a number field in both FoxPro and Oracle.
Thanks for any advise.
JOBS table control file:
load data
infile 'convdata\fp_ora\JOBS.dat' "str X'08'"
into table JOBS
fields terminated by X'07'
TRAILING NULLCOLS
(SID,
CO_NAME "replace(replace(:CO_NAME,chr(11),chr(10)),chr(15),chr(13))",
JOB_TITLE "replace(replace(:JOB_TITLE,chr(11),chr(10)),chr(15),chr(13))",
CREDITS,
EARN_DATE date "mm/dd/yyyy",
COMMENTS CHAR(2000) "replace(replace(:COMMENTS,chr(11),chr(10)),chr(15),chr(13))",
DONT_SHOW,
PC_SRC "replace(replace(:PC_SRC,chr(11),chr(10)),chr(15),chr(13))",
PC_SRC_NO,
SALARY,
SALFOR,
ROOM,
BOARD,
TIPS,
UPD_DATE date "mm/dd/yyyy hh12:mi:ss am",
STUKEY,
JOBKEY,
JO_COKEY,
JO_CNKEY,
JO_ZUKEY,
EMPLID,
CN_NAME "replace(replace(:CN_NAME,chr(11),chr(10)),chr(15),chr(13))",
JOB_START date "mm/dd/yyyy",
JOB_END date "mm/dd/yyyy",
FROMWEB_ID)I apologize for not explaining how this was resolved. Sql Loader was working as it should.
The problem was due to new fields being added to the FoxPro table, along with the fromweb_id column, that I was not informed about. I was asked to add a column named fromweb_id to the oracle jobs table and to the sql-loader program. I was not told that there were other columns added at the same time. In the foxpro table, the fromweb_id column was the last column added.
The jobs.dat file contained data from all columns in the foxpro table, including all the new columns. I only added the "fromweb_id" to the control file, which is what I was asked to do. When it ran, it was getting values from one of the new columns and the values were being uploaded into the fromweb_id column in Oracle. It is that simple.
When I had checked the FoxPro table earlier, I did not pickup on the other new columns. I was focussing in on looking for values in the fromweb_id column. When back-tracing data in the jobs.dat file, I found a value in the fromweb_id column that matched a value in a differnt column (new column) in FoxPro. That is when I realized the other new columns. I instantly knew what the problem was.
Thanks for all the feedback. I'm sorry if this was an inconvenience to anyone. I'll try to dig a little deeper next time. Lessons learned...
regards, -
Way to generate sql*loader ctl file from a table?
I'm an oracle newbie. (Oracle 8i, HP Unix)Is there any way to take an existing table
description and generate a sql*loader control file from it? If anyone has already written a procedure or knows where one can be found I'd really appreciate it. We're doing a mass conversion to oracle and would like an easy way to re-write all our loads.
Thanks! Eileen from Polaroid.Hi,
I have shell program, which will get column names from system table and create temp. control file and call sqlloader exe. and load the data automatically.
You can customise this file, according to your needs.
Shell Program
if [ $# -ne 2 ]
then
echo " Usage : $0 table_name flat file name"
exit
fi
#assigning envir. variable to unix variables
table_name=$1
flat_file=$2
#creating the control file
echo "LOAD DATA" > $table_name.ctl
echo "INFILE '$flat_file'" >> $table_name.ctl
echo "into table $table_name " >> $table_name.ctl
echo "fields terminated by '\t'" >> $table_name.ctl
#calling functions for making column name part
#describing the table and spooling into file
sqlplus -s $CUST_ORA_USER << sql_block
spool $table_name.lst
desc $table_name
spool off
sql_block
# creating suitable file and add the feilds into control file
# cutting the first line (headings)
tail +3 $table_name.lst > temp
rm -f $table_name.lst
k=`wc -l < temp`
k1=`expr $k - 1`
#cutting the last line
head -$k1 temp > tempx
record_count=`wc -l < tempx`
counter=1
echo "(" > wxyz.ctl
# reading file line by line
cat tempx | while in_line=`line`
do
#cutting the first field
field_name=`echo $in_line | cut -f1 -d' '`
#calculating the no of characters
word_cnt=`echo $in_line | wc -w`
#calculating count in a line
if [ $word_cnt = 2 ]
then
data_type=`echo $in_line | cut -f2 -d' ' | cut -f1 -d'('`
if [ "$data_type" = "DATE" ]
then
data_fmt="DECODE(LENGTH(LTRIM(RTRIM(:$field_name))),'11',to_date(ltrim(rtrim(:$field_name)),'dd-mon-yyyy'),'9',to_date(ltrim(rtrim(:$field_name)),'dd-mm-yy'),'10',to_date(ltrim(rtr im(:$field_name)),'dd-mon-yy'),'yyyy/mm/dd hh24:mi:ss')"
elif [ "$data_type" = "CHAR" ]
then
data_fmt="NVL(RTRIM(LTRIM(:$field_name)),' ')"
elif [ "$data_type" = "VARCHAR2" ]
then
data_fmt="NVL(RTRIM(LTRIM(:$field_name)),' ')"
else
data_fmt="NVL(:$field_name,0) "
fi
else
data_type=`echo $in_line | cut -f4 -d' ' | cut -f1 -d'('`
if [ "$data_type" = "DATE" ]
then
data_fmt="DECODE(LENGHTH(LTRIM(RTRIM(:$field_name))),'11',to_date(ltrim(rtrim(:$field_name)),'dd-mon-yyyy'),'9',to_date(ltrim(rtrim(:$field_name)),'dd-mm-yy'),'10',to_date(ltrim(rt rim(:$field_name)),'dd-mon-yy'),'yyyy/mm/dd hh24:mi:ss')"
elif [ "$data_type" = "CHAR" ]
then
data_fmt="NVL(RTRIM(LTRIM(:$field_name)),' ')"
elif [ "$data_type" = "VARCHAR2" ]
then
data_fmt="NVL(RTRIM(LTRIM(:$field_name)),' ')"
else
data_fmt="NVL(:$field_name,0) "
fi
fi
#if last line put );
#else ,
if test $record_count -eq $counter
then
echo $field_name \"$data_fmt\"");" >> wxyz.ctl
else
echo $field_name \"$data_fmt\""," >> wxyz.ctl
fi
#counter increamenting for each record
counter=`expr $counter + 1`
done
#removing the file
rm -f temp tempx
cat wxyz.ctl >> $table_name.ctl
rm -f x.ctl
#calling the SQLLOADER
SQLLDR $CUST_ORA_USER CONTROL=$table_name.ctl ERROR=99999999
#removing the control file
rm -f $table_name.ctl -
Using SQL Loader in more than one table
Hi all,
I have a new question for those who have used SQL Loader. I
have never used it and I just know that I need a control file to
tell SQL Loader what is my flat file layout and what table the
information goes to. My problem is: my flat file has information
that goes to two tables in my schema. Those files are very big
(aprox 280Mb) and I would like to read them just once. Can I do
this with SQL Loader?
Other question, is that the fastest way to import data from
flat files becouse I am using PERL and it takes aprox. 9 hours
to import 10 of those files. I could use UTL_FILE to read it but
I heard that SQL Loader was better.
Thanks for your cooperation
(Robocop)
Marcelo Lopes
Rio de Janeiro - BrazilSQL*Loader is the fastest way to load, particularly in direct parallel mode, and can certainly load to multiple tables.
>
My advice would be to have a look at the examples given in the Oracle Utilities guide, there is one for loading to multiple
tables, which I have pasted below.
>
-- Loads EMP records from first 23 characters
-- Creates and loads PROJ records for each PROJNO listed
-- for each employee
LOAD DATA
INFILE ’ulcase5.dat’
BADFILE ’ulcase5.bad’
DISCARDFILE ’ulcase5.dsc’
REPLACE
INTO TABLE emp
(empno POSITION(1:4) INTEGER EXTERNAL,
ename POSITION(6:15) CHAR,
deptno POSITION(17:18) CHAR,
mgr POSITION(20:23) INTEGER EXTERNAL)
INTO TABLE proj
-- PROJ has two columns, both not null: EMPNO and PROJNO
WHEN projno != ’ ’
(empno POSITION(1:4) INTEGER EXTERNAL,
projno POSITION(25:27) INTEGER EXTERNAL) -- 1st proj
INTO TABLE proj
WHEN projno != ’ ’
(empno POSITION(1:4) INTEGER EXTERNAL,
projno POSITION(29:31 INTEGER EXTERNAL) -- 2nd proj
INTO TABLE proj
WHEN projno != ’ ’
(empno POSITION(1:4) INTEGER EXTERNAL,
projno POSITION(33:35) INTEGER EXTERNAL) -- 3rd proj
see the documentation for a complete explanation of the configuration.
Thanks, I will read it. -
How can we tell if SQL*Loader is working on a TABLE?
We have a process that requires comparing batches with LDAP information. Instead of using an LDAP lookup tool, we get a nightly directory file, and import the two COLUMNs we want via SQL*Loader (REPLACE) into an IOT. Out of three cases, two just check the first COLUMN, and the third needs the second COLUMN as well.
We did not think of using External TABLEs, because we cannot store files on the DB server itself.
The question arises, what to do while the file is being imported. The file is just under 300M, so it takes a minute or so to replace all the data. We found SQL*Loader waits until a transaction is finished before starting, but a query against the TABLE only waits while it is actually importing the data. At the beginning of SQL*Loader's process, however, a query against the TABLE returns no rows.
The solution we are trying right now is, to have the process that starts SQL*Loader flip a flag in another TABLE denoting that it is unavailable. When it is done, it flips it back, and notes the date. Then, the process that queries the information, exits if the flag is currently 'N'.
The problem, is, what if SQL*Loader starts inbetween the check of the flag, and the query against the TABLE. How do we guarantee that it is still not being imported.
I can think of three solutions:
1) LOCK the ldap information TABLE before checking the flag.
2) LOCK the record that the process starting SQL*Loader flips.
3) Add a clause to the query against the TABLE checks that there are records in the TABLE (AND EXISTS(SELECT * FROM ldap_information).
The problem with 3) is that the process has already tagged the batches (via a COLUMN). It could, technically reset them afterwards, but that seems a bit backwards.Just out of curiosity, are you aware that Oracle supplies a DBMS_LDAP package for pulling information from LDAP sources? It would obviously be relatively easy to have a single transaction that deletes the existing data, loads the new data via DBMS_LDAP, and commits, which would get around the problem you're having with SQL*Loader truncating the table.
You could also have SQL*Loader load the data into a staging table and then have a second process either MERGE the changes from the staging table into the real table (again in a transactionally consistent manner) or just delete and insert the data.
Justin -
SQL LOADER / INFILE filename as variable in .ctl file
I stumbled over several threads in the OTN-forums regarding this problem, but neither was it finaly solved nor did I find a FAQ that answered my question. Soooo:
We get several datafiles from several sources and process them via SQL Loader and store 'em in the DB.
This is done via a CHRON job and a PERL skript, for all datafiles in a specific directory.
We need the information which file on which date generated the data INSIDE the DB as well.
So I want to store the filename || SYSDATE combination as well.
I know, I could parse the .ctl file and replace a key-string with the actual filename and so have it in the input.
But this seems a bit dirty to me. Isn't there some way, i.e. a keyword or variable for the infile-filename within the SQLLoader that I can access in the .ctl file? Something like:
INTO TABLE processed_files
FIELDS TERMINATED BY ';'
WHEN LOWER(LTRIM(RTRIM(hdr_ftr))) = 'ftr' -- FOOTER??
(hdr_ftr VARCHAR2(100),
source INFILE||' on '||TO_CHAR(SYSDATE, 'MM/DD/YYYY'),
realm VARCHAR2(100),
version VARCHAR2(20)
I would be greatfull if you?d share your wisdom with me. ;-))
OliverI passed this quite similar to 'Ask Tom' and got the advice to put the .ctl's content as a string variable into a Shell skript.
This shell skript (which had to be written anyway to loop over the datafiles an subsequently call the sqlldr) should then replace the INFILE parameter and the CONSTANTs for the filenames and generate a 'temporarry' .ctl before calling sqlldr!
That's it, no better and safer way! -
Calculating a count of rows where value matches another column value in the same table
Hi,
I'm struggling to do something in DAX that seems to me should be super easy (coming from a SQL world)!
That is to count all rows in column 1 where the value matches the current value for column 1?
E.g something like this:
[Col2]=Count of rows in [Col1] where value = this.[Col1]
Where the results are as in the table below:
Col1, Col2
A, 2
A, 2
B, 1
Anyone?
Martin Laukkanen
Nearbaseline blog - nearbaseline.com/blog
Bulk Edit and other Apps - nearbaseline.com/appsThanks, that's perfect!
I knew it had to be something so simple, but after spending over an hour banging my head against those exact functions I couldn't get anything working!
Martin Laukkanen
Nearbaseline blog - nearbaseline.com/blog
Bulk Edit and other Apps - nearbaseline.com/apps -
SQL*LOADER control file for Multiple Tables
Dear DBA's
I am loading data throgh SQL*LOADER in Oracle. I have some problem, While
Inserting data into multiple table I have created single Control file in
following way which is giving me error, Data is stored in seprate fileswith
tablename.dat, So each tables data is stored in seprate .DAT file. So Iwant to
insert data from single control file taking data from .dat multiple files into
multiple tables. Is it possible?? or some different method
Please help me as early as possiable.
Thanks & Regards
Shailesh
CREATE TABLE T1 (
L1 VARCHAR2(10),
L2 NUMBER(10),
L4 NUMBER(10),
MYDATE DATE);
CREATE TABLE T2 (
L1 VARCHAR2(10),
L2 NUMBER(10),
L3 LONG,
L4 NUMBER(10),
MYDATE DATE)
CONTROL FILE :-
UNRECOVERABLE LOAD DATA
INFILE 't2.dat'
INSERT INTO TABLE t2
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
( l1 char,l2 char,l4 char,mydate date,l3 char(2000000))
INFILE 't1.dat'
INSERT INTO TABLE t1
FIELDS TERMINATED BY ','
OPTIONALLYENCLOSED BY '"'
TRAILING NULLCOLS
( f1 char,f2 char,f4 char))
T2.DAT
Raju,14,1,09-NOV-2000,"Has a powerful data parsing,engine which putslittle
limitation on the format of the data in thedatafile."
Manu,14,2,09-NOV-2000,"Can load data from multiple datafiles, during the same
load session. "
T1.DAT
Raj,14,1,09-NOV-2000
Mau,14,2,09-NOV-2000
nullHi,
I tried to use your control file and got numerous erros.
try using seperate control files:
T1.CTL:
LOAD DATA
INFILE 'D:\T2.dat'
INSERT INTO TABLE t2
( l1 char,l2 char,l4 char,mydate date,l3 char(20000))
T2.CTL
LOAD DATA
INFILE 'D:\T1.dat'
INSERT INTO TABLE t1
( l1 char,l2 char,l4 char,mydate date)
Maybe you are looking for
-
Steps to connect a CRM system with MDM
Hi everybody, I've got a problem here : I should build a connection between a CRM system and MDM (get the data in several tables in the CRM system, normalize them in MDM and then put them back in the CRM). What would the steps I've got to do to achie
-
Issues playing video through USB on 58M9363D 4k TV
Hi there, I recently purchased the 4k 58M9363D and I am loving it so far. However I do have some serious issues with playing video from both USB and through my pc. They do ruin the experience at the moment and hopefully they can be fixed. So here goe
-
Iweb '08 - frustration with missing content
if anyone can help me, i am slowing going crazy with the frustrations that i have had since i upgraded to iweb 08 about 2 weeks ago. firstly i have had to rebuild my website twice, as the domain file didn't exist at that point. so my issue is this -
-
How to unblock Sales orders(More than 1000 sales orders)
Hi Gurus, We are facing the problem that because of weight issue-1000 sales orders are blocked.One authorised perso is ther to unblock it.But has all 1000 orders in his mail inbox. To un block all orders it will take much time. Is it there any T.Code
-
Dear Guys I have to pick documents from BSEG on the basis of VALUT. Its taking too much time, is there any way to improve the query access on BSEG.