Server Utilities :: Concatenating Dashes In A Column Using Sqlldr
May 20, 2011
I'd like to load ss_numbers, but concatenate dashes in between.
The ssn currently looks like this in the file: 123456789
I'd like to put dashes in there to make it load like this. 123-45-6789
The data is positional, so I have the column in the ctl file defined as:
ssn position(1:9) char nullif ssn=blanks ,
I know how to concat using the other method of loading this way, but this is not how the data file looks:
"substr(lpad(:ssn,9,'0'),1,3)||'-'||substr(lpad(:ssn,9,'0'),4,2) ||'-'||substr(lpad(:ssn,9,'0'),6,4)",
how to get the dashes in there while loading with the positional method?
View 4 Replies
ADVERTISEMENT
Oct 26, 2011
I am doing a simple test and need to populate a small table with some data.
My table looks like this:
SQL> desc clob_test
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER(20)
C1 CLOB
I have a pipe delimited data file ID range 1-50000 and random characters with a length of 100-4000 bytes for the clob field.
My control file looks like this but I am guessing it is wrong:
LOAD DATA
INFILE 'clob_test.dat'
INTO TABLE CLOB_TEST
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(
ID INTEGER EXTERNAL NULLIF (ID=BLANKS)
, C1
)
Let me know what I need to do to my .ctl file in order to load this data?
View 4 Replies
View Related
Jun 6, 2012
I am not able to load complete date along with time in the date column. here is my table desc
DESC STAGE
Name Null Type
----------------------------------
TABLE_NAME NOT NULL VARHCAR(20)
RECORDCOUNT NUMBER
CREATED_DATE NOT NULL DATE
my control file is like this
LOAD DATA
APPEND
INTO TABLE SCOOP.STAGE
FIELDS TERMINATED BY ","
( TABLE_NAME
,RECORDCOUNT
,CREATED_DATE DATE(16) "YYYYMMDDHH:Mi:SS"
)
the data gets loaded, but it appears like this in the table
HIGHSCHOOL3080606-JUN-12
MIDDLESCHOOL8768006-JUN-12
BUT I WANT COMPLETE DATE AND TIME (HH:MI:SS) , HOW CAN I GET IT (THIS IS HOW I WANT 06-JUN-12 11:07:33)
View 10 Replies
View Related
Oct 29, 2013
I want to load lakhs of records into a table. My problem is when after loading the ¼ of records my process is abend due to the size of my rollback segment area. I don't have an option to increase it. So, Is there any way to go for intermediate commits when I am using the imp or sqlldr utilities to load the entire data without abend?
View 2 Replies
View Related
Jun 15, 2010
I am executing sqlldr from a UNIX shell script (HP box). The data I am loading is coming from a fixed length flat file. I also want to be able to pass a variable from the shell to the loader job to be loaded with the rest of the data into the oracle table. The value being passed will change with each execution of the shell script which is run on a daily basis.
View 7 Replies
View Related
May 10, 2011
I am trying to upload attached csv data in below described table.
Name Null? Type
------------ -------- --------------------------
MSISDN VARCHAR2(20)
PREFERENCES VARCHAR2(100)
PHONE_DIG NUMBER
There is some character type and null MSISDN records in csv file. due to this I want 0 in my PHONE_DIG column.
Accroding to attached ctl file i am not able to do that.
View 6 Replies
View Related
Mar 24, 2010
How to execute the SQLLDR, where Data File Reside in another Server?
View 1 Replies
View Related
May 21, 2010
we are using sqlldr to load data into table.we have data in a csv file as below
"TXN_DATE","TXN_HOUR","VID","HID"
"2010-05-18 20:00:00.0","20","184","212"
"2010-05-18 21:00:00.0","21","184","212"
"2010-05-19 17:00:00.0","17","184","212"
I just want to insert only date without timestamp from the first field TXN_DATE. i.e., i just want 2010-05-18 in my table column.
my table desc is
Name Null? Type
----------------------------------------- -------- ---------
SEQID NUMBER(5)
TXN_DATE NOT NULL DATE
TXN_HOUR NOT NULL NUMBER(2)
VID NOT NULL NUMBER(5)
HID NOT NULL NUMBER(5)
i tried many combination but i couldn't achieve. right now i am able to get only the complete date with timestamp using the following control file.
APPEND INTO PERF_STATS
FIELDS TERMINATED BY ',' optionally ENCLOSED BY '"'
TRAILING NULLCOLS
[Code].....
View 8 Replies
View Related
May 12, 2011
Im trying to use sqlldr in Fedora Linux but it doesnt work
The message:
Message 2100 not found; No message file for product=RDBMS, facility=ULMessage 2100 not found; No message file for product=RDBMS
oracle.sh:
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib:/usr/include/oracle/11.2/client:/usr/share/oracle/11.2/client
export ORACLE_SID=zxin
export PATH=$PATH:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin
View 6 Replies
View Related
Jun 13, 2013
I have a CSV file with 100 records and one of the column as FILE_ID. I want to load one unique number for all 100 recs not for every records.
suppose my sequence returns 3 as next val i want to load 3 for all 100 records. How to implement this in control file or sh file . I am using shell script to call sqlldr.
View 2 Replies
View Related
Aug 25, 2012
The SQLLDR fails with connection error:
SQLLDR userid=userid/passwd@vpl01 control=OtherType.ctl log=OtherType.log bad=OtherType.bad
SQL*Loader: Release 11.2.0.1.0 - Production on Sat Aug 25 13:32:42 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
SQL*Loader-704: Internal error: ulconnect: OCIEnvCreate [-1]
If I provide full connection string, it gives syntax error:
sqlldr userid/passwd@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orasrv)(PORT=1526))(CONNECT_DATA=(SID=vpl01))) control=OtherType.ctl log=OtherType.log bad=OtherType.bad
LRM-00116: Message 116 not found; No message file for product=ORACORE, facility=LRM
[code]...
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
but it doesn't work if supplied following command:sqlplus userid/passwd@vpl01
SQL*Plus: Release 11.2.0.3.0 Production on Sat Aug 25 13:32:14 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name:
Even tnsping vpl01 gives error:
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 25-AUG-2012 09:14:40
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
[code]...
View 4 Replies
View Related
May 17, 2010
I'm using sqlldr to import geometries into a table. The import runs succesfully, but when I validate to imported geometries using "SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT", it gives an error on empty geometries (or supossedly empty).
When I select to columns using sqlplus, the geometry column isn't entirely empty. After I set the geometry = null, the geometry is really empty. (see screenshot)
Question: How do I import empty geometries values properly, so that it's really empty My guess is that I have to alter to ctrl-file, like NULLIF
data:
3806501|
3806504|2001|90112||121231|485668||;:
ctrl-file:
LOAD DATA
INFILE 'aap.dat'
APPEND INTO TABLE aap
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '$$'
[code]...
View 4 Replies
View Related
Apr 24, 2012
I have a csv file extracted from mainframe which has to be loaded into oracle using sqlldr utility.The numbers are in the format +0000003333, -0000003232.44 etc
I have to convert it to 3333 and -3232.44 and insert into the table.
I have used syntax like
Load file....append into table (t_num expression "to_number(':tnum,'99999.999')")
This gives me an invalid number error.
View 3 Replies
View Related
Nov 10, 2010
I am experiencing somewhat same issue...but have been unable to resolve it(new to Oracle) I am getting the infile from flat file(data dump from SQL) using sqlldr to upload data to the Oracle table...since the data is already in the flat file...I cannot do anything in the SQL to pre-format the data...
Sample of ERROR I am getting - Column CREATE_DATE which has date and time - happens to other date time columns also if remove the CREATE_DATE from Control file(happens to every single line of record):
==========================================
Record 2: Rejected - Error on table LGCY_CHS.METS_CHS_USER_PRIV, column CREATE_DATE.
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
[code]...
Flat file: (3 lines of data)
5|Annie|1|AR|84601D0A-6D9D-4D0F-86EB-2FDD9D7E680B|0|0|1|1|1|0|1|0|kgarbin|XPLTMCE01|2005-04-07 13:54:42.087|Annie|VAXP60|2008-10-03 16:54:59.583|2008-10-03 16:54:59.583
11|Beverly|1|BA|9A2D6304-E997-4B40-96E5-2221E521B077|1|0|0|1|0|0|0|0|kgarbin|XPLTMCE01|2005-04-07 13:54:42.087|BEVERLY|VAXP60|2008-10-03 09:39:33.973|2008-10-03 09:39:33.973
29|KGarbin|1|KG|B229FCF9-BED0-4E50-9804-83324B677C67|0|0|1|1|1|1|0|1|kgarbin|XPLTMCE01|2005-04-07 13:54:42.087|Gfoote|VAXP60|2008-09-08 10:05:01.690|2008-09-08 10:05:01.690
View 1 Replies
View Related
Apr 23, 2012
I have written a shell script that will execute a procedure. The input parameters are constant.
#!/bin/ksh
sqlplus user@server.com<<EOF
set serveroutput on;
var Return_Code number;
var Return_Message varchar2(4000);
exec test_pkg.Insert_test('IDD', null, 'BATCH',:Return_Code, :Return_Message);
Now I have to call same procedure but the input is a csv file.
Is there a way to call a procedure using csv file, I cannot load the table using SQL Loader because there is a complicated logic.For every row in CSV there should be 3 rows inserted into table and 2 rows updated.
As of JAN 2, three rows have to be inserted with dates JAN2, JAN 3, JAN 4 and 2 rows ( 3ODEC and 29DEC have to be updated). Also these days have to be business days.
So all this code is in procedure that uses a DB2 package for business dates.Instead of using sql ldr , if would like pass the csv file as input param.
View 1 Replies
View Related
Aug 23, 2013
Here's my table:
SQL> desc stg_query_overflow
Name Null? Type
----------------------------------------- -------- ----------------------------
HOSTNAME VARCHAR2(50)
NPSID NUMBER
NPSINSTANCEID NUMBER
OPID NUMBER
[code]....
Here's my controlfile:
load data
infile '/u01/tony/server_name/query_overflow.dat'
badfile '/opt/oracle/tony/sql_dir/bad/server_name_query_overflow.bad'
discardfile '/opt/oracle/tony/sql_dir/discard/server_name_query_overflow.dsc'
append
into table stg_query_overflow
[code]....
Here's a sample of data that I can't load into the table via sqlldr:
echo
echo ***** Creating view: "pul_promotion_response"
CREATE or replace VIEW "pul_promotion_response"
(
"promo_rsp_id",
"promo_hist_dtl_id",
"indiv_id",
[code]....
Here's the error(s) I receive in my log file:
Record 272: Rejected - Error on table STG_QUERY_OVERFLOW, column NPSID.
ORA-01722: invalid number
Record 273: Rejected - Error on table STG_QUERY_OVERFLOW, column NPSID.
ORA-01722: invalid number
As you can see, sqlldr is interpreting this vertical sql code as the npsid column, when in fact it is the querytext column. How can I insert each record when some of my data is in this vertical format?
View 1 Replies
View Related
Apr 17, 2013
I have table named purchage with 2 columns (order_no number,order_date date) in my database. I want to load the data from a file into that table. The below is the file format
100,4/3/2013 1:18:18 AM
101,4/3/2013 1:18:18 AM
102,4/3/2013 1:18:18 AM
103,4/3/2013 1:18:18 AM
104,4/3/2013 1:18:18 AM
105,4/3/2013 1:18:18 AM
106,4/3/2013 1:18:18 AM
how to load the date filed along with the time stamp.
View 2 Replies
View Related
Dec 10, 2010
Why duplicated rows when a PK is present running Sqlldr?
View 1 Replies
View Related
Jun 1, 2011
We load large amount of data into multiple tables using sqlldr. Amount of data that we need to load varies according to the situation. We want to estimate the tablespace usage growth due to this data load, so we can verify/extend the tablespaces before the data load. Though, setting to autoextend will work in this case, We want to avoid extending the tablespace during sqlldr executing due to performance.
Our initial attempt was to note the tablespace size before and after executing the sqlldr and use the delta. But this delta was not consistent in different environments for the same amount of data. Different environments mean different oracle servers, different existing sizes of tablespaces, One data file Vs multiple data files etc.
How do we reliably estimate how much tablespace we need for the given amount of data?
View 3 Replies
View Related
Jan 25, 2012
sqlldr works fine. but, i have primary keys defined in the table. So the SQL loader throws error that
SQL*Loader-951: Error calling once/load initialization
ORA-26002: Table WD has index defined upon it.
How should i change this load type to "normal" in sqlldr ? I think sqlldr made for bulk load purpose only.
View 3 Replies
View Related
Aug 8, 2012
using SQLLDR: Looking for a control file solution to move past or bypass extra data fields which are not on destination table. Basically if you have 8 tab delimited fields(terminated by ' ') on a data record; but only need to load 5 of the values from the delimited record; is there a way to ignore/bypass the not needed data. Obviously, the answer would be to massage the data at the OS and removed the 3 unnecessary fields.
However my hands are tied by volume,time, and compliancy. I am familiar with using 'FILLER' for the reverse scenario; but not where you have more data available on the record then exists on the table.
View 1 Replies
View Related
Nov 28, 2012
column1 column2 column3 column4
12 Mar-21-2005 BDW blah blah blah
11 Feb-07-2001 ZV ha ha ha
12 Jan-02-2002 YM zuck zuck zuckI want a view that has that data like this:
column1 column2
12 Mar-21-2005 - BDW - blah blah blah; Jan-02-2002 - YM - zuck zuck zuck
11 Feb-07-2001 ZV ha ha haCan you help with SQL ?
I tried to use this Oracle LISTAGG function in the SQL, but got a "string concatenation limit exceeded"
View 3 Replies
View Related
Feb 17, 2011
My requirement is to concatenate two column values and place them in a new column.I have done it using self join but it limits the purpose,meaning when I have more than 2 values for grouped columns then it won't work.How to make this dynamic,so that for any number of columns grouped,I can concatenate.
SELECT a.co_nm, a.mnfst_nr, a.mnfst_qty,
a.mnfst_nr || ':' || a.mnfst_qty || ';' || b.mnfst_nr || ':'
|| b.mnfst_qty
FROM vw_acao_critical a JOIN vw_acao_critical b
ON a.co_nm = b.co_nm AND a.mnfst_nr = b.mnfst_nr
[code]......
What will be the case when I need to concatenate for more number of values.
like when co_nm has three bahs and manfst_nr and manfst_qty has 3 values for each for bah.and if three are having same_mnfst nr then I should use something dynamic.how to achieve this.
View 10 Replies
View Related
Sep 10, 2012
I have written the code for sql loader, I have given termination of file is | , i have given five columns name in sequence...My Requirement is that i want to mapped 100th column from Csv file after 5th column how to do it.
OPTIONS (ERRORS=100000000)
LOAD DATA
CHARACTERSET UTF8
INTO TABLE "TARGET_STG_AMC"
TRUNCATE
[code]....
View 10 Replies
View Related
Jul 12, 2011
My requirement is to load the data from feed file into two tables based on the value of a column in feed file.
say column in feed file is "Activity_Value" . If the Activity_value is 10, the data from feed file should be loaded into Table A and If the Activity Value is 20 the data from feed file should be loaded into Table B.
View 3 Replies
View Related
Mar 25, 2013
CONTROL FILE:
LOAD DATA
INFILE 'sample.txt'
INSERT
INTO TABLE TEST_RECORDS
WHEN REC_TYPE_HDR='HDR'
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(
[code]....
The value 603 should have loaded into TRAN_TYPE field or column, instead it loaded into the next field or column LINE_COMP.
View 3 Replies
View Related
Aug 1, 2012
I want to insert calculated data while loading the data from sql loader.
eg let say column INTERNAL_TRANSACTION_ID,WAIT_TIME,MESSAGE_GUID,TRS_SIZE,RETURN_MESSAGE_GUID are null in input file then i want to populate column DEV_FLAG as 'U' ELSE 'D'
My control file looks like below but doesn't have DEV_FLAG.
load data
BADFILE '/backup/temp/rajesh/RIO/BadFiles/FILENAME'
append into table TEMP_rio_RESP_TIME_LND
TRAILING NULLCOLS
(
INSTALLATION_ID CHAR
TERMINATED BY "|" OPTIONALLY ENCLOSED BY '"',
TRANSACTION_ID CHAR
[code]....
View 2 Replies
View Related
Dec 1, 2011
I have the following table intra_trades with t_id as the primary key. There is a trigger on that table that gets the next sequence and inserts it into the t_id column for every insert. I need to load data into that table using SqlLoader as chunks of 3000 rows and return the t_id back the script that Sqlload the data so that it can use that t_id's for the next process in the script.
intra_trades
t_id NUMBER(15) pk
t_name VARCHAR2(30)
t_loc VARCHAR2(40)
t_start TIMESTSTAMP
t_end TIMESTSTAMP
[code]....
The problem is that the only unique key on that table is the t_id which has a sequence on it and it is the pk. There can be duplicate rows in that table to meet the business needs for the company. So it is hard to associate the rest of the data in a row with t_id. The only thing I can think of is return the t_ids in the order it inserted so if the script keeps the order of rows in the memory it can associate the tid with the rest of the intra_trades info.How can I make the sqlloader return an array of t_ids that inserted? I need to return the t_ids's in the order it inserted so that the script can associate the t_id with the rest of the rest of the data in a row.
View 4 Replies
View Related
Sep 24, 2013
I have csv file which having parent and child related data.i need to load parent data in to parent table and get parent reference id and store in child table with child data. i am not able to find how to get parenet refernce id using control file. In my csv file i have 2 parent name rows. I need to create one A record in parent table and get that parent primary(P_ID) for 'A' record and put into child table for c_name test1 and test2 records.
mydata.csv
---------------
P_Name C_Name
------ ------
A, test1;
A, test2;
B, test3;
B, test4;
C, test5;
C, test6;
D, test7;
D, test8;
1. table parent (P_ID, P_Name)
2. table child (C_ID, C_Name, P_ID)
i need data bello way.
Parent Table data:
P_ID P_Name
----- ------
1A
2B
3C
4D
Child Table data:
C_IDC_NameP_ID
--------------
1test11
2test21
3test32
4test42
5test53
6test53
7test64
8test64
My controll file
-------------------
LOAD DATA
INFILE 'mydata.data'
APPEND
INTO TABLE parent
when (1:1) = 'p'
fields terminated by ',' optionally enclosed by '"' trailing nullcols
[code].....
able to load parent data and generate P_ID, but i am not able to get P_ID for child records.
View 6 Replies
View Related
Feb 5, 2006
Data
Sl#Emp_noNameAddress
00101Tom1/B-XYZ street
00202Jon1/C-XYZ Street
Employee Datafile
001, 01, Tom, 1/B-XYZ street
002,02,Jon, 1/C-XYZ Street
Above is a sample data file. Now I would like to import the data into an Oracle table called employee using Oracle 9i SQL Loader utility. But the table has only 3 fields (Emp_no,Name & Address), so I would like to skip Sl# while loading data. I do not want to manually modify data file. How should I write .ctl file.
Sample .ctl file.
load data
INFILE 'dataEmployee'
BADFILE 'Employee.bad'
DISCARDFILE 'Employee.dis'
into table Employee
fields terminated by ','
TRAILING NULLCOLS
(Emp_no NULLIF Emp_no = BLANKS,
Name NULLIF Name = BLANKS,
Address NULLIF Address = BLANKS
)
View 4 Replies
View Related