Server Utilities :: Assign Numeric Value Generated From Sequence In Control File?
Dec 22, 2003
I have a control file like following:
LOAD DATA
INFILE *
INTO TABLE member
REPLACE
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
(
control_id,
name,
address
)
problem is that control_id value is not in data file and I have to assign to each row the same value generated from sequence or from unix variable.
For example, after I run sqlldr, I have to have records in the table like following:
control_id name address
---------- ---- -------
1847 Charlie 250 yonge st
1847 Peter 5 Brookbanks dr
1847 Ben 123 King st
.
.
.
How do I do that?
View 29 Replies
Mar 19, 2010
I'm having a problem with SQL loader and the control file. I want to load a delimited file. The script will eventually be automated where the file name is passed in to the script, it's not a static name.
It's a simple SQL loader Unix script that I have created as follows
Unix file called test_load
# Auto Load
#
#
export data_file=/dev/test_$1$2.csv;
export ORACLE_HOME=/u01/oracle/product/10.2.0;
export ORACLE_SID=XXX;
export PATH=$PATH:$ORACLE_HOME/bin;
sqlldr userid=XXX/XXX data=$data_file
control=/dev/cntrl/test.ctl
errors=99999
bad=/dev/bad/test_$1$2_$$.bad
log=/dev/logs/test_$1$2_$$.log
the top of my control file is as follows
load data
truncate
into table test
fields terminated by "|"
when record_type = 'AA'
(
running at the prompt ./test_load myload 20100319
The following error occurs
SQL*Loader-350: Syntax error at line 5.
Expecting "(", found keyword when.
when record_type = 'AA'
^
I believe the format of my control file is correct but for some reason it won't load.
View 10 Replies
View Related
Jun 13, 2012
I am loading data using sqlldr command in UNIX to an oracle table and want to concatenate timestamp to a file name in the "create_file_name" column in the code below.
I have the below code within the control file..
LOAD DATA
TRUNCATE
INTO TABLE TABLEA
TRAILING NULLCOLS
(
file_type POSITION(1:5) CHAR,
business_date POSITION(16:23) DATE "YYYYMMDD",
create_file_name "FILE_NAME" EXPRESSION "SELECT TO_CHAR(CURRENT_TIMESTAMP(3), 'YYYYMMDDHH24MISS') FROM DUAL")
The load fails with SQL Loader error: "Expecting valid column specification, ",", ")", found keyword EXPRESSION found instead of column. How the timestamp to a filename can be appended?
View 5 Replies
View Related
Apr 8, 2010
I am using perl script to dynamically generate the control file.If I have data in the control file as well as in the datafile, how would i write the control file in that case. Is the below one correct?
load data
INFILE '*'
INFILE '/export/home/test/test.csv'
INSERT INTO TABLE EMP fields
terminated by "," optionally enclosed by '"'
trailing nullcols
( empno, empname, sal, deptno )
[code]....
Is there any way that if my control file contains half of the data and my data file contains the other half of the data can i club this data into a logical record in the control file to populate the DB?
My exact 2nd requirement is, my DB contains 5 cols and for 1 col the data is common(countryName) which i have to pass to the control file dynamically and the .csv file contains the data for the other four cols. How could i combine these in the ctrl file and populate the DB?
so if the DB contains CountryName, empid, ename, sal and dept..I will get the CountryName to the ctrl file and csv contains the data for empid, ename, sal and dept. How would i combine these data into a logical record and populate the DB?
View 12 Replies
View Related
Aug 16, 2011
I have a table revenue
create table revenue
(
person varchar2(23),
month varchar2(3),
rev_amt number
)
and i have data in a file like below
Person Jan Feb Mar Apr Mai Jun Jul Aug Sep Oct Nov Dez
--------------------------------------------------------
Schnyder,345,223,122,345,324,244,123,123,345,121,345,197
Weber,234,234,123,457,456,287,234,123,678,656,341,567
Keller,596,276,347,134,743,545,216,456,124,753,346,456
Meyer,987,345,645,567,834,567,789,234,678,973,456,125
Holzer,509,154,876,347,146,788,174,986,568,246,324,987
Müller,456,125,678,235,878,237,567,237,788,237,324,778
Binggeli,487,347,458,347,235,864,689,235,764,964,624,347
Stoller,596,237,976,876,346,567,126,879,125,568,124,753
Marty,094,234,235,763,054,567,237,457,325,753,577,346
Studer,784,567,235,753,124,575,864,235,753,864,634,678
i want to load it into the table in the following way.
Person Month Revenue
-------------------------
Schnyder Jan 345
Schnyder Feb 223
Schnyder Mar 122
Schnyder Apr 345
Schnyder Mai 324
Schnyder Jun 244
Schnyder Jul 123
Schnyder Aug 123
Schnyder Sep 345
Schnyder Oct 121
Schnyder Nov 345
Schnyder Dez 197
........ ... ...
How to write control file to load this data into the above revenue table.
View 2 Replies
View Related
Jun 6, 2011
I am facing issue with my sequence number about sequence number generated..I want it to follow the sequence all the time, i.e. it should take next incremental number to last generated seauence, but it generates random one all the time, i.e
s.nextval() = 4
s.nextval() = 5
s.nextval() = 10
s.nextval() = 543
s.nextval() = 544
My sequence defination is as below
CREATE SEQUENCE s
START WITH 1
MAXVALUE 999999999999999999999999999
MINVALUE 1
NOCYCLE
CACHE 20
View 11 Replies
View Related
Sep 30, 2011
Creating a table
CREATE TABLE NEW_DATA
(INK_DATE DATE,
INV_ID NUMBER,
CUST_ID NUMBER,
AMOUNT NUMBER)
Loading data into the table with
LOAD DATA
CHARACTERSET WE8MSWIN1252
INFILE 'input/NEW_DATA.dat' "str '
'"
BADFILE 'log/NEW_DATA.bad'
DISCARDFILE 'log/NEW_DATA.dsc'
TRUNCATE INTO TABLE NEW_DATA
FIELDS TERMINATED BY '|'
(INK_DATE date "YYYY-MM-DD",
INV_ID,
CUST_ID,
AMOUNT)
My problem is that there are some rows (about 1%) where the columns INV_ID, CUST_ID, AMOUNT are containing non numeric characters and they end up in the BAD-file as errors.
Is there a way to make them end up in the discard file instead so I don't end up with errors but discards?Or even better load then into another table looking like this
(INK_DATE DATE,
INV_ID varchar2,
CUST_ID varchar2,
AMOUNT varchar2)
Do I need to have a WHEN-clause?
View 8 Replies
View Related
May 18, 2012
We have document serial Nos increment program, which has the below query for selecting and Updating, which generates a Numeric Value;
Select Query:
Select doc_slno
from fin_jv_slno_mas
where jv_month = '05' and
jv_year = '2012'
Output of this Query: 800001
Update Query:
update fin_jv_slno_mas set doc_slno=docno+1 where
jv_year = '2012' and
jv_month = '05'
Output after Updation: 800002.
The above query is a normal Sequence updating for a Numeric Value; now we need to update it as Alpha Numeric as below
Example: 8A0001
How can we give the above update statement for Alpha Numeric updation?
View 16 Replies
View Related
Jul 5, 2012
trying to do impdp but getting error
UDI-22303: operation generated ORACLE error 22303
ORA-22303: type "SYS"."DBMSOUTPUT_LINESARRAY" not found
ORA-00600: internal error code, arguments: [kokaocr], [], [], [], [], [], [], [], [], [], [], []
ORA-06508: PL/SQL: could not find program unit being called: "SYS.DBMS_OUTPUT"
ORA-06512: at line
View 2 Replies
View Related
Aug 2, 2010
I have a server with Red Hat EL 5.5 running an oracle database 10g R2 and an Oracle Agent 10.2.0.5The disk ran out of space and I realized that there are a lot of files stating with core.xxx such as :
-rw------- 1 gridagent oinstall 17M Aug 2 13:10 core.10348
-rw------- 1 gridagent oinstall 17M Aug 2 13:15 core.10827
-rw------- 1 gridagent oinstall 17M Aug 2 12:30 core.4129
-rw------- 1 gridagent oinstall 17M Aug 2 12:35 core.4772
What's that ?Why are those files generated at $AGENT_HOME/<HOST>_<SID>/sysman/log/ ?
There are more than 24 GB of those files
in nmc.log I can see lines such as:
NMC-00000 2010-08-02 13:25:39 [11760, nmcdbg.c,0440]TRC: Debug context enabled.
NMC-20020 2010-07-30 01:31:58 [23083, nmccole.c,0725]ERR: Could not collect using DSGA Collection method
NMC-20014 2010-07-29 01:31:56 [11258, nmccole.c,0822]ERR: Could not attach to the SGA
View 1 Replies
View Related
Jul 12, 2012
I am trying to create a new controlfile. I used "alter database backup controlfile to trace;" and then I copied and pasted the contents of the trace file into the .sql file. My sql script is
CREATE CONTROLFILE SET DATABASE "FIVESTAR" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
[code]....
Actually, the name of my database was 'STAR' and I changed it to "FIVESTAR" int this .sql script. Now when I run this script with SQL> @ <path of my sql script>, it gives me the following errors:
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01504: database name 'FIVESTAR' does not match parameter db_name 'STAR'
View 2 Replies
View Related