Table to load dynamically using sqlloader.
how to specify which table to load dynamically using sqlloader. We are using sqlldr in a script as given below...
sqlldr user/pass control=/control/loader.ctl log=/log/logger.log bad=/bad/badrec.bad data=/data/d1.txt
Hello, you'd need to build the necessary control files through a shell script, here is an example:
# Write sqlplus commands to control_file.sql
echo "set head off
set feedback off
set pagesize 0
set termout off" > control_file.sql
# read table and column list from table.dat
more table.dat |awk '{print $1}' |
while read TAB
do
echo "Table ${TAB}"
read COLUMNS
STR="nothing"
if test "$TABLE_LIST" = "empty"
then
TABLE_LIST="'$TAB'"
else
TABLE_LIST="$TABLE_LIST,'$TAB'"
fi
# construct select to load data - creating SQL*Loader control files
echo "set head off\n
set feedback off\n
set pagesize 0\n
select column_name||' '||
decode(data_type,'VARCHAR2',' char ('||DATA_LENGTH||')',
'CHAR',' char ('||DATA_LENGTH||')','DATE',' date (20) \"DD-MON-YYYY HH24:MI:SS\"','')
from user_tab_columns
where table_name ='$TAB'
order by 1;\n" | $ORACLE_HOME/bin/sqlplus -s $USR | awk '{print $1" "$2" "$3" "$4" "$5}' |
# read the columns in and concatenate them together to form the control file select
while read COLUM
do
if test "$STR" = "nothing"
then
STR="\nspool $TAB.CTL\nselect 'LOAD DATA\nINFILE \"$TAB.DMP\"\nBADFILE \"$TAB.BAD\""
STR="$STR\nDISCARDFILE \"$TAB.DIS\"\nDISCARDMAX 99\nTRUNCATE"
STR="$STR\nCONTINUEIF LAST != \"$FIELD_ENCLOSURE2\"\nINTO TABLE $TAB"
#STR="$STR INTO TABLE $TAB"
STR="$STR\nFIELDS TERMINATED BY \"$FIELD_DELIMITER\""
STR="$STR ENCLOSED BY \"$FIELD_ENCLOSURE\" AND \"$FIELD_ENCLOSURE2\""
STR="$STR\n TRAILING NULLCOLS"
STR="$STR\n($COLUM"
else
STR="$STR,\n$COLUM"
fi
done
STR=" $STR)'\nFROM DUAL;\nspool off\n"
echo "$STR" >> control_file.sql
done
Similar Messages
-
Loading a falt file into table using sqlloader
I have a flat file (csv/txt) which has a header and a trailer record
I want to load it using SQLLoader , i want to skip this trailer/footer record.
Please suggest , due to some business rules i cannot use WHEN clause
I am on Oracle 11gWell, maybe you'll get better help in theses spaces then, ODI is not really my cup of tea:
Data Integrator
https://forums.oracle.com/community/developer/english/oracle_database/export_import_sql_loader_%26_external_tables -
Loading mp3 dynamically using FlashVars
I was wondering if anyone knew how to get an mp3 to load
dynamically using FlashVars. I know how to do the html coding for
the <object> and <embed> tag so that each time I want
to change the audio file, I can do that in the html file rather
than the flash.
The thing I'm having problem with is once I create the shared
object, I don't know how to get it to reference the html file. I've
been looking online for help on this as far as a full on tutorial
on how to set up things like that and I just don't get it.xxaimsxx,
> I was wondering if anyone knew how to get an mp3 to load
> dynamically using FlashVars.
Sure thing.
> I know how to do the html coding for the <object>
and <embed>
> tag so that each time I want to change the audio file, I
can do
> that in the html file rather than the flash.
Well, that's how to load an MP3 from FlashVars. ;) Now I'm
confused.
> The thing I'm having problem with is once I create the
shared
> object, I don't know how to get it to reference the html
file.
The SharedObject class, in principle, has nothing to do with
FlashVars,
so I'm not sure what you're asking, here. The SharedObject
class gives you
a way to store information on the user's hard drive -- think
if it like the
Flash equivalent of browser cookies -- while FlashVars is a
way to set
variables in the movie's root from the outside.
Can you be more specific on how you're trying to combine
these?
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
Unable to load data in to table using sqlloader
Hi,
Oracle Version :10.2.0.1
Operating system:windows Xp
I was unable to load the data in to table from csv file .Can any one please help me .
Here is the output of my log file
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jun 3 12:43:22 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: ach_staging.ctl
Data File: E:\SQL LOADER\ACH_STAGING.csv
Bad File: E:\SQL LOADER\load_bad.bad
Discard File: E:\SQl LOADER\emp.dsc
(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 ACH_STAGING, loaded from every logical record.
Insert option in effect for this table: INSERT
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
ACH_CODE FIRST * , O(") CHARACTER
LOAN_CODE NEXT * , O(") CHARACTER
LOAN_TYPE NEXT * , O(") CHARACTER
TRAN_ID NEXT * , O(") CHARACTER
BO_CODE NEXT * , O(") CHARACTER
BO_NAME NEXT * , O(") CHARACTER
ST_CODE NEXT * , O(") CHARACTER
ACH_TYPE NEXT * , O(") CHARACTER
ACH_EFFECTIVE_DATE NEXT * , O(") CHARACTER
AMT NEXT * , O(") CHARACTER
CHECK_ACCNT_NO NEXT * , O(") CHARACTER
ABA_CODE NEXT * , O(") CHARACTER
ACH_STATUS NEXT * , O(") CHARACTER
TRAN_STATUS NEXT * , O(") CHARACTER
IS_HOLD NEXT * , O(") CHARACTER
IS_CANCELLED NEXT * , O(") CHARACTER
COMMENTS NEXT * , O(") CHARACTER
UPDATED_BY NEXT * , O(") CHARACTER
DATE_UPDATED NEXT * , O(") CHARACTER
CREATED_BY NEXT * , O(") CHARACTER
DATE_CREATED NEXT * , O(") CHARACTER
LOAN_TRAN_CODE NEXT * , O(") CHARACTER
ACH_AUTH NEXT * , O(") CHARACTER
REBATE_AMT NEXT * , O(") CHARACTER
PROMOTION_AMT NEXT * , O(") CHARACTER
TDC_ACH_NO NEXT * , O(") CHARACTER
INST_NUM NEXT * , O(") CHARACTER
DISABLE_ACH NEXT * , O(") CHARACTER
STMT_NO NEXT * , O(") CHARACTER
NEW_LOAN_TRAN_CODE NEXT * , O(") CHARACTER
REVOKED_BY NEXT * , O(") CHARACTER
REVOKED_DATE NEXT * , O(") CHARACTER
CHECK_STATUS NEXT * , O(") CHARACTER
value used for ROWS parameter changed from 64 to 30
Record 1: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 2: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 3: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 4: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 5: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 6: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 7: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 8: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 9: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 10: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 11: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 12: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 13: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 14: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 15: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 16: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 17: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 18: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 19: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 20: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 21: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 22: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 23: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 24: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 25: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 26: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 27: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 28: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 29: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 30: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 31: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 32: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 33: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 34: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 35: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 36: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 37: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 38: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 39: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 40: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 41: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 42: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 43: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 44: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 45: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 46: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 47: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 48: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 49: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 50: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
Record 51: Rejected - Error on table ACH_STAGING, column ACH_EFFECTIVE_DATE.
ORA-01830: date format picture ends before converting entire input string
MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
Table ACH_STAGING:
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: 255420 bytes(30 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 60
Total logical records rejected: 51
Total logical records discarded: 0
Run began on Thu Jun 03 12:43:22 2010
Run ended on Thu Jun 03 12:43:23 2010
Elapsed time was: 00:00:00.17
CPU time was: 00:00:00.10
{code}
and the data from the CSV file is
{code}
1767641 7537506 ILP ADV 506703 MICHELLE WHITE -40 CRE 07-NOV-08 01.36.04.000000000 PM 650 INP PRO N N 54564 06-NOV-08 06.06.28.000000000 PM 54562 06-NOV-08 01.36.04.000000000 PM 2060997 PPD 0 0 0 N 1 ACH
1767642 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 01-DEC-08 12.00.00.000000000 AM 76.5 INP PRO N N Updated During EOD PAY : ACH 1 28-NOV-08 09.00.17.000000000 PM 54562 06-NOV-08 01.36.04.000000000 PM 2061201 PPD 0 0 1 N 1 ACH
1767643 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 16-DEC-08 12.00.00.000000000 AM 76.5 INP PRO N N Updated During EOD PAY : ACH 1 15-DEC-08 09.00.16.000000000 PM 54562 06-NOV-08 01.36.04.000000000 PM 2061614 PPD 0 0 2 N 1 ACH
1767644 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 02-JAN-09 12.00.00.000000000 AM 76.5 INP PRO N N Updated During EOD PAY : ACH 1 31-DEC-08 09.00.55.000000000 PM 54562 06-NOV-08 01.36.04.000000000 PM 2063375 PPD 0 0 3 N 1 ACH
1767645 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 16-JAN-09 12.00.00.000000000 AM 76.5 INP PRO N N Updated During EOD PAY : ACH 1 15-JAN-09 09.01.10.000000000 PM 54562 06-NOV-08 01.36.04.000000000 PM 2064023 PPD 0 0 4 N 1 ACH
1767646 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 02-FEB-09 12.00.00.000000000 AM 76.5 INP PRO N N Updated During EOD PAY : ACH 1 30-JAN-09 09.00.22.000000000 PM 54562 06-NOV-08 01.36.04.000000000 PM 2064639 PPD 0 0 5 N 1 ACH
1767647 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 17-FEB-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 6 N 1 ACH
1767648 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 02-MAR-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 7 N 1 ACH
1767649 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 16-MAR-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 8 N 1 ACH
1767650 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 01-APR-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 9 N 1 ACH
1767651 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 16-APR-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 10 N 1 ACH
1767652 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 01-MAY-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 11 N 1 ACH
1767653 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 18-MAY-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 12 N 1 ACH
1767654 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 01-JUN-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 13 N 1 ACH
1767655 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 16-JUN-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 14 N 1 ACH
1767656 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 01-JUL-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 15 N 1 ACH
1767657 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 16-JUL-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 16 N 1 ACH
1767658 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 03-AUG-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 17 N 1 ACH
1767659 7537506 ILP PAY 506703 MICHELLE WHITE -40 DEB 17-AUG-09 12.00.00.000000000 AM 76.5 NOP NOP N Y Cancelled during Payment By -> BUY : ACH 54605 13-FEB-09 09.03.23.000000000 AM 54562 06-NOV-08 01.36.04.000000000 PM 1778544 PPD 0 0 18 N 1 ACH
{CODE}
Thanks & Regards,
Poorna Prasad.Hi,
At last i was able to insert the data into the table but here i am facing another problem i the csv file i am having some null values in the data because of that only few records was inserted and remaining data was not inserted.
Here is the syntax what i am using to insert even null values are present
ACH_EFFECTIVE_DATE "to_timestamp(:ACH_EFFECTIVE_DATE,'DD-MON-RR HH.MI.SSXFF AM')" NULLIF ACH_EFFECTIVE_DATE=BLANKSand the error what i am getting is
E:\SQL LOADER>sqlldr userid=rr/rr control=ach_staging.ctl log=ss1.log
SQL*Loader: Release 10.2.0.1.0 - Production on Fri Jun 4 12:24:32 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL*Loader-350: Syntax error at line 16.
Expecting "," or ")", found keyword nullif.
EFFECTIVE_DATE,'DD-MON-RR HH.MI.SSXFF AM')" NULLIF ACH_EFFECTIVE_DATE=
^
{code}
can any one please help me what is the correct syntax i need to user here .
Thanks & Regards,
Poorna Prasad. -
Updating a table from two nodes simultaneously using sqlloader- Issues..
Hi,
I have a two node RAC. I have a table called PARTS1, has an PK+Index on PART column, Again this has a sequence. Now I am loading data on PARTS1 table using sqlloader from both nodes at the same time. What issues will come?
Since one column of this table has a PK+Sequence+Index, there will be a contention issue with the block while updating records.. am I right? What other isues might appear here?
Thanks in advance,
Lily.user7993571 wrote:
Consider two databases
db10gA and db10gB which is having a db link from A to B
There is a user A in db10gA
and another user B in db10gB
the user require to insert,update,delete records of user B tables
so how is the DML privileges are granted to user A to perform these tasks at db10gB database
whether it is the type of db link decides to do these tasks
whether any synonym created at db10gA side might help to do the jobUser A will act on behalf of the user who has created the DBLINK; for example if you have created the DBLINK with a user having a DBA role; and grant the DBLINK access to A, A can act on behalf of the DBA who has created the DBLINK. -
HELP:Loading XMLtype column from xml file using SQLLOADER
Hi,
My table structure is
crtd_date date,
xml_doc XMLType
I have to insert the data dynamically from sqlloader,is it possible? - if it possible please help with controlfile.
i wrote the controlfile like
LOAD DATA
INTO TABLE drvt_xml replace
XMLType(xmldoc)
FIELDS TERMINATED BY ',' optionally enclosed by '"'
crtd_date SYSDATE,
fname filler char,
xmldoc lobfile(fname) terminated by eof
)Hi,
I am having the same issue wer u able to write the control file and did it work?
If yes pls post ur control file.
Thanks in advance!! -
Is it possible incremental load using sqlloader
Hi
I am working on datawarehousing projects and every day loading 3 lakhs record to target server using sqlloader.Is it possible incremental loading using sqlloader
Example First day loaded 3 lakhs record into target using sqlloader ,when next day need to load another 2 lakhs records .Using sqlloader how to do the incremental load?
Thanks inadvance
MohanHi
The sql loader has three options
Append
Replace
Truncate
The first option will help you and append the data and will not reject the duplicate . FOr rejecting duplicate record rejection make sure table has constraints.
Prashant_Arvind -
I cannot get the accordion load event to fire when I have
created the accordion and load event using actionscript . Here is
some sample code:
createClassObject(mx.containers.Accordion, "acc",
getNextHighestDepth());
acc.createSegment(mx.containers.ScrollPane, "sc1", "Number
One");
acc.createSegment(mx.containers.ScrollPane, "sc2", "Number
Two");
var accLis=new Object();
accLis.load=function(evtObj) {
trace("load");
accLis.change=function(evtObj) {
trace("change");
acc.addEventListener("load", accLis);
acc.addEventListener("change", accLis);
I made sure to add the ScrollPane and Accordion components
to my library. So the load event does not fire, but the change
event does fire. And through further testing the other events do
not fire, including the draw event. Can anyone help? The only time
I can get the load event to fire on an accordion is if I put an
accordion on stage, select it and add the actionscript to the
objects actions like shown below:
on(load) {
trace("load");
on(draw) {
trace("draw");
Can somebody help? Unfortunately I must create all my
components dynamically. Thank you in advance.I'm having this issue also...but only apparently with Internet Explorer and only on some machines...ideas?
-
Can I use table function inside Dynamic query ?
Dear Gurus,
I have following code
DECLARE
TYPE CRITERIA_LIST_TABLE AS TABLE OF VARCHAR2(20);
OtherNoList CRITERIA_LIST_TABLE; /* CRITERIA_LIST_TABLE is index by table*/
QUERY_STRING VARCHAR2(4000);
BEGIN
OtherNoList := CRITERIA_LIST_TABLE();
SELECT DISTINCT REGEXP_SUBSTR('1,5,6,4', '[^\,]+',1, LEVEL ) BULK COLLECT INTO OtherNoList
FROM DUAL
CONNECT BY LEVEL <= REGEXP_COUNT('1,5,6,4', '\,') + 1 ;
QUERY_STRING := 'INSERT INTO TAB1 (C1,C2) '||
'SELECT C1,'||
'C2 '||
'FROM TAB1 ,'||
'TABLE( '||
'CAST (OtherNoList AS CRITERIA_LIST_TABLE) '||
') OTHRNOS '||
'WHERE TAB1.C1 = OTHRNOS.COLUMN_VALUE ';
DBMS_OUTPUT.PUT_LINE('Query String is '||QUERY_STRING);
EXECUTE IMMEDIATE QUERY_STRING;
END;
Can I use Table function inside dynamic query.
Thanking in advance
SanjeevTry:
DECLARE
TYPE CRITERIA_LIST_TABLE AS TABLE OF VARCHAR2(20);
OtherNoList CRITERIA_LIST_TABLE; /* CRITERIA_LIST_TABLE is index by table*/
QUERY_STRING VARCHAR2(4000);
BEGIN
OtherNoList := CRITERIA_LIST_TABLE();
SELECT DISTINCT REGEXP_SUBSTR('1,5,6,4', '[^\,]+',1, LEVEL ) BULK COLLECT INTO OtherNoList
FROM DUAL
CONNECT BY LEVEL <= REGEXP_COUNT('1,5,6,4', '\,') + 1 ;
QUERY_STRING := 'INSERT INTO TAB1 (C1,C2) '||
'SELECT C1,'||
'C2 '||
'FROM TAB1 ,'||
'TABLE( '||
'CAST (:OtherNoList AS CRITERIA_LIST_TABLE) '||
') OTHRNOS '||
'WHERE TAB1.C1 = OTHRNOS.COLUMN_VALUE ';
DBMS_OUTPUT.PUT_LINE('Query String is '||QUERY_STRING);
EXECUTE IMMEDIATE QUERY_STRING using OtherNoList;
END;p.s. not tested
Amiel Davis -
Unable to use sqlloader to load large data into a varchar2 column..plz.help
Hi,
Currently the column in the database is a varchar2(4000) coulmn that stores data in the form of xml and data that has many carrriage returns.
Current I am trying to archive this column value and later truncate the data in this column.
I was able to create a .csv file but when using the sqlloder ,the utility fails as the data I am about to load has data stored both in the form of "xml" sometimes and sometimes as a list of attributes separated by newline character.
After several failed attempts... I would like to know if it can be achieved using sqlloader or if sqlloader is a bad choice and i should go for an import/export instead?
Thanks in advance...
-KevinCurrently the column in the database is a
varchar2(4000) coulmn that stores data in the form of
xml and data that has many carrriage returns. Can I ask why your XML data has carriage returns in it? The nature of XML dictates that the structure is defined by the tags. Of course you can have CR's in your actual data between those tags, but if someone is hard coding CR's into the XML to make it look pretty this in not how XML was intended to be used.
I was able to create a .csv file but when using the
sqlloder ,the utility fails as the data I am about to
load has data stored both in the form of "xml"
sometimes and sometimes as a list of attributes
separated by newline character.It probably can be (can you provide a sample of data so we can see the structure) but you would probably be best revisiting the code that generates the CSV and ensure that it is output in a simpler format. -
Can I load 2 tables at a time using Sqlldr
Can I append into 2 tables using the flat file.
Yes u can append into 2 tables from SQLLDR.
Use the position clause in defining the columns
Suppose your flat file is :
1234yurtfg78
5678oisdn89
so on
and you want to insert data from column 1 from column 6 into table A and data from column cloumn 7 to cloumn 12 into table B, then u can write:
LOAD DATA
INFILE '<filename>'
BADFILE '<filename.bad>'
DISCARDFILE '<filename.dsc>'
RECLEN 12
INTO TABLE A
col1 POSITION(01:06) CHAR
INTO TABLE B
col2 POSITION(07:12) CHAR
) -
Using reflection to load dynamic commands
Hi,
I am writing an irc bot and I want commands to be automatically updated even while the bot is running. Here's my current situation:
Command interface:
public interface Command {
public int getLevel();
public String manual();
public void exec(String[] args);
}Every command implements the Command interface and is named cmd.XXXCommand, for example: cmd.HelloCommand. The command is executed like this:
// Get an instance of the command
Class c = Class.forName("cmd." + command + "Command");
Command cmd = (Command)c.newInstance();
// Execute the command
cmd.execute(args);Using the above approach new commands are automatically loaded and used by the running program. However an existing command is not updated while the program is running!
I guess the reason is that the JVM has a copy of the loaded classes in memory to improve performance. Is there a way to get around this?
Any help is appreciated. Thanks.Srini_Kandula,
I used a modified version of the FileClassLoader I found from Google. There was no comment left with it so I can't remember where exactly. But here's the code:
package quangntenemy.irc.bot;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class FileClassLoader extends ClassLoader {
private String root;
public FileClassLoader(String rootDir) {
if (rootDir == null)
throw new IllegalArgumentException("Null root directory");
root = rootDir;
} // end constructor
protected Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException {
Class c = findLoadedClass(name);
if (c == null) {
try {
c = findSystemClass(name);
} catch (Exception e) {
if (c == null) {
String filename = name.replace('.', File.separatorChar) + ".class";
try {
byte data[] = loadClassData(filename);
c = defineClass(name, data, 0, data.length);
if (c == null) throw new ClassNotFoundException(name);
} catch (IOException e) {
throw new ClassNotFoundException("Error reading file: "
+ filename);
if (resolve) resolveClass(c);
return c;
} // end loadClass
private byte[] loadClassData(String filename) throws IOException {
File f = new File(root, filename);
int size = (int) f.length();
byte buff[] = new byte[size];
FileInputStream fis = new FileInputStream(f);
DataInputStream dis = new DataInputStream(fis);
dis.readFully(buff);
dis.close();
return buff;
} // end loadClassData
} // end classAs ejp said, the key point is to "Use a new class loader for each load, and let the old one be GCd". Oh and the class should not be placed in the classpath, otherwise it has been loaded by the system ClassLoader.
_dnoyeB (Beyond? :D), yes I am starting to use a Security Manager for it as the code is growing too big to control access to system resources manually :) -
How to set setRowKey value when table is populated dynamically
Hi All
I have created a view object using only select statement and displaying all the records in it in the table at page load. Table is SelectMany. Now after selecting some records I press submit button. At the backend logic is executed which prints how many rows selected and the values of the selected rows. Everything works fine till here.
Now when the view object is modified by putting where clause. And the parameter to this where clause is coming from url. When the page is loaded table displays only records based on filter criteria. But the problem begins when I press the submit button. It shows the error: row is null for rowKey:oracle.jbo.Key[AAAQkHAAJAAAACkAAA ]
I have done some research and found that row key is not set for the displayed records. because at the backend when I am printing the values of keys in selectionState.KeySet it prints only null.
This thing happens only when table is populated dynamically through url value.
Can anyone help me how to get the selectionState.Keyset values when table is populated dynamically?SOLVED:
Actually there is no problem with the rowKeys as I mentioned in the post. What happened was that I was executing the query everytime on page load. Second time when the page is loaded the param value was set to null. So row becomes null but on the other hand I am referring the rows by some selected row keys. so the error that row is null for key...
So now i am storing the param value in managed bean and then referring it in the code. -
Convert EBCDIC to ASCII using sqlloader
hi..
i have .dat file which extract from mainframe in EBCDIC format n i have to load in table using sqlloader.
here, my .ctl sample:
AMTV2_RESERVE08 POSITION(857:861) DECIMAL(9,2),
AMTV2_RESERVE09 POSITION(862:866) DECIMAL(9,2)
here, my record layout
10 IN4331A-AMTV2-RESERVE08
PICTURE IS S9(7)V99
USAGE IS COMP-3
ELEMENT LENGTH IS 5
POSITION IS 857
10 IN4331A-AMTV2-RESERVE09
PICTURE IS S9(7)V99
USAGE IS COMP-3
ELEMENT LENGTH IS 5
POSITION IS 862
when i run the sqlloader, i got this error:
Invalid packed decimal nibble.
what must i do?
thanksi'm using this
load data
characterset we8ebcdic500
infile '/xxxxx/abc.dat
"fix 866"
replace
into table A
TRAILING NULLCOLS
AMTV2_RESERVE08 POSITION(857:861) DECIMAL(9,2),
AMTV2_RESERVE09 POSITION(862:866) DECIMAL(9,2)
i'm using windows OS and using PUTTY to run this sqlloader.
but, i still have "Invalid packed decimal nibble" errors.. whats the prob with my .ctl file actually? -
Sql Loader by using shell script, not able to insert data
Hi,
I am trying to dump the data by using shell script.(in shell script i am having sqlldr command)(its a host excutable method cocurrent program)
When i am loading the data, by placing my files(.ctl,.prog,.csv,symbolink file for .prog) in $Custom_top/bin, it is loading exactly. 17000 records inserted.
But if i am loading the data by placing my files in $custom_top/custom_folders. unable to insert total data. only 43 records inserting.
Please any one can help me.
Thanks in advance.
Rama.Srini, Thanks a lot for ur reply,
Oracle Apps version R12,
Microsoft windows XP profissional
Version 2002 service Pack 3
My Control file Script is:
load data
infile '$XADP_TOP/data/CPIU/in/XXOKS_Price_Increase.csv'
append
into table XXOKS_CONTRACT_PRICE_INCR_DTLS
fields terminated BY ',' optionally enclosed by '"'
TRAILING NULLCOLS
(EXCLUSION_FLAG,
LEGACY_NUMBER,
CUSTOMER_NUMBER,
CUSTOMER_NAME,
REQUEST_ID,
CONTRACT_NUMBER,
CONTRACT_START_DATE,
CONTRACT_END,
REQUEST_LINE_ID,
LINE_START_DATE,
LINE_END_DATE,
ITEM_NUMBER,
ITEM_DESCRIPTION,
UNIT_PRICE,
QTY,
NEW_UNIT_PRICE,
LINE_AMOUNT,
NEW_LINE_AMOUNT,
PRICE_INCREASED_DATE,
PERCENTAGE_INCREASED,
ORIGINAL_CONTRACT_AMOUNT,
NEW_CONTRACT_AMOUNT,
PRICE_INCREASE_AMOUNT)
My .prog File is: Please fidn that i created symbolink file also for my .prog.
if [ -z $XADP_TOP ];then
echo "XADP_TOP environment variable is not set!"
exit 1
fi
cd $XADP_TOP/data/CPIU/in
DATE=`date +%y%m%d:%H%M`
i_program_name="$0"
i_ora_pwd="$1"
i_user_id="$2"
i_user_name="$3"
i_request_id="$4"
i_ftp_host_name="$5"
i_ftp_user_name="$6"
i_ftp_user_password="$7"
ftp_prog() {
# FTP Function to reuse the FTP Commands
if [ $# -ne 6 ];then
echo "Usage : ftp_prog <Hostname> <User name> <Password> <Remote Directory> <command> <filename>"
exit 2
fi
l_ftp_host_name="$1"
l_ftp_user_name="$2"
l_ftp_user_password="$3"
l_ftpdir="$4"
l_ftp_command="$5"
l_ftp_filename="$6"
ftp -v -n ${l_ftp_host_name} <<EOF
user ${l_ftp_user_name} ${l_ftp_user_password}
ascii
cd ${l_ftpdir}
${l_ftp_command} ${l_ftp_filename}
quit
EOF
#exit $?
# setting the ftp directory
#ftpdir="/`echo ${TWO_TASK:-$ORACLE_SID}|tr "[A-Z]" "[a-z]"`/CPIU"
##ftpdir="/FinTEST/quoting/PS/ar"
ftpdir="$XADP_TOP/data/CPIU/in"
# setting the in directory and out directory
indir="$XADP_TOP/data/CPIU/in"
outdir="$XADP_TOP/data/CPIU/out"
ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} get XXOKS_Price_Increase.csv
echo $ftpdir
echo "Converting the data file into unix mode"
dos2unix XXOKS_Price_Increase.csv XXOKS_Price_Increase.csv
chmod 777 XXOKS_Price_Increase.csv
cd $XADP_TOP/bin
echo "Trying to excute sqlldr and entering into the into control file"
$ORACLE_HOME/bin/sqlldr userid=$i_ora_pwd control=XXOKS_PRICE_INCR_LOAD log=$XADP_TOP/log/XXOKS_PRICE_INCR_LOAD_${DATE}.log;
exit_status=$?
echo "Checking the status and giving permissions to the data file which in in dir"
if [ $exit_status -eq 0 ]; then
cd $XADP_TOP/data/CPIU/in
chmod 777 XXOKS_Price_Increase.csv
echo "try to move data file into out dir"
# Moving the file to out directory
mv XXOKS_Price_Increase.csv ${outdir}/XXOKS_Price_Increase.csv_${DATE}
#echo "ready to zip file in out dir step6"
# Zipping the file
#gzip -f ${outdir}/XXOKS_Price_Increase.csv_${DATE}
echo "deleting the file which is in dir"
# Deleting the file from in directory
/bin/rm -f ${indir}/XXOKS_Price_Increase.csv
# Deleting from the remote directory
ftp_prog ${i_ftp_host_name} ${i_ftp_user_name} ${i_ftp_user_password} ${ftpdir} delete XXOKS_Price_Increase.csv
echo "sqlloader finished successfully."
else
echo "Error in loader"
##echo "Loader error in Price Increase Detials File ${i_file}"
fi
exit $exit_status
And My Log file Comments are
SQL*Loader: Release 10.1.0.5.0 - Production on Thu Dec 3 01:32:08 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: XXOKS_PRICE_INCR_LOAD.ctl
Data File: /oesapp/applmgr/GIS11/apps/apps_st/appl/xadp/12.0.0/data/CPIU/in/XXOKS_Price_Increase.csv
Bad File: XXOKS_Price_Increase.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 XXOKS_CONTRACT_PRICE_INCR_DTLS, 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
EXCLUSION_FLAG FIRST * , O(") CHARACTER
LEGACY_NUMBER NEXT * , O(") CHARACTER
CUSTOMER_NUMBER NEXT * , O(") CHARACTER
CUSTOMER_NAME NEXT * , O(") CHARACTER
REQUEST_ID NEXT * , O(") CHARACTER
CONTRACT_NUMBER NEXT * , O(") CHARACTER
CONTRACT_START_DATE NEXT * , O(") CHARACTER
CONTRACT_END NEXT * , O(") CHARACTER
REQUEST_LINE_ID NEXT * , O(") CHARACTER
LINE_START_DATE NEXT * , O(") CHARACTER
LINE_END_DATE NEXT * , O(") CHARACTER
ITEM_NUMBER NEXT * , O(") CHARACTER
ITEM_DESCRIPTION NEXT * , O(") CHARACTER
UNIT_PRICE NEXT * , O(") CHARACTER
QTY NEXT * , O(") CHARACTER
NEW_UNIT_PRICE NEXT * , O(") CHARACTER
LINE_AMOUNT NEXT * , O(") CHARACTER
NEW_LINE_AMOUNT NEXT * , O(") CHARACTER
PRICE_INCREASED_DATE NEXT * , O(") CHARACTER
PERCENTAGE_INCREASED NEXT * , O(") CHARACTER
ORIGINAL_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
NEW_CONTRACT_AMOUNT NEXT * , O(") CHARACTER
PRICE_INCREASE_AMOUNT NEXT * , O(") CHARACTER
value used for ROWS parameter changed from 64 to 43
Table XXOKS_CONTRACT_PRICE_INCR_DTLS:
43 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: 255162 bytes(43 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 43
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Thu Dec 03 01:32:08 2009
Run ended on Thu Dec 03 01:32:08 2009
Elapsed time was: 00:00:00.19
CPU time was: 00:00:00.04
Plz srini help me.
Thanks in advance
Rama..
Maybe you are looking for
-
Using previous results in a query
Hi Please can someone assist. I have a bex query - 1 structure only in my columns I have my data in rows broken down by calendar year. What I need to be able to do is to use the result in calendar year 2008 and sum it in calendar year 2009. Calenda
-
GRC AC 10.0 Role Import function
Hi experts, I'm trying to use the import role function in NWBC. So I take "File from Desktop" for both role attribute source and role authorization source as below picture I've tried to execute the mentioned t-code: /GRCPI/AC_ROLE_DNLD in backend sys
-
Thinkpas X220 Wi Fi connectivity issue
Hi everyone, I have a problem with the wi fi connection in my laptop, the computer doesent read the wirelees divise. when I click Fn F5 all I can see is the bluetooth adapter, no wifi adapter to turn on or off, this have been happening reacently, ye
-
Dear All i have developed a custom WDA Application which consist of one iView. I need to take the printout of that iView. I am not able to get the print option for that iView. Pleas help me , how can i get the print out of that iView Note: Taking
-
I want to update mass Outline Agreement in Purchase orders. Can you please guide me on the same. Thnx Abhi