Charger xml with sql loader in an xmltype table and show that contain it this XML table
Hello
I have a xml document and I want to load in an xmltype table.
the control file is:
now, I want to show the content of the xml file that is loaded at the time of table. How do you?
but this does not show the content of this xml file, but only total, this xml code. Thank you |
Hello
Try to take a look at the Oracle XML SQL functions:
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28369/xdb04cre.htm
Tags: Database
Similar Questions
-
When I imported the photos from my hard drive some only partially loaded with only half of the growth of the photo?
Go to the Lightroom preferences > performance > uncheck 'use the graphics processor' > import images and test them.
-
I have a third-party site that transforms the information into a csv summary. I can't change the format, and they are not ready to give directly from db and db, so I try and then import it. I'm trying to use SQL Loader, but I can't seem to make it work. I looked in the documentation (VERY rare examples) as well as several websites and I can't find anything that can help out me.
Control file:
Note that the line WHEN is commented out, because I can't make it work.LOAD DATA INFILE 'Daily_Diagnostics_test.csv' BADFILE 'Diag_failed.csv' APPEND INTO TABLE ROAD_DIAGS FIELDS TERMINATED BY "," --WHEN VEHICLE != 'Vehicle' AND VEHICLE != 'Total' (VEHICLE, DRIVER, START_DATE, START_TIME, START_TZ, END_DATE, END_TIME, END_TZ, TM_DRV_MINS, TM_IDLE_MINS, TM_PTO_MINS, TRIP_TM_MINS, FUEL_DRV_GALS, FUEL_IDLE_GALS, FUEL_PTO_GALS, FUEL_TRIP_GALS, FUEL_START_GALS, MPG, DRV_MPG, START_ODOM, END_ODOM, DIFF_ODOM, AVG_MPH, MAX_MPH, MAX_RPM, DATE1, TM1, TZ1, ADDRESS_NUM1, ADDRESS_STREET1, ADDRESS_ST1, ADDRESS_ZIP1, ADDRESS_COUNTY1, DATE2, TM2, TZ2, ADDRESS_NUM2, ADDRESS_STREET2, ADDRESS_ST2, ADDRESS_ZIP2, ADDRESS_COUNTY2, STOP_CT, FAULT_CODE, HARD_BRAKE)
and here is a sample of the data:
As you can see, I need to have the SQL Loader to ignore the header and summary lines that appear for each grouping. Your suggestions are welcome as I need to implement this in an automatic process, I can call with a batch script.Vehicle,Driver,Start Date,Start Time,Timezone,End Date,End Time,Timezone,Driving (hh:mm),Idle (hh:mm),PTO (hh:mm),Trip (hh:mm),Driving (gals),Idle (gals),PTO (gals),Trip (gals),Before Trip (gals), MPG,Driving MPG,Start,End,Trip Distance (miles),Average(MPH),Maximum(MPH),Maximum RPM(rpm),Date,Time,Timezone,Address,Street,City,State,Zip,County,Date,Time,Timezone,Address,Street,City,State,Zip,County,Stop Count,Fault Code,Hard Brake, 26033, ,01/23/08,12:40 AM,MST,01/23/08,12:42 AM,MST,0,3,0,3,0,0.12,0,0.12, ,0,0,295829.22,295829.22,0,0,6.84, ,01/23/08,12:23 AM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,01/23/08,12:23 AM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,0,4, , 26033, ,01/23/08,12:43 AM,MST,01/23/08,04:03 AM,MST,126,74,0,200,0,0,0,0, ,0,0,295829.22,295914.97,85.75,25.72,67.11, ,01/23/08,12:23 AM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,01/23/08,03:56 AM,MST,0,COUNTY ROAD 125,SIDNEY,MT,59270,RICHLAND,8,3, , 26033, ,01/23/08,04:03 AM,MST,01/23/08,12:29 PM,MST,317,190,0,507,0,0,0,0, ,0,0,295914.97,296139.9,224.94,26.64,65.87, ,01/23/08,03:56 AM,MST,0,COUNTY ROAD 125,SIDNEY,MT,59270,RICHLAND,01/23/08,12:29 PM,MST,756,BELL RD,SIDNEY,MT,59270,RICHLAND,14,5, , Total, , , ,443,267,0,710,0,0.12,0,0.12, ,0,0,295829.22,296139.91,310.69,26.38,67.11, , , , , , , , , , , , , , , , , , , ,22,12,0, Vehicle,Driver,Start Date,Start Time,Timezone,End Date,End Time,Timezone,Driving (hh:mm),Idle (hh:mm),PTO (hh:mm),Trip (hh:mm),Driving (gals),Idle (gals),PTO (gals),Trip (gals),Before Trip (gals), MPG,Driving MPG,Start,End,Trip Distance (miles),Average(MPH),Maximum(MPH),Maximum RPM(rpm),Date,Time,Timezone,Address,Street,City,State,Zip,County,Date,Time,Timezone,Address,Street,City,State,Zip,County,Stop Count,Fault Code,Hard Brake, 26035, ,01/23/08,03:59 AM,MST,01/23/08,09:05 AM,MST,222,85,0,306,50.87,1.5,0,52.37, ,3.32,3.42,285056.53,285230.5,173.98,34.07,68.97, ,01/23/08,03:24 AM,MST,756,BELL RD,SIDNEY,MT,59270,RICHLAND,01/23/08,09:00 AM,MST,0,COUNTY ROAD 338,SAVAGE,MT,59262,RICHLAND,7,3, , 26035, ,01/23/08,09:06 AM,MST,01/23/08,03:37 PM,MST,273,118,0,391,68.5,1.5,0,70, ,3.24,3.31,285230.5,285457.3,226.8,34.8,69.59, ,01/23/08,09:00 AM,MST,0,COUNTY ROAD 338,SAVAGE,MT,59262,RICHLAND,01/23/08,03:37 PM,MST,756,BELL RD,SIDNEY,MT,59270,RICHLAND,11,3, , 26035, ,01/23/08,03:45 PM,MST,01/23/08,04:38 PM,MST,32,21,0,53,7.37,0.25,0,7.62, ,3.42,3.54,285457.3,285483.4,26.1,29.73,67.73, ,01/23/08,03:37 PM,MST,756,BELL RD,SIDNEY,MT,59270,RICHLAND,01/23/08,04:33 PM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,2,3, , 26035, ,01/23/08,04:49 PM,MST,01/23/08,10:22 PM,MST,256,76,0,332,52,1.25,0,53.25, ,3.71,3.8,285483.4,285681.0,197.6,35.67,64, ,01/23/08,04:33 PM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,01/23/08,10:17 PM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,9,3, , 26035, ,01/23/08,10:25 PM,MST,01/23/08,10:35 PM,MST,4,5,0,10,0.37,0,0,0.37, ,1.68,1.68,285681.0,285681.62,0.62,3.9,24.85, ,01/23/08,10:17 PM,MST,0,COUNTY ROAD 108,SAVAGE,MT,59262,RICHLAND,01/23/08,10:35 PM,MST,0,COUNTY ROAD 338,SAVAGE,MT,59262,RICHLAND,1,5, , Total, , , ,787,305,0,1092,179.11,4.5,0,183.61, ,3.4,3.49,285056.53,285681.62,625.1,34.35,69.59, , , , , , , , , , , , , , , , , , , ,30,17,0,
blarman74 wrote:
Can anyone suggest how to fix this problem? The log file shows this error:Record 8: Rejected - Error on table ROAD_DIAGS, column DATE2. ORA-01858: a non-numeric character was found where a numeric was expected
The error message is clear - you try to load a value "non-date" in a DATE column and, therefore, sql * loader berms.
That points to a discrepancy between the list of columns in the control file and, in the data file.
Note the position of the table of the "DATE2" column in the table "ROAD_DIAGS":test@XE> test@XE> l 1 select table_name, 2 column_name, 3 column_id 4 from user_tab_columns 5 where table_name='ROAD_DIAGS' 6* and column_name='DATE2' test@XE> / TABLE_NAME COLUMN_NAME COLUMN_ID --------------- --------------- ---------- ROAD_DIAGS DATE2 34 test@XE>
If your control file specifies that the 34th column in the data file must be "DATE2". However-
test@XE> test@XE> -- display the line number and the 34th column of the data file test@XE> test@XE> !perl -ne '{@a=split/,/; print $.,"\t",$a[33],"\n"}' Daily_Diagnostics_test.csv 1 County 2 RICHLAND 3 RICHLAND 4 RICHLAND 5 6 County 7 RICHLAND 8 RICHLAND 9 RICHLAND 10 RICHLAND 11 RICHLAND 12 test@XE>
the 34th column in your data file is 'COUNTY', which is counted in your control file.
Here is the list of the columns for 29 to 37 positions in the csv file:
test@XE> test@XE> !perl -ne '{if ($. == 1) {@a=split/,/; foreach $i (28..36) {print $i+1,"\t",$a[$i],"\n"}}}' Daily_Diagnostics_test.csv 29 Address 30 Street 31 City 32 State 33 Zip 34 County 35 Date 36 Time 37 Timezone test@XE> test@XE>
And here are the columns specified in the control file:
... ... ADDRESS_NUM1, ADDRESS_STREET1, ADDRESS_ST1, ADDRESS_ZIP1, ADDRESS_COUNTY1, DATE2 DATE "MM/DD/YYYY", TM2 DATE "HH:MI AM", TZ2, ... ...
(You can open the csv file in MS Excel to get a better picture of the data in there).
As seen above, due to the incompatibility, sql * loader loads 'City' in ADDRESS_ST1, 'State' in ADDRESS_ZIP1, "Zip" in ADDRESS_COUNTY1 and DATE2 "County" - where it error.
The solution would be-
(a) If you want to load the 'City' information from the data file, and then add the "City" column in the table (if nonexistent) and specify in the control file.
(b) If you do not want to load the 'City' information from the data file, you can specify a column to 'FILL' in the file of control as follows:
... ... ADDRESS_NUM1, ADDRESS_STREET1, city1 FILLER, ADDRESS_ST1, ADDRESS_ZIP1, ADDRESS_COUNTY1, DATE2 DATE "MM/DD/YYYY", TM2 DATE "HH:MI AM", TZ2, ADDRESS_NUM2, ADDRESS_STREET2, city2 FILLER, ADDRESS_ST2, ADDRESS_ZIP2, ADDRESS_COUNTY2, ... ...
Hope that helps,
isotope -
I just wrote about firefox 3.6 with 5.0 for my mac OSX and discovered that my mac will not support it. Is there a way I can recover my lost files and recover the old version?
You can download and install Firefox 3.6 http://www.mozilla.com/firefox/all-older.html
-
Hi Experts,
I have a file in the following format. I have to insert the data from these files in a table. Can I use SQL Loader to load these files.
My question is that I need to schedule the download of these files. Can I integrate sql loader in a procedure?
Agent Id|Agent Type|Create Date|Termination CDC|Activation CDC|Deactivation CDC|Agent IdX|Agent Status|Status Date|Status Reason Code|Update CDC|Update Serial|Update User|New Owner Agent Id|Previous Owner Agent Id|Agent Name|Primary Address1|Primary Address2|Primary Address3|Secondary Address1|Secondary Address2|Secondary Address3| Primary City|Primary State|Primary Zip|Primary Zip Suffix|Primary Country|Secondary City|Secondary State|Secondary Zip|Secondary Zip Suffix|Secondary Country|Phone Number|Fax number|Mobile Number|Business Type|Field Rep|Bill to Chain Id|Mon Open Time|Mon Close Time|Tue Open Time|Tue Close Time|Wed Open Time|Wed Close Time|Thu Open Time|Thu Close Time|Fri Open Time|Fri Close Time|Sat Open Time|Sat Close Time|Sun Open Time|Sun Close Time|Zone Id|Line Charge Class|Chain Id|Chain Code| Primary Contact Name| Primary Contact Title| Primary Contact Phone|Secondary Contact Name|Secondary Contact Title|Secondary Contact Phone|Tertiary contact Name|Tertiary Contact Title|Tertiary Contact Phone| Bank Id| Bank Account Id| bank Account Type| Bank Account Date| EFT Flag| Fund Limit|Invoicable|TaxCode|Tax Id|Sales Tax|Service Charge|Instant Cashing Type|Instant Telsel Rep| Instant Number of Bins| Instant Number Itvms| InstantCredit Limit|Auto Reorder| Instant Terminal Reorder| Instant Telsel Reorder| Instant Teleset Active CDC| Instant Initial Distribution|Auto Telsel Schedule| Instant Auto Settle| Instant Call Day| Instant Call Week| Instant Call Cycle| Instant Order Restriction| Instant Delivery Flag| Instant Account Type| Instant Settle Class| Region|County|Territory|Route|Chain Statement|Master Agent Id| Minority Owned| Tax Name| State Tax Id|Mailing Name| Bank Account Name| DSR 0|1|0|0|0|0|0|1|0|0|302|0|0|0|0|||||||||||||||||||||0|0|0|||||||||||||||0|0|0|||||||||||||0|-2145916800|0|0|0|0||0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0||0|0|0||||| 1|1|1256213087|0|-39081|-39081|1|2|1256213087|999|302|0|0|0|0|Pseudo Outlet||||||||MU|||MU||MU|||MU||||0|0|1|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|0|0|0||||||||||||| {code) Edited by: Kevin CK on 02-Feb-2010 03:28
Here you go...
drop table agent_dump_csv_temp / create table agent_dump_csv_temp (Agent_Id NUMBER ,Agent_Type NUMBER ,Create_Date NUMBER ,Termination_CDC NUMBER ,Activation_CDC NUMBER ,Deactivation_CDC NUMBER ,Agent_IdX NUMBER ,Agent_Status NUMBER ,Status_Date NUMBER ,Status_Reason_Code NUMBER ,Update_CDC NUMBER ,Update_Serial NUMBER ,Update_User NUMBER ,New_Owner_Agent_Id NUMBER ,Previous_Owner_Agent_Id NUMBER ,Agent_Name VARCHAR2(50) ,Primary_Address1 VARCHAR2(50) ,Primary_Address2 VARCHAR2(50) ,Primary_Address3 VARCHAR2(50) ,Secondary_Address1 VARCHAR2(50) ,Secondary_Address2 VARCHAR2(50) ,Secondary_Address3 VARCHAR2(50) ,Primary_City VARCHAR2(50) ,Primary_State VARCHAR2(50) ,Primary_Zip VARCHAR2(50) ,Primary_Zip_Suffix VARCHAR2(50) ,Primary_Country VARCHAR2(50) ,Secondary_City VARCHAR2(50) ,Secondary_State VARCHAR2(50) ,Secondary_Zip VARCHAR2(50) ,Secondary_Zip_Suffix VARCHAR2(50) ,Secondary_Country VARCHAR2(50) ,Phone_Number VARCHAR2(50) ,Fax_number VARCHAR2(50) ,Mobile_Number VARCHAR2(50) ,Business_Type NUMBER ,Field_Rep NUMBER ,Bill_to_Chain_Id NUMBER ,Mon_Open_Time VARCHAR2(5) ,Mon_Close_Time VARCHAR2(5) ,Tue_Open_Time VARCHAR2(5) ,Tue_Close_Time VARCHAR2(5) ,Wed_Open_Time VARCHAR2(5) ,Wed_Close_Time VARCHAR2(5) ,Thu_Open_Time VARCHAR2(5) ,Thu_Close_Time VARCHAR2(5) ,Fri_Open_Time VARCHAR2(5) ,Fri_Close_Time VARCHAR2(5) ,Sat_Open_Time VARCHAR2(5) ,Sat_Close_Time VARCHAR2(5) ,Sun_Open_Time VARCHAR2(5) ,Sun_Close_Time VARCHAR2(5) ,Zone_Id NUMBER ,Line_Charge_Class NUMBER ,Chain_Id NUMBER ,Chain_Code NUMBER ,Primary_Contact_Name VARCHAR2(50) ,Primary_Contact_Title VARCHAR2(50) ,Primary_Contact_Phone VARCHAR2(50) ,Secondary_Contact_Name VARCHAR2(50) ,Secondary_Contact_Title VARCHAR2(50) ,Secondary_Contact_Phone VARCHAR2(50) ,Tertiary_contact_Name VARCHAR2(50) ,Tertiary_Contact_Title VARCHAR2(50) ,Tertiary_Contact_Phone VARCHAR2(50) ,Bank_Id NUMBER ,Bank_Account_Id NUMBER ,Bank_Account_Type NUMBER ,Bank_Account_Date NUMBER ,EFT_Flag NUMBER ,Fund_Limit NUMBER ,Invoicable NUMBER ,TaxCode NUMBER ,Tax_Id NUMBER ,Sales_Tax NUMBER ,Service_Charge NUMBER ,Instant_Cashing_Type NUMBER ,Instant_Telsel_Rep NUMBER ,Instant_Number_of_Bins NUMBER ,Instant_Number_Itvms NUMBER ,InstantCredit_Limit NUMBER ,Auto_Reorder NUMBER ,Instant_Terminal_Reorder NUMBER ,Instant_Telsel_Reorder NUMBER ,Instant_Teleset_Active_CDC NUMBER ,Instant_Initial_Distribution NUMBER ,Auto_Telsel_Schedule NUMBER ,Instant_Auto_Settle NUMBER ,Instant_Call_Day NUMBER ,Instant_Call_Week NUMBER ,Instant_Call_Cycle NUMBER ,Instant_Order_Restriction NUMBER ,Instant_Delivery_Flag NUMBER ,Instant_Account_Type NUMBER ,Instant_Settle_Class NUMBER ,Region NUMBER ,County NUMBER ,Territory_x NUMBER ,Route NUMBER ,Chain_Statement NUMBER ,Master_Agent_Id NUMBER ,Minority_Owned NUMBER ,Tax_Name VARCHAR2(50) ,State_Tax_Id NUMBER ,Mailing_Name VARCHAR2(50) ,Bank_Account_Name VARCHAR2(50) ,DSR NUMBER ) ORGANIZATION EXTERNAL ( TYPE oracle_loader DEFAULT DIRECTORY TEST_DIR ACCESS PARAMETERS ( RECORDS DELIMITED BY NEWLINE SKIP 1 BADFILE 'test.bad' DISCARDFILE 'test.dis' LOGFILE 'test.log' FIELDS TERMINATED BY '|' MISSING FIELD VALUES ARE NULL REJECT ROWS WITH ALL NULL FIELDS (Agent_Id ,Agent_Type ,Create_Date ,Termination_CDC ,Activation_CDC ,Deactivation_CDC ,Agent_IdX ,Agent_Status ,Status_Date ,Status_Reason_Code ,Update_CDC ,Update_Serial ,Update_User ,New_Owner_Agent_Id ,Previous_Owner_Agent_Id ,Agent_Name ,Primary_Address1 ,Primary_Address2 ,Primary_Address3 ,Secondary_Address1 ,Secondary_Address2 ,Secondary_Address3 ,Primary_City ,Primary_State ,Primary_Zip ,Primary_Zip_Suffix ,Primary_Country ,Secondary_City ,Secondary_State ,Secondary_Zip ,Secondary_Zip_Suffix ,Secondary_Country ,Phone_Number ,Fax_number ,Mobile_Number ,Business_Type ,Field_Rep ,Bill_to_Chain_Id ,Mon_Open_Time ,Mon_Close_Time ,Tue_Open_Time ,Tue_Close_Time ,Wed_Open_Time ,Wed_Close_Time ,Thu_Open_Time ,Thu_Close_Time ,Fri_Open_Time ,Fri_Close_Time ,Sat_Open_Time ,Sat_Close_Time ,Sun_Open_Time ,Sun_Close_Time ,Zone_Id ,Line_Charge_Class ,Chain_Id ,Chain_Code ,Primary_Contact_Name ,Primary_Contact_Title ,Primary_Contact_Phone ,Secondary_Contact_Name ,Secondary_Contact_Title ,Secondary_Contact_Phone ,Tertiary_contact_Name ,Tertiary_Contact_Title ,Tertiary_Contact_Phone ,Bank_Id ,Bank_Account_Id ,Bank_Account_Type ,Bank_Account_Date ,EFT_Flag ,Fund_Limit ,Invoicable ,TaxCode ,Tax_Id ,Sales_Tax ,Service_Charge ,Instant_Cashing_Type ,Instant_Telsel_Rep ,Instant_Number_of_Bins ,Instant_Number_Itvms ,InstantCredit_Limit ,Auto_Reorder ,Instant_Terminal_Reorder ,Instant_Telsel_Reorder ,Instant_Teleset_Active_CDC ,Instant_Initial_Distribution ,Auto_Telsel_Schedule ,Instant_Auto_Settle ,Instant_Call_Day ,Instant_Call_Week ,Instant_Call_Cycle ,Instant_Order_Restriction ,Instant_Delivery_Flag ,Instant_Account_Type ,Instant_Settle_Class ,Region ,County ,Territory_x ,Route ,Chain_Statement ,Master_Agent_Id ,Minority_Owned ,Tax_Name ,State_Tax_Id ,Mailing_Name ,Bank_Account_Name ,DSR ) ) LOCATION ('test.txt') ) PARALLEL REJECT LIMIT UNLIMITED / SQL> select * from agent_dump_csv_temp 2 / AGENT_ID AGENT_TYPE CREATE_DATE TERMINATION_CDC ACTIVATION_CDC DEACTIVATION_CDC AGENT_IDX AGENT_STATUS STATUS_DATE STATUS_REASON_CODE UPDATE_CDC UPDATE_SERIAL UPDATE_USER NEW_OWNER_AGENT_ID PREVIOUS_OWNER_AGENT_ID ---------- ---------- ----------- --------------- -------------- ---------------- ---------- ------------ ----------- ------------------ ---------- ------------- ----------- ------------------ ----------------------- AGENT_NAME PRIMARY_ADDRESS1 PRIMARY_ADDRESS2 PRIMARY_ADDRESS3 -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- SECONDARY_ADDRESS1 SECONDARY_ADDRESS2 SECONDARY_ADDRESS3 PRIMARY_CITY -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- PRIMARY_STATE PRIMARY_ZIP PRIMARY_ZIP_SUFFIX PRIMARY_COUNTRY -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- SECONDARY_CITY SECONDARY_STATE SECONDARY_ZIP SECONDARY_ZIP_SUFFIX -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- SECONDARY_COUNTRY PHONE_NUMBER FAX_NUMBER MOBILE_NUMBER BUSINESS_TYPE FIELD_REP BILL_TO_CHAIN_ID -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ------------- ---------- ---------------- MON_O MON_C TUE_O TUE_C WED_O WED_C THU_O THU_C FRI_O FRI_C SAT_O SAT_C SUN_O SUN_C ZONE_ID LINE_CHARGE_CLASS CHAIN_ID CHAIN_CODE PRIMARY_CONTACT_NAME PRIMARY_CONTACT_TITLE ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---------- ----------------- ---------- ---------- -------------------------------------------------- -------------------------------------------------- PRIMARY_CONTACT_PHONE SECONDARY_CONTACT_NAME SECONDARY_CONTACT_TITLE SECONDARY_CONTACT_PHONE -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- TERTIARY_CONTACT_NAME TERTIARY_CONTACT_TITLE TERTIARY_CONTACT_PHONE BANK_ID BANK_ACCOUNT_ID BANK_ACCOUNT_TYPE BANK_ACCOUNT_DATE EFT_FLAG FUND_LIMIT INVOICABLE -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------- --------------- ----------------- ----------------- ---------- ---------- ---------- TAXCODE TAX_ID SALES_TAX SERVICE_CHARGE INSTANT_CASHING_TYPE INSTANT_TELSEL_REP INSTANT_NUMBER_OF_BINS INSTANT_NUMBER_ITVMS INSTANTCREDIT_LIMIT AUTO_REORDER INSTANT_TERMINAL_REORDER INSTANT_TELSEL_REORDER INSTANT_TELESET_ACTIVE_CDC ---------- ---------- ---------- -------------- -------------------- ------------------ ---------------------- -------------------- ------------------- ------------ ------------------------ ---------------------- -------------------------- INSTANT_INITIAL_DISTRIBUTION AUTO_TELSEL_SCHEDULE INSTANT_AUTO_SETTLE INSTANT_CALL_DAY INSTANT_CALL_WEEK INSTANT_CALL_CYCLE INSTANT_ORDER_RESTRICTION INSTANT_DELIVERY_FLAG INSTANT_ACCOUNT_TYPE INSTANT_SETTLE_CLASS REGION COUNTY TERRITORY_X ---------------------------- -------------------- ------------------- ---------------- ----------------- ------------------ ------------------------- --------------------- -------------------- -------------------- ---------- ---------- ----------- ROUTE CHAIN_STATEMENT MASTER_AGENT_ID MINORITY_OWNED TAX_NAME STATE_TAX_ID MAILING_NAME BANK_ACCOUNT_NAME DSR ---------- --------------- --------------- -------------- -------------------------------------------------- ------------ -------------------------------------------------- -------------------------------------------------- ---------- 0 1 0 0 0 0 0 1 0 0 302 0 0 0 0 0 0 0 0 0 0 0 -2.146E+09 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1256213087 0 -39081 -39081 1 2 1256213087 999 302 0 0 0 0 Pseudo Outlet MU MU MU MU 0 0 1 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 0 0 0 1 -2.146E+09 1 0 1 0 0 0 0 0 0 0 0 0 0 0 -3287 0 0 0 1 1 2 0 0 0 1 0 999 0 5 0 0 SQL>
He dislikes the identifier 'territory', so I renamed it to "territory_x" (I guess that's a reserved word).
Your initial problem you had was your fields "SEPARATED"... instead of "TERMINATED" by. ;) -
Hi s/n,.
I am facing problems when loading the dates in the database by using sql loader. My data file can have several date formats, so I have a function that interprets date and removes the time settings and the date of return.
Something like that.
For example:
I have a table-
CREATE TABLE TEMP1234
(
IDENTIFICATION NUMBER,
DATE OF ASOF_DATE
);
Data file
10001172 | 09/12/1945
Control file:
OPTIONS (DIRECT = TRUE, SILENT (FEEDBACK) =, skip = 0)
DATA RELATING TO SUNK COSTS
REPLACE
in the temp1234 table
' fields completed by "|" possibly provided by ' "'
TRAILING NULLCOLS
(ID,
ASOF_DATE "decode (: ASOF_DATE, null,:ASOF_DATE,conv_date1(:ASOF_DATE))).
)
Function CONV_DATE1:
FUNCTION to CREATE or REPLACE conv_date1 (p_str IN VARCHAR2)
DATE OF RETURN
IS
RETURN_VALUE DATE;p_str1 VARCHAR2 (15): = NULL;
FmtArray TYPE IS a TABLE OF VARCHAR2 (30);
g_fmts fmtArray
: = fmtArray ("yyyy-mm-dd",
"yyyy/mm/dd"
mm/dd/yyyy"."
"dd-mm-yyyy",
"dd/mm/yyyy",
"mm-dd-yyyy");
BEGIN
p_str1: = SUBSTR (p_str, 1, 10);BECAUSE me in 1... g_fmts. COUNTY
LOOP
BEGIN
return_value: = TO_DATE (p_str1, g_fmts (i));
EXIT;
EXCEPTION
WHILE OTHERS
THEN
NULL;
END;
END LOOP;IF (return_value IS NULL)
THEN
RAISE PROGRAM_ERROR;
END IF;RETURN Return_value;
END;
/In this case, if the year in the data file shown in 1945, date which is load in the poster 2045 database.
But when I run this function by putting a sql editor - it returns the correct value.
Select double conv_date1('12/09/1945');
Please help me understand what is causing the problem.
I think there may be an implicit conversion going on with the combination of decode and checking nvl and function within SQL * Loader. I put the nvl checking in function and simply use the function in the control file, as shown below.
OPTIONS (DIRECT = TRUE, SILENT (FEEDBACK) =, skip = 0)
DATA RELATING TO SUNK COSTS
REPLACE
in the temp1234 table
' fields completed by "|" possibly provided by ' "'
TRAILING NULLCOLS
(ID,
asof_date ' conv_date1 (: asof_date).
)
FUNCTION to CREATE or REPLACE conv_date1 (p_str IN VARCHAR2)
DATE OF RETURN
IS
RETURN_VALUE DATE;
p_str1 VARCHAR2 (15): = NULL;
FmtArray TYPE IS a TABLE OF VARCHAR2 (30);
g_fmts fmtArray
: = fmtArray ("yyyy-mm-dd",
"yyyy/mm/dd"
mm/dd/yyyy"."
"dd-mm-yyyy",
"dd/mm/yyyy",
"mm-dd-yyyy");
BEGIN
IF p_str IS NULL
THEN RETURN NULL;
ON THE OTHER
p_str1: = SUBSTR (p_str, 1, 10);
BECAUSE me in 1... g_fmts. COUNTY
LOOP
BEGIN
return_value: = TO_DATE (p_str1, g_fmts (i));
EXIT;
EXCEPTION
WHILE OTHERS
THEN
NULL;
END;
END LOOP;
IF (return_value IS NULL)
THEN
RAISE PROGRAM_ERROR;
END IF;
RETURN Return_value;
END IF;
END;
/
-
Encapsulate data problems when loading with sql loader
Hi all
I use sql loader to load data into a flat file HP UNIX.
I find the fi the NUMBER data type or date type get wraped to the new line, the control file triggered errors.
The data looks like to (field dilimiter is |, record dilimter is ~):
1 A87CCH | 1 A87CCH | PLAN_ACCOUNT_PROMOTION | HIR6A-1 | 20100706 06:06:24 | 1 DNE1 | DC?
2010.7 FY1011 Promoiton | 1 A87AW0 | 1 HJEZE | Private | 20100730 00:00:00 | 00 20100710
: 00:00 | 0 | Completed | 20100730 00:00:00 | 20100710 00:00:00 | 0 | 1 4A6PKP | TFMAAI | N
| 0 | 0 | 0 | 0 | 0 | 0 | 1 4A6PKP | Approved | 1 8U4E-163 | 00:00:20110630 00 |
20100708 01:45:35 | 20100707 00:00:00 | -1||| 0 | 9000 | 0 | 0 ||| 100. N | 0 | 0 | 0 | 0
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | N | 20110426 04:01:34 | 1 8U4E-163 | 0|||||||||
||||| ~
The control file looks like:
OPTIONS (ERRORS = 1000, DIRECT = TRUE, PARALLEL = TRUE, DATE_CACHE = 5000, discardmax = 50)
UNRECOVERABLE
load data
INFILE ' / home/bs7822/leon/leon.dat' "str" ~ "»
BADFILE ' / home/bs7822/leon/leon.bad'
DISCARDFILE ' / home/bs7822/leon/leon.discard'
ADD THE LEON_123456 TABLE
FIELDS TERMINATED BY ' | '. SURROUNDED OF POSSIBLY "" "
TRAILING NULLCOLS
(
X_INTERFACED_DT EXPRESSION "to_date (replace (replace (: X_INTERFACED_DT_BF, chr (10),"), Chr (13), "), 'YYYYMMDD hh24:mi:ss')", "
X_INTERFACED_DT_BF boundfiller,
EXTERNAL DECIMAL X_ACCRUAL_AMT,
X_PLAN_SHIPMENT_PATTERN_ID TANK (90)
)
I think that replace it can treat the wrapped date. But I want to know if we can find a faster or easier way to conquer this topic since the beginning.
Best regards
Leonuser12064076 wrote:
Thank you for your response. But how to ensure that a record is in a single line? For example, to unload data with coil?The table has more than 100 columns.
Best regards
LeonUH... which guarantee is implemented by anyone or anything that generates the data in the first place.
for example if I am extracting data to CSV for a customer or another application, making sure that it is 1 card per line with delimiters known etc.What is your own code that produces the data in the first place? If so, how are you to produce? With large amounts of data I wouldn't do it with SQL * Plus spool command, but I do with UTL_FILE within PL/SQL, or generating data in a file CLOB and spell the CLOB in a go using one of the CLOB methods available writing files.
-
Hello
I have problems using SQL Loader with ODI. I am filling an oracle table with data from a txt file. Initially, I had used 'File to SQL' LKM, but due to the size of the file (700 MB) source, I decided to use 'file to Oracle (SQLLDR)' LKM.
The error that appears in myFile.txt.log is: "SQL * Loader-101: invalid argument for the name of user and password.
I think the problem might be in the definition of the database server (physical JavaBeans in topology), because I left empty Host, user and password.
What is the problem? What host and user should I use? With "File to SQL" works fine living that white, but takes too much time.
Thanks in advanceNote the last * @*. He expects a connection string after him.
So, goto Oracle server topology, specify Instance/Dblink (server) as the SID of the oracle database you want to connect.
-
Given «example.csv» csv file
I want to load the data in:
the C7 cell in column X
cell D8 in column Y
cell F7 in column Z
Oracle table "exampletable" and so on. The csv file has not ordered rows and columns, so I can't just load the csv file into a new table itself. So what I'm asking is how to map to the columns in table cells load this file into Oracle (XE). Can someone point me to a tutorial?
I know it's quite elementary, please let me know if I am sous-prescrit anything in the question.
I ended up doing in Excel, through a very laborious process that will probably be repeated by others.
What a pity that there is no functionality in Oracle for this kind of data import more flexible. Analysts of data often throw himself spreadsheets that look like this (or 485 of them) who must enter data one way or another.
-
The documents that I have inserted with SQL do not appear in table form
Hi all -
I have not tried to reproduce this on apex.oracle.com yet, as I think that this may be a question easily answered:
I have a page with an LOV, a graphic and a shape table all based on the same table. Everything has been working fine without any problems. Today, I updated the table using SQL Developer and introduced a few new lines in the table. The LOV and the graphic on my page reflect the new lines that were inserted through SQL, but the tabular form is not seeing them. When I select a value LOV that must return some new lines, my tabular report shows simply no found data. If I copy the SQL of the tabular report definition and run it in SQL Developer, all the appropriate lines are returned.
Maybe I don't understand tabular forms. Any way to solve this problem or do I need to refresh the Page? Is the problem with the ID of the LINE or something?
All ideas are as much appreciated - thank you.
JohnUseful is fine. I don't know if these things can be changed.
Well, they say: ' it's always the last place you want! "? Some of them can make you tear your hair out.
My approach is 1) to display as much data as possible to ensure that data values are what you think they are. Often, they are not. And, (2) 'believe the error message.
Best wishes
Howard -
I want to know what are subfolders with blue color lettrers in my program folder of windows that look at this $ $MS13Uninstall_kB893803v2.
These files contain data for uninstall programs and updates.
they are created during the installation of the programs and updates and contain a card to the back/improper installation. so if the uninstall files are deleted manually, then the system loses the ability to uninstall all files and registry keys that have been installed.
so for the example provided in your thread topic, that particular file refers to the kb893803 and you'll find probably listed as a windows update in afforestation programmes.
You can also search the Web for more inforamation on that Ko.
DB·´¯'·.. ¸ >-))) º > ·´¯'·.. ¸ >-))) º > share nirvana mann
-
Help with SQL Loader when Clause
I have 2 exact same structure Oracle tables.
NUMBER OF ENO
NUMBER OF PARENT
NUMBER OF CHILDREN
ENAME VARCHAR2 (50 bytes)
ADDRESS VARCHAR2 (50 bytes)
CITY VARCHAR2 (50 bytes)
SRCFILENAME VARCHAR2 (50 bytes)
SDATE VARCHAR2 (400 bytes)
Current_Load VARCHAR2 (1 byte)
Have a data file and a charger control file that loads data into these 2 tables.
I need to make a conditional charge using a when clause.
Condition: what MOTHER = CHILD, load table 2 other load in table 1
My control file looks like this.
But it does not work. It works fine if I give a direct value like PARENT = 'P '.LOAD DATA INFILE 'TEST_20120815.txt' APPEND INTO TABLE test1 fields terminated by "|" trailing nullcols ( eno, parent, child, ename, address, city , sdate "to_date(:sdate,'DD/MM/YYYY')", SrcFileName, col7 filler, "Current_Load" constant 'Y' ) INTO TABLE test2 when (parent=child) fields terminated by "|" trailing nullcols ( eno position(1), parent, child, ename, address, city , sdate "to_date(:sdate,'DD/MM/YYYY')", SrcFileName, col7 filler, "Current_Load" constant 'Y' )
Any idea how compare the 2 fields while the conditional support?You can't compare 2 fields with the WHEN clause in SQL * file the charger control.
only literal values as defined by the syntax:http://docs.Oracle.com/CD/B19306_01/server.102/b14215/ldr_control_file.htm#i1005657
As already suggested, you'd be better to load data using an external table which allows to apply conditions you want in your SQL query, which is to get the data.
-
Problem with SQL * Loader control file
Hi friends,
I use the following control file.
Here is my data fileLoad Data infile * BADFILE xx_ds_po_upload_bad_file.bad APPEND INTO TABLE xx_ds_po_upload_hdr when (1) = 'HDR' FIELDS TERMINATED BY " " TRAILING NULLCOLS ( header_id "xx_ds_poupload_hdr_s.nextval" ,Supplier_Number ,Supplier_Site_Code ) INTO TABLE xx_ds_po_upload_lnr when (1) = 'LNR' FIELDS TERMINATED BY " " TRAILING NULLCOLS ( header_id "xx_ds_poupload_hdr_s.currval" ,Organization_code ,Item ,quantity ,need_by_date ,line_id "xx_ds_poupload_lnr_s.nextval" )
When I insert the data, the program ends normally but given correct will not be inserted...HDR 123 001 LNR xxS XX 5 05
It is the way in which the data is inserted in the tables
Line tableHeader Table HEADER_ID SUPPLIER_NUMBER SUPPLIER_S --------- ------------------------------ ---------- 32 123 001
Of the foregoing, in the table of the line, we can see that 05 is inserted for organization_code and since we gave "TRAILING BY NULL COLUMNS" program has no error on and the other fields are NULL.HEADER_ID LINE_ID ORG ITEM QUANTITY NEED_BY_D --------- --------- --- -------------------- --------- --------- 32 10015 05
Can you please why 05 is taken for organization_code when xSS should be taken according to the data files?
Please advise on this
Kind regards
Anthony Alix.
Published by: Anthony Alix on April 29, 2010 11:32A load of table multiple when one later IN THE TABLE
clause starts the position is NOT defined at the beginning of the
logic automatically.This is train how to rewrite your code to get the right result
Load data
...
IN THE TABLE xx_ds_po_upload_hdr
When (1) = 'HDR '.
...
IN THE TABLE xx_ds_po_upload_lnr
When (1) = 'LNR.
...
header_id POSITION (1) "xx_ds_poupload_hdr_s.currval".
Organization_code
... -
Loading of SQL * Loader incorrect records in table
I m using 10g. I create my SQL * the charger on the fly control file. After the execution of the control file, some incorrect records are created. I need to insert these incorrect records in another table. A column of the table will have the wrong record [LONG data type] and the other will be the file name. This is possible thanks to the logging of DML errors or the external table. I have several bad files.Hello
OP wants to load some generated off sqlldr badfile records and where these data will be loaded should not have more than 3 columns (so is the control file) that I posted in my post back and it works like a charm :) (tested and current usage).
Concerning -
Performance problem with SQL for recovering data in FACT and Dimension Table
Hello
We have a query that performs very slow when extracting data in FACT and the DIMENSION Table.
SQL and Plan are in the attachment.
Please suggest how this can be improved.
The version of DB is 11.2.0.4
Kind regards
VN
Slow is a very relative term, for about 1 hour is slow for some 1s is slow. So please always quantify your settings.
The first thing caught my eye is done 4 times ia_oasis_tot_prov_cur_d access. Try to isolate which and change it like this and see if it returns the same result.
select case when a.clm_capitn_ia_bil_prov_edw_sk = b.prov_edw_sk then b.prov_id end ben_billing_prov , case when a.clm_capitn_attnd_prov_edw_sk = b.prov_edw_sk then b.prov_id end ben_attending_prov , case when a.clm_capitn_ia_pcp_edw_sk = b.prov_edw_sk then b.prov_id end ben_pcp_number , case when a.clm_capitn_ia_ipa_prov_edw_sk = b.prov_edw_sk then b.prov_id end ben_ipa_number from edw.clm_capitn_f partition (jan2015) a left join edw.ia_oasis_tot_prov_cur_d b on ( a.clm_capitn_ia_bil_prov_edw_sk = b.prov_edw_sk or a.clm_capitn_attnd_prov_edw_sk = b.prov_edw_sk or a.clm_capitn_ia_pcp_edw_sk = b.prov_edw_sk or a.clm_capitn_ia_ipa_prov_edw_sk = b.prov_edw_sk )
If it works this means allows you to reduce certain I/O.
Maybe you are looking for
-
Satelitte L50-B-1DZ: BT is paired but does not connect to the android device
I just bought a new toshiba brand laptop with win 8.1Satelitte L50-B-1DZ I got bluetooth onAnd have even added and paired 3 devices to this Sucsesfully.Tab after assend 300Y android android phone and a samsun Music Center. The bluetooth connects very
-
Skype Audio / video call disconnect after 14 seconds in mac
Skype Audio / video call disconnect after 14 seconds in mac 1. call interrupted after 13-14 seconds 2. cannot hear the caller's voice but may receive on my side 3. I have reinstall the Skype delete old does not work 4. even I have remove the whole ma
-
IdeaPad Y560 overheating problems
My Ideapad I bought just under a year ago has recently been overheating, especially when I use my grafics card. I bought a cooling package and it seemed to work for a month or two, but now my computer seems to be the "freeze". I saw that other people
-
I noticed that my laptop has a missing screw in the back. How can I get sony to ship me a replacement screw? VPCEL22FX product name.
-
Icons in the taskbar disappears when installing any application
Original title: icons in the taskbar disappears I use windows 7... Every time when I install an app, after a few days my icons to the taskbar disappear... Only after uninstalling the application is installed and the computer restarts, the taskbar ico