Record-number from SQL Loader
Hello All,
Is there a way I can add line-number/record-number into my tables. For example if my input file has 10 records, I want 10 rows with record_number=1-10?
Need your help!
Thanks
Maybe (s)he wasn't referring to "sequence" the database object ... rather, the "sequence" parameter for SQL*Loader.
Anyway, I think you need RECNUM ... search the doco for "RECNUM" ... close by you'll find explanation on what "SEQUENCE", the SQL*Loader parameter, does too.
Similar Messages
-
How to validate data is in specific list while loading from SQL*Loader
I have a sample data file like below
1,name1,05/02/2012 10:00:00,blue
2,name2,06/02/2012 10:00:00,red
3,name3,07/02/2012 10:00:00,yellow
4,name4,08/02/2012 10:00:00,white
I would like to validate 4Th column to be a valid color (ie) All color should be in a specific list, if it is not in the lis then the record should do to bad/discard file
How can do that while loading Data From SQL*Loader?user8860934 wrote:
I have a sample data file like below
1,name1,05/02/2012 10:00:00,blue
2,name2,06/02/2012 10:00:00,red
3,name3,07/02/2012 10:00:00,yellow
4,name4,08/02/2012 10:00:00,white
I would like to validate 4Th column to be a valid color (ie) All color should be in a specific list, if it is not in the lis then the record should do to bad/discard file
How can do that while loading Data From SQL*Loader?Probably a lot easier with an EXTERNAL TABLE (they're much more flexible).
Is SQL Loader a mandatory requirement for some reason? -
Change the mapping generation code from sql*loader to pl/sql
I want to use a mapping with a flat file operator to generate pl/sql code even if a mapping generate sql*loader code as default.
I tried to change the Language generation property of the mapping but an API8548 error message is shown. The suggested solution by OWB is to change the language generation code in the property inspector of the mapping.
I can't use external table because I have to work with a remote machine.
What i have to do to change the generation code from SQL*Loader to PL/SQL?How about breaking this out into 2 mappings? In the first mapping, map a flat file operator to an table using SQL*Loader code. Then define a second mapping using the table as source and therefore generate PL/SQL. Then use process flow to launch the 2nd map to run after completion of first.
-
ORA-12899 error from function invoked from SQL*Loader
I am getting the above error when I call a function from my SQL*Loader script, and I am not seeing what the problem is. As far as I can see, there should be no problem with the field lengths, unless the length of the automatic variable within my function is somehow being set at 30? Here are the details (in the SQL*Loader script, the field of interest is the last one):
====
Error:
====
Record 1: Rejected - Error on table TESTM8.LET_DRIVE_IN_FCLTY, column DIF_CSA_ID.
ORA-12899: value too large for column "TESTM8"."LET_DRIVE_IN_FCLTY"."DIF_CSA_ID" (actual: 30, maximum: 16)
=======
Function:
=======
CREATE OR REPLACE FUNCTION find_MCO_id (di_oid_in DECIMAL)
RETURN CHAR IS mco_id CHAR;
BEGIN
SELECT AOL_MCO_LOC_CD INTO mco_id
FROM CONV_DI_FLCTY
WHERE DIF_INST_ELMNT_OID = di_oid_in;
RETURN TRIM(mco_id);
END;
==============
SQL*Loader Script:
==============
LOAD DATA
INFILE 'LET_DRIVE_IN_FCLTY.TXT'
BADFILE 'LOGS\LET_DRIVE_IN_FCLTY_BADDATA.TXT'
DISCARDFILE 'LOGS\LET_DRIVE_IN_FCLTY_DISCARDDATA.TXT'
REPLACE
INTO TABLE TESTM8.LET_DRIVE_IN_FCLTY
FIELDS TERMINATED BY '~' OPTIONALLY ENCLOSED BY '"'
DIF_DRIVE_IN_OID DECIMAL EXTERNAL,
DIF_FCLTY_TYPE_OID DECIMAL EXTERNAL NULLIF DIF_FCLTY_TYPE_OID = 'NULL',
DIF_INST_ELMNT_OID DECIMAL EXTERNAL,
DIF_PRI_PERSON_OID DECIMAL EXTERNAL NULLIF DIF_PRI_PERSON_OID = 'NULL',
DIF_SEC_PERSON_OID DECIMAL EXTERNAL NULLIF DIF_SEC_PERSON_OID = 'NULL',
DIF_CREATE_TS TIMESTAMP "yyyy-mm-dd-hh24.mi.ss.ff6",
DIF_LAST_UPDATE_TS TIMESTAMP "yyyy-mm-dd-hh24.mi.ss.ff6",
DIF_ADP_ID CHAR NULLIF DIF_ADP_ID = 'NULL',
DIF_CAT_CLAIMS_IND CHAR,
DIF_CAT_DIF_IND CHAR,
DIF_DAYLT_SAVE_IND CHAR,
DIF_OPEN_PT_TM_IND CHAR,
DIF_CSA_ID CONSTANT "find_MCO_id(:DIF_DRIVE_IN_OID)"
============
Table Definitions:
============
SQL> describe CONV_DI_FLCTY;
Name Null? Type
DIF_INST_ELMNT_OID NOT NULL NUMBER(18)
AOL_MCO_LOC_CD NOT NULL VARCHAR2(3)
SQL> describe LET_DRIVE_IN_FCLTY;
Name Null? Type
DIF_DRIVE_IN_OID NOT NULL NUMBER(18)
DIF_INST_ELMNT_OID NOT NULL NUMBER(18)
DIF_FCLTY_TYPE_OID NUMBER(18)
DIF_ADP_ID VARCHAR2(10)
DIF_CAT_DIF_IND NOT NULL VARCHAR2(1)
DIF_CAT_CLAIMS_IND NOT NULL VARCHAR2(1)
DIF_CSA_ID VARCHAR2(16)
DIF_DAYLT_SAVE_IND NOT NULL VARCHAR2(1)
DIF_ORG_ENTY_ID VARCHAR2(16)
DIF_OPEN_PT_TM_IND NOT NULL VARCHAR2(1)
DIF_CREATE_TS NOT NULL DATE
DIF_LAST_UPDATE_TS NOT NULL DATE
DIF_ITM_FCL_MKT_ID NUMBER(18)
DIF_PRI_PERSON_OID NUMBER(18)
DIF_SEC_PERSON_OID NUMBER(18)
=========================
Thanks for any help with this one!I changed one line of the function to:
RETURN CHAR IS mco_id VARCHAR2(16);
But I still get the same error:
ORA-12899: value too large for column "TESTM8"."LET_DRIVE_IN_FCLTY"."DIF_CSA_ID" (actual: 30, maximum: 16)
I just am not seeing what is being defined as 30 characters. Any ideas much appreciated! -
Importing to a Oracle Table from SQL Loader Fails
Hi ,
When I try to upload one xml file from my server to my table in oracle server using sql loader it fails at times.Some times it works perfectly.
This is a daily process which automatically dumps data to my oracle.
Please find the error log :
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Dec 5 04:07:32 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Control File: xmlFeedDelta.ctl
Data File: xmlFileNames_Delta.txt
Bad File: xmlFileNames_Delta.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 1000
Bind array: 50000 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table XMLFEEDDELTA, loaded from every logical record.
Insert option in effect for this table: APPEND
Column Name Position Len Term Encl Datatype
FILENAME FIRST 4000 , CHARACTER
FILECONTENT DERIVED * EOF CHARACTER
Dynamic LOBFILE. Filename in field FILENAME
value used for ROWS parameter changed from 50000 to 63
SQL*Loader-643: error executing INSERT statement for table XMLFEEDDELTA
ORA-03113: end-of-file on communication channel
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
Table XMLFEEDDELTA:
0 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 252378 bytes(63 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 1
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Thu Dec 05 04:07:32 2013
Run ended on Thu Dec 05 04:08:42 2013
Elapsed time was: 00:01:10.05
CPU time was: 00:00:00.28
My Control File Looks like this :
LOAD DATA
INFILE xmlFileNames_Delta.txt
INTO TABLE xmlFeedDelta APPEND
fields terminated by ','
filename CHAR(4000),
filecontent LOBFILE(filename) terminated by eof
My Database version :
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I am not sure why this is happening at times . Any help would be appreciated.Hi,
have you tried with the FILLER command like
LOAD DATA
INFILE xmlFileNames_Delta.txt
INTO TABLE xmlFeedDelta APPEND
fields terminated by ','
filename FILLER CHAR(4000),
filecontent LOBFILE(filename) terminated by eof -
Insert data file name into table from sql loader
Hi All,
I have a requirement to insert the data file name dynamically into table using sql loader.
Example:
sqlldr userid=username/passwword@host_string control=test_ctl.ctl data=test_data.dat
test_ctl.ctl
LOAD DATA
FILED TERMINATED BY ','
INTO TABLE test
(empid number,
ename varchar2(20),
file_name varchar2(20) ---------- This should be the data file name which can be dynamic (coming from parameter)
test_data.dat
1,test
2,hello
3,world
4,end
Please help..
Thanks in advance.
Regards
Anujyou'll probably have to write your control file on the fly, using a .bat or .sh file
rem ===== file : test.bat ========
rem
rem ============== in pseudo speak =============
rem
rem
echo LOAD DATA > test.ctl
echo FILED TERMINATED BY ',' >> test.ctl
echo INTO TABLE test >> test.ctl
echo (empid number, >> test.ctl
echo ename varchar2(20), >> test.ctl
echo file_name constant %1% >> test.ctl
echo ) >> test.ctl
rem
rem
rem
sqlldr userid=username/passwword@host_string control=test.ctl data=test_data.dat
rem =============== end of file test.bat =======================
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm#i1008664 -
How do i get a radio station number from itunes it only plays on the computer i can not down load the station number as it does not show one to my ipod
Which iPod?
iPod Manuals
iPod Models -
Record rejected using SQL*Loader
I'm not too sure why I'm getting the following error message:
Record 1: Rejected - Error on table LOAD_DATA, column CLIENT_NUMBER.
ORA-01401: inserted value too large for column
Here is my info:
Table def:
SQL> describe load_data
Name Null? Type
CLIENT_NUMBER NOT NULL VARCHAR2(4)
PROD_SER VARCHAR2(5)
FEE_TYPE VARCHAR2(5)
QUANTITY NUMBER(13,5)
ALLOC_CODE VARCHAR2(11)
PROCESS_DATE DATE
My control file def:
LOAD DATA
INFILE "DATA.DAT"
APPEND
INTO TABLE <schema>.LOAD_DATA
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(CLIENT_NUMBER CHAR,
PROD_SER CHAR,
FEE_TYPE CHAR,
QUANTITY "TO_NUMBER(:QUANTITY,'99999999.99999')",
ALLOC_CODE CHAR,
PROCESS_DATE "TO_DATE(:PROCESS_DATE, 'MMDDYYYY')")
Sample Data:
A348,04201,PR200,88,,01182007
A348,04201,PR200,9,,01192007
A348,04201,PR200,93,,01192007
Erorr Message:
Table LOAD_DATA, loaded from every logical record.
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
CLIENT_NUMBER FIRST * , CHARACTER
PROD_SER NEXT * , CHARACTER
FEE_TYPE NEXT * , CHARACTER
QUANTITY NEXT * , CHARACTER
SQL string for column : "TO_NUMBER(:QUANTITY,'99999999.99999')"
ALLOC_CODE NEXT * , CHARACTER
PROCESS_DATE NEXT * , CHARACTER
SQL string for column : "TO_DATE(:PROCESS_DATE, 'MMDDYYYY')"
Record 1: Rejected - Error on table LOAD_DATA, column CLIENT_NUMBER.
ORA-01401: inserted value too large for columnYour exact data and control file worked for me...
Table LOAD_DATA:
3 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
SQL> select * from load_data;
CLIE PROD_ FEE_T QUANTITY ALLOC_CODE PROCESS_DAT
A348 04201 PR200 88 18-JAN-2007
A348 04201 PR200 9 19-JAN-2007
A348 04201 PR200 93 19-JAN-2007 -
Populating a load-status table from SQL*Loader
Hello,
I am using SQL*LDR to load a table and once I'm done with this load I am supposed to populate a status table which will capture the 'SYSDATE', and the total number of rows I loaded in the other table.
Can anybody help me?
ThanksBTW, the load-status table would take the error-record-count as well as the load-count?
Sorry missed that earlier! -
Get records number from internal table with condition.
Internal table itab got more than 1000 records,now i need to get the number of records with condition that itab-field1 = 'XXXX'.
actully, i got an inefficient logic to count the number in a loop statement. is there better way to implement it?hello,
Every time assigning data into temp table and delete may that may not be much efficient. You can check in loop logic how much time is taken. You can check the below code. here I am trying to check the numbers of plant for for one material.
In this logic material is the first field. So if there is option to make the required field in to the 1 st position then it will be nice.
TYPES: BEGIN OF x_count,
matnr TYPE matnr,
count TYPE i,
BEGIN OF x_count.
DATA: i_marc TYPE STANDARD TABLE OF marc,
i_count TYPE STANDARD TABLE OF x_count,
wa_count TYPE x_count.
FIELD-SYMBOLS: <wa_marc> TYPE marc.
SELECT * UP TO 1000 ROWS
FROM marc
INTO TABLE i_marc.
IF sy-subrc = 0.
SORT i_marc BY matnr.
LOOP AT i_marc ASSIGNING <wa_marc>.
wa_count-count = wa_count-count + 1.
AT END OF matnr.
wa_count-matnr = <wa_marc>-matnr.
APPEND wa_count TO i_count.
ENDAT.
ENDLOOP.
ENDIF.
Thanks
Subhanakr -
Get the records number from internal table with conditon.
Internal table itab got more than 1000 records,now i need to get the number of records with condition that itab-field1 = 'XXXX'.
actully, i got an inefficient logic to count the number in a loop statement. is there better way to implement it?Hi,
One alternative solution, which may be useful for other parts of your program, is to have an aditional itab1 with a single column/field (field1), which acts like a index or shadow table, and which is filled simultaneously with itab. Then you can use DESCRIBE TABLE itab1 LINES lv_lines.
Atb -
Run SQL Loader script from Unix env
Hi,
We are using HP-UNIX server. The control file of SQL Loader is placed in oracle home\bin folder in the unix server. I created Executable for this SQL Loader control file in concurrent program and attached into a request group.
Then I ran it from a responsibility, I am getting the below error.
+-----------------------------
| Starting concurrent program execution...
+-----------------------------
SQL*Loader-350: Syntax error at line 16.
Expecting "," or ")", found "TIMESTAMP".
GL_DATE TIMESTAMP 'yyyy MM dd hh:MI:SS:AM',
^
SQL*Loader: Release 8.0.6.3.0 - Production on Sun Sep 5 15:28:45 2010
(c) Copyright 1999 Oracle Corporation. All rights reserved.
SQL*Loader-350: Syntax error at line 16.
Expecting "," or ")", found "TIMESTAMP".
GL_DATE TIMESTAMP 'yyyy MM dd hh:MI:SS:AM',
^
My Actual Control file is,
LOAD DATA
INFILE '/usr/........xyz.txt'
BADFILE '/usr/........xyz.bad'
DISCARDFILE '/usr/........xyz.dsc
APPEND
INTO TABLE gl_interface_stg
FIELDS TERMINATED BY "|" TRAILING NULLCOLS
GL_DATE TIMESTAMP 'yyyy MM dd hh:MI:SS:AM',
CATEGORY_NAME,
JOURNAL_DESCRIPTION,
JOURNAL_NAME,
BATCH_NAME,
BATCH_DESCRIPTION,
ACCOUNT_CODE,
PROCESSING_STATUS CONSTANT 'N'
If I run the above control file from my local machine (windows) using SQLLDR username/pwd @servername control='c:/abc.ctl' from the command prompt, then all the records from xyz.txt file pushed into staging table.
Where as, If I schedule the above control file and trying to run from a GL responsibility, I am getting the above error message.
Do I need to modify the control file scripts in order to run from UNIX environment?
Pls advice how to do it from UNIX environment.
Thanks in advance.Hi,
SQL*Loader-350: Syntax error at line 16.Please see if these docs help.
SQL*LOADER-350 SYNTAX ERROR [ID 1019271.102]
LDR-00350 TOKEN LONGER THAN MAX ALLOWABLE LENGTH ERROR WHEN LOADING ASCII FILE [ID 1020091.6]
Do I need to modify the control file scripts in order to run from UNIX environment?
Pls advice how to do it from UNIX environment.See these docs.
How to Use 9i or 10g Features in SQL*Loader for Apps? [ID 423035.1]
11i FND:How to specify Record Terminator In Sql*Loader type of concurrent program [ID 252850.1]
Thanks,
Hussein -
How can i get the tax code from Condition record number
Hi all,
i have the Condition record number from which i have to get the tax code as i looked inthe KNOP that Condition record number there but no tax code is maintained there.
so is there any other way to find the tax code for particular Condition record number
Regards
sureshhi suresh,
can u tell me the field name for condition record number and in which table it is stored.
because i knew one condition number which is stored in table EKKO and the field name is
KNUMV- Number of the document condition.
from ekko take relevant details and look for ekpo where u find the tax code
filed name of the tax code id MWSKZ- Tax on sales/purchases code -
Executing sqlldr (sql loader) from java and returning the error code
I'm wandering do sqlldr return any error code whenever it hit error while running in java.
For example, if i run in command prompt using the command below,
C:\ >sqlldr uid/pwd data=abc.dat control=abc.txt
It might give me some indicator that error occurs such as
SQL*Loader-601: For INSERT option, table must be empty. Error on table CURRENCY
or
SQL*Loader-500: Unable to open file (abc.txt)
SQL*Loader-553: file not found
SQL*Loader-509: System error: The system cannot find the file specified.
But when i run in java using the code below,
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("sqlldr uid/pwd data=abc.dat control=abc.txt");
int exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
it will only give me the same exitValue of 1(i presume its error) / 0 (i presume no error) instead of the details of the error.
How can i get the exact error code/message if i were to execute it using java?
Any solution?mg,
I don't think user576271 wants the exit code, I think [s]he wants the error message.
But wouldn't error messages from SQL*Loader be sent to the stderr stream, and not the stdout stream?
In which case user576271 would need method "getErrorStream()" of class java.lang.Process, no?
Good Luck,
Avi. -
SQL Loader Multibyte character error
Hello,
Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
Database Characterset: WE8MSWIN1252
To load an utf8 File (UTF-8 Unicode text) i use option characterset UTF8 in controlfile.
All went fine until in textfile the column is filled up with 40 chars and
german umlaute included (ÜÖÄüöä...)
Loader stops (errors=0) and gives:
Record 146466: Rejected - Error on table 'TableName', column 'ColumnName'.
Multibyte character error
* use CHAR(40) and POSITION(start-end) for field description - no help
* modify column, from VC2(40 char) to VC2(50 char) - no help
* without characterset UTF8 option i got wrong characters for german umlaute - no help
* manual insert the data from this row with NO problems !
any hint or workaround?
Regards
MichaelHi Werner,
on my linux desktop:
$ file test.dat
test.dat: UTF-8 Unicode text, with very long lines
my colleague is working on a windows system.
On both systems exact the same error from SQL Loader.
Btw, try with different number of special characters (german umlaute and euro) and there is no chance to load without the error
when to many (?) special characters or data is long as column length and special characters included.
Regards
Michael
Maybe you are looking for
-
Can't get mpd to update its database
Hi! I'm using mpd and ncmpd an are loving it:D but it seems like i can't update what songs there is in my music directory. How do I update the database?
-
JDeveloper javadoc not working
We use Jdeveloper to develop custom applications and to extend functionality in Oracle Application Framework pages. When I highlight a class like "String" --> right click "Browse Javadoc" the javadoc page opens. However, when I try to do this for any
-
Help - two I tunes, one ipod - but cannot download !!
My son and I both have an ipod, and I actually managed to set up my itune account, visit the store and download all the stuff i bought, but he has since fiddled and when I now log onto the itunes, i can buy and see what I have purchased, but it does
-
In AE CS6 I have 2 3D text layers swapping poition as the camera pulls back from them.
In AE CS6 I have 2 3D text layers swapping poition as the camera pulls back from them. One layer has a blur added and if I switch off the fx then they stay in the correct order. The whole comp consists of 25 tiles (2500x2500px) laid out in 3D as a su
-
Lexmark all in one wont connect to computer
I have a lexmark x5060 but when i try to scan with it it says not conntected to computer ?? does anyone have anything i can try or does anyone know if the product is still anygood