Home » RDBMS Server » Server Utilities » input variable in sqlloader ctl (oracle 9i)
input variable in sqlloader ctl [message #473379] |
Fri, 27 August 2010 11:06 |
massocchi
Messages: 9 Registered: August 2010
|
Junior Member |
|
|
I want to insert an input value in datalet
Have ideas ?
thanks gabriele
OPTIONS (SKIP=4)
load data
INFILE 'c:\temp\EnergyAneg.csv'
APPEND INTO TABLE UTE.ASM1_ARCADIAANEG
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(datalet filler, ----------------
matcon "substr(:MATRICON,4,10)" ,
MATRICON char,
TOT DECIMAL EXTERNAL(11) "to_number(:TOT,'99999999.999')" ,
L1 DECIMAL EXTERNAL(11) "to_number(:L1,'99999999.999')" ,
C1 DECIMAL EXTERNAL(11) "to_number(:C1,'99999999.999')" ,
L2 DECIMAL EXTERNAL(11) "to_number(:L2,'99999999.999')" ,
C2 DECIMAL EXTERNAL(11) "to_number(:C2,'99999999.999')" ,
L3 DECIMAL EXTERNAL(11) "to_number(:L3,'99999999.999')" ,
C3 DECIMAL EXTERNAL(11) "to_number(:C3,'99999999.999')" ,
L4 DECIMAL EXTERNAL(11) "to_number(:L4,'99999999.999')" ,
C4 DECIMAL EXTERNAL(11) "to_number(:C4,'99999999.999')" )
|
|
|
|
|
|
|
Re: input variable in sqlloader ctl [message #473580 is a reply to message #473542] |
Mon, 30 August 2010 07:47 |
massocchi
Messages: 9 Registered: August 2010
|
Junior Member |
|
|
I read your solution but requires me to do a program to replace the # character for each run with the date that I enter.
If it were possible acqusire directly the value of the variable would be more elegant.
thanks
gabriele
|
|
|
|
Re: input variable in sqlloader ctl [message #473870 is a reply to message #473582] |
Wed, 01 September 2010 05:16 |
massocchi
Messages: 9 Registered: August 2010
|
Junior Member |
|
|
the script is:
OPTIONS (SKIP=4)
load data
INFILE 'c:\temp\EnergyAneg.csv'
APPEND INTO TABLE UTE.ASM_ARCADIAANEG
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(datalet CONSTANT 'to_date('31/07/2010','DD/MM/YYYY')',
matcon "substr(:MATRICON,4,10)" ,
MATRICON char,
TOT DECIMAL EXTERNAL(11) "to_number(:TOT,'99999999.999')" ,
L1 DECIMAL EXTERNAL(11) "to_number(:L1,'99999999.999')" ,
C1 DECIMAL EXTERNAL(11) "to_number(:C1,'99999999.999')" ,
L2 DECIMAL EXTERNAL(11) "to_number(:L2,'99999999.999')" ,
C2 DECIMAL EXTERNAL(11) "to_number(:C2,'99999999.999')" ,
L3 DECIMAL EXTERNAL(11) "to_number(:L3,'99999999.999')" ,
C3 DECIMAL EXTERNAL(11) "to_number(:C3,'99999999.999')" ,
L4 DECIMAL EXTERNAL(11) "to_number(:L4,'99999999.999')" ,
C4 DECIMAL EXTERNAL(11) "to_number(:C4,'99999999.999')" )
if replace with '31/07/2010' i have this log error :
SQL*Loader: Release 9.2.0.8.0 - Production on Mer Set 1 12:10:07 2010
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL*Loader-350: Errore di sintassi in riga 7.
Previsti "," o ")", trovato "31".
(datalet CONSTANT 'to_date('31/07/2010','DD/MM/YYYY')',
have idea ?
thanks
|
|
|
|
Re: input variable in sqlloader ctl [message #473882 is a reply to message #473874] |
Wed, 01 September 2010 06:58 |
massocchi
Messages: 9 Registered: August 2010
|
Junior Member |
|
|
sorry.
The problem is this,I have file:
CountAneg,textbox34,textbox36
22116,2010,7
Nome_Cabina,SerialNumber_CCS,SerialNumber_Lennt,Tot_Aneg,Fascia_T1,Consumo_T1,Fascia_T2,Consumo_T2,Fascia_T3,Consumo_T3,Fascia_T4,Con sumo_T4
Cabina Virtuale,0508530013028,0506400211865,0,0,0,0,0,0,0,0,0
Cabina Virtuale,0508530013028,0506400214525,0,0,0,0,0,0,0,0,0
Cabina Virtuale,0508530013028,0506420301572,0,0,0,0,0,0,0,0,0
Cabina Virtuale,0508530013028,0506500039772,0,0,0,0,0,0,0,0,0
.....
and this table
CREATE TABLE ASM_ARCADIAANEG
(
DATALET DATE,
MATCON NUMBER(10),
MATRICON VARCHAR2(25 BYTE) NOT NULL,
TOT NUMBER(11,3),
L1 NUMBER(11,3),
C1 NUMBER(11,3),
L2 NUMBER(11,3),
C2 NUMBER(11,3),
L3 NUMBER(11,3),
C3 NUMBER(11,3),
L4 NUMBER(11,3),
C4 NUMBER(11,3)
)
in datalet of this table I want insert the last day of the mouth example 31/07/2010 for 2010,7 present in second rows of the file. The others data is OK.
help me
thanks
|
|
|
Re: input variable in sqlloader ctl [message #473888 is a reply to message #473882] |
Wed, 01 September 2010 08:02 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
That still isn't the script you use.
You still haven't posted your operating system.
You still haven't formatted your data.
So at the moment it's impossible to help you.
One possible solution would be Unix shell scripting to extract the values and re-format them before you run SQL*Loader.
|
|
|
|
Re: input variable in sqlloader ctl [message #473895 is a reply to message #473889] |
Wed, 01 September 2010 08:36 |
massocchi
Messages: 9 Registered: August 2010
|
Junior Member |
|
|
I will not hide anything.
The situation here is complete. I hope
import this file into table ASM_ARCADIAANEG:
CountAneg,textbox34,textbox36
22116,2010,7
Nome_Cabina,SerialNumber_CCS,SerialNumber_Lennt,Tot_Aneg,Fascia_T1,Consumo_T1,Fascia_T2,Consumo_T2,Fascia_T3,Consumo_T3,Fascia_T4,Con sumo_T4
Cabina Virtuale,0508530013028,0506400211865,0,0,0,0,0,0,0,0,0
Cabina Virtuale,0508530013028,0506400214525,0,0,0,0,0,0,0,0,0
Cabina Virtuale,0508530013028,0506420301572,0,0,0,0,0,0,0,0,0
Cabina Virtuale,0508530013028,0506500039772,0,0,0,0,0,0,0,0,0
.....
TABLE ASM_ARCADIAANEG
(
DATALET DATE,
MATCON NUMBER(10),
MATRICON VARCHAR2(25 BYTE) NOT NULL,
TOT NUMBER(11,3),
L1 NUMBER(11,3),
C1 NUMBER(11,3),
L2 NUMBER(11,3),
C2 NUMBER(11,3),
L3 NUMBER(11,3),
C3 NUMBER(11,3),
L4 NUMBER(11,3),
C4 NUMBER(11,3)
)
sqlloader current control file:
OPTIONS (SKIP=4)
load data
INFILE 'c:\temp\EnergyAneg.csv'
APPEND INTO TABLE UTE.ASM_ARCADIAANEG
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(datalet FILLER,
matcon "substr(:MATRICON,4,10)" ,
MATRICON char,
TOT DECIMAL EXTERNAL(11) "to_number(:TOT,'99999999.999')" ,
L1 DECIMAL EXTERNAL(11) "to_number(:L1,'99999999.999')" ,
C1 DECIMAL EXTERNAL(11) "to_number(:C1,'99999999.999')" ,
L2 DECIMAL EXTERNAL(11) "to_number(:L2,'99999999.999')" ,
C2 DECIMAL EXTERNAL(11) "to_number(:C2,'99999999.999')" ,
L3 DECIMAL EXTERNAL(11) "to_number(:L3,'99999999.999')" ,
C3 DECIMAL EXTERNAL(11) "to_number(:C3,'99999999.999')" ,
L4 DECIMAL EXTERNAL(11) "to_number(:L4,'99999999.999')" ,
C4 DECIMAL EXTERNAL(11) "to_number(:C4,'99999999.999')" )
I would like to import the corresponding day in the month-end reading the data present in the second row of the example file "2010.7" then 31/07/2010.
sorry if you do lose time.
thanks
|
|
|
|
|
Re: input variable in sqlloader ctl [message #473900 is a reply to message #473896] |
Wed, 01 September 2010 08:47 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
You still haven't mentioned how you call SQL*Loader (Do you type that line you posted every time you want to run it?)
You still haven't formatted it, so that we can actually see how the data looks exactly.
You still haven't mentioned our OS. Although the c:\ in INFILE might be a hint, there are vastly different scripting capabilities between NT4 and Windows 7.
Perhaps have a look at using VBScript to parse the file before starting SQL*Loader on the prepared data.
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Jan 11 01:47:08 CST 2025
|