EXTERNAL TABLE SKIP HEADER :::THANKS
Hi Everybody,
How can I skip header in a csv File using an external table definition ,
Thanks,
W
Did you try SKIP?
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96652/ch12.htm#1009462
Similar Messages
-
I've created external table, but how do I get the external table to skip the header and footer?
CREATE TABLE "KAS_EXT"
CUSTOMERID VARCHAR2(9),
CANVASSID VARCHAR2(9),
REPID VARCHAR2(9)
ORGANIZATION external
TYPE oracle_loader
DEFAULT DIRECTORY SYS_SQLLDR_XT_TMPDIR_00000
ACCESS PARAMETERS
RECORDS DELIMITED BY NEWLINE CHARACTERSET WE8MSWIN1252
BADFILE 'kaslist_ext_devt_water.bad'
LOGFILE 'kaslist_ext_devt_water.log_xt'
READSIZE 1048576
FIELDS TERMINATED BY "," LDRTRIM
MISSING FIELD VALUES ARE NULL
SKIP 1 <<<<<<<<<<<<<<< here???
REJECT ROWS WITH ALL NULL FIELDS
CUSTOMERID CHAR(255)
TERMINATED BY ",",
CANVASSID CHAR(255)
TERMINATED BY ",",
REPID CHAR(255)
TERMINATED BY ","
location
'kas.csv'
)REJECT LIMIT UNLIMITEDI don't know of any way to make it automatically skip footers. Hopefully, the footer doesn't match your data structure, so that it couldn't get loaded as a record, then it would just go to your bad file.
-
Skipping header in external table...
Is it possible to define an external table within OWB to skip the first few rows of a file? I haven't been able to find anything in the configuration of an external table that allows you to skip lines.
If it is not available, will it be be added to OWB in the future?
I am running OWB 9.2.0.2.8
ThanksI think I have found a bug in OWB. I keep losing the number of rows to skip in external tables.
I defined a File to skip the first three rows then created an external table based on the File. When I deployed the external table, "SKIP 3" was generated. Later, I made some configuration changes to the external table (setup a BAD file/location, set it to trim the fields, load Nulls, etc). When I redeployed the external table, "SKIP 3" was missing.
Then I did an MDL export of the File. In the MDL file, "SkipRecords" was 0. I changed it to 3, and then imported the MDL back into OWB (match by UOID, replace existing). Then when I redeployed the external table, "SKIP 3" was back in the definition.
Is this a known issue? Is it fixed in the latest version? I am using OWB 9.2.0.2.8.
Thanks! -
IGNORE COMMENTS IN EXTERNAL TABLE
I currently have a partitioned table, split by month going back some 7 years.
The business have now agreed to archive off some of the data but to have it
available if required. I therefore intend to select month by month, the data
to a flat file and make use of external tables to provide the data for the
business if required. Then to remove the months partition thus releaseing
space back to the database. Each months data is only about 100bytes long, but
there could be about 15million rows.
I can successfully create the external table and read the data.
However I would like to place a header in the spooled file but the only method
I have found to ignore the header is to use the "SKIP" parameter. I would
rather not use this as it hard codes the number of lines I reserve for a
header.
Is there another method to add a comment to a external tables file and have the
selects on the file ignore the comments?
Could I use "LOAD WHEN ( column1 != '--' )" as each comment line begins with a
double dash?
Also, is there a limit to the size of an external tables file?
Thanks
JDHi Gurus..
any help will be highly appreciated. -
Trouble Creating View on External Table in Diff Schema
I am unable to create a view in a different schema on an external table in a different schema, even when I am connected to my database as SYS as SYSDBA.
CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
returns the error:
ORA-06564: object ER_ADMIN_DIR does not exist
I created a directory:
CREATE DIRECTORY ER_ADMIN_DIR AS 'C:\ER_Init';
Granted privs:
grant read,write on directory ER_ADMIN_DIR to public;
Created the external table EXT1 in a different schema WH1:
CREATE TABLE WH1.EXT1 (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY SYS.ER_ADMIN_DIR
ACCESS PARAMETERS
(RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
LOCATION ('FILE1.TXT')
REJECT LIMIT UNLIMITED;
I can query from the table successfully connected as SYS:
SQL> select count(*) from wh1.ext1;
1008
1 row selected.
However when I try to create a view on that table connected as SYS:
CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
I get the following error:
ORA-06564: object ER_ADMIN_DIR does not exist
I can connect over to the WH1 schema and create the view successfully, however due to a specific situation I need to be able to create the view from the SYS schema. I can create the view FORCE and it creates with compilation errors, however the view cannot be compiled successfully from SYS.
Is there a known bug on creating views on external tables remotely?
Thanks for any help!
TinaI have been able to reproduce your error, using scott instead of sys, and resolve it, as demonstrated below. The combination that I found that worked consisted of having wh1 grant select on ext1 to scott explicitly and using set current_schema to wh1, so that ext1view did not require the wh1 qualifier.
scott@ORA92> CREATE USER wh1 IDENTIFIED BY wh1
2 /
User created.
scott@ORA92> GRANT CONNECT, RESOURCE TO wh1
2 /
Grant succeeded.
scott@ORA92> CREATE OR REPLACE DIRECTORY er_admin_dir AS 'c:\er_init'
2 /
Directory created.
scott@ORA92> CREATE TABLE wh1.ext1
2 (table_name VARCHAR2(100),
3 column_name VARCHAR2(100))
4 ORGANIZATION EXTERNAL
5 (TYPE ORACLE_LOADER
6 DEFAULT DIRECTORY er_admin_dir
7 ACCESS PARAMETERS
8 (RECORDS DELIMITED BY NEWLINE
9 FIELDS TERMINATED BY ','
10 MISSING FIELD VALUES ARE NULL)
11 LOCATION ('file1.txt'))
12 REJECT LIMIT UNLIMITED
13 /
Table created.
scott@ORA92> CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
2 /
CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
ERROR at line 1:
ORA-06564: object ER_ADMIN_DIR does not exist
scott@ORA92> CONNECT wh1/wh1
Connected.
scott@ORA92> @ LOGIN
scott@ORA92> SET ECHO OFF
GLOBAL_NAME
[email protected]2
wh1@ORA92> GRANT SELECT ON ext1 TO scott
2 /
Grant succeeded.
wh1@ORA92> CONNECT scott/tiger
Connected.
wh1@ORA92> @ LOGIN
wh1@ORA92> SET ECHO OFF
GLOBAL_NAME
[email protected]A92
scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = wh1
2 /
Session altered.
scott@ORA92> CREATE OR REPLACE VIEW ext1view AS SELECT * FROM wh1.ext1
2 /
View created.
scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = scott
2 /
Session altered.
scott@ORA92> SELECT * FROM wh1.ext1view
2 /
TABLE_NAME
---------------------------------------------------------COLUMN_NAME
---------------------------------------------------------tab1
col1
tab2
col2
scott@ORA92> -
LTRIM in an External Table Definition.
Hi,
We're using Oracle 11.2.
Seeing as there's little documentation on the Web about non-general External Table definitions, I want to put this question out there.
How do I put an Ltrim function into an External table definition?Thanks,
That's one way would be to use a view on an external table definition but I know there's way to so it in the definition of the external table.
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
CLAIM_NUMBER CHAR,
PATIENT_ZIP_CODE CHAR NULLIF "PATIENT_ZIP_CODE"= '!', -
How to resolve error when Loading External Table?
Iâm getting the following errors when attempting to load External Table -- I've changed the file extension from .csv to .txt to resolve ORA-29913 but error re-occurred. See syntax of External Table below.
Thanks,
Carol-Ann
SQL> desc OWB_COUNTY_TIMEZONE_EXT;
Name Null? Type
STATE_CODE VARCHAR2(2)
COUNTY_CODE VARCHAR2(3)
TIME_ZONE VARCHAR2(1)
SQL> select count(*) from OWB_COUNTY_TIMEZONE_EXT;
select count(*) from OWB_COUNTY_TIMEZONE_EXT
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file owb_county_timezone.log
OS error Permission denied
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1
++++++++++++++++++++++++++++++++++++++++++++++
Synatx of External Table:
WHENEVER SQLERROR EXIT FAILURE;
CREATE TABLE "OWB_COUNTY_TIMEZONE_EXT"
"STATE_CODE" VARCHAR2(2),
"COUNTY_CODE" VARCHAR2(3),
"TIME_ZONE" VARCHAR2(1))
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY AIMQRYD_AIMP_LOC_FF_MODULE_LOC
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
CHARACTERSET WE8MSWIN1252
STRING SIZES ARE IN BYTES
BADFILE 'owb_county_timezone'
DISCARDFILE 'owb_county_timezone'
LOGFILE 'owb_county_timezone'
FIELDS
TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' AND '"'
NOTRIM
MISSING FIELD VALUES ARE NULL
"STATE_CODE" ,
"COUNTY_CODE" ,
"TIME_ZONE"
LOCATION (
AIMQRYD_AIMP_LOC_FF_MODULE_LOC:'county_timezone_comma.txt'
REJECT LIMIT UNLIMITED
NOPARALLELHi Carol-Ann,
The key issue here is
"KUP-04063: unable to open log file owb_county_timezone.log
OS error Permission denied".
Looks like you don't have sufficient system priviliges on Unix.
This is wat AskTom mentions about it:
"the directory must exist on the SERVER.
the concerned user is the "oracle software owner" as far as the OS is concerned.
oracle must have read write access to this directory
and the directory must exist on the SERVER (database server) itself."
Hope this helps.
Cheers, Patrick -
Hi,
I would like to skip the first row in the external table.
I used the SKIP option.
The tabl create succsessfully - But for some reason i am getting an error related to the skip option when select from the table.
Could you please tell me what missing/wrong with the syntax ?
SQL> CREATE TABLE ext_tab (
2 ITEM VARCHAR2(100),
3 MODEL VARCHAR2(100),
4 packing_no VARCHAR2(100),
5 ship_date VARCHAR2(100),
6 Internal_SN VARCHAR2(100),
7 SHIPPING_SN VARCHAR2(100),
8 MACID VARCHAR2(100),
9 CARTON_NO VARCHAR2(100),
10 PALLET_ID VARCHAR2(100),
11 PO VARCHAR2(100),
12 KEY VARCHAR2(100),
13 PASSWORD_TR VARCHAR2(100),
14 PASSWORD_ADMIN VARCHAR2(100))
15 ORGANIZATION EXTERNAL
16 (TYPE oracle_loader
17 DEFAULT DIRECTORY TMP_DIR
18 ACCESS PARAMETERS
19 (FIELDS TERMINATED BY ','
20 SKIP 1
21 MISSING FIELD VALUES ARE NULL
22 (ITEM,MODEL,packing_no,SHIP_DATE,Internal_SN,SHIPPING_SN,MACID,CARTON_NO,PALLET_ID,PO,KEY,PASSWORD_TR,PASSWORD_ADMIN))
23 LOCATION ('SN.csv'))
24 PARALLEL
25 REJECT LIMIT 0;
Table created.
SQL> select * from ext_tab;
select * from ext_tab
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "skip": expecting one of: "column, enclosed, exit, (, ltrim, lrtrim, ldrtrim, missing, notrim, optionally, rtrim, reject"
KUP-01007: at line 2 column 1
ORA-06512: at "SYS.ORACLE_LOADER", line 19Hi,
Kindly find below the syntax for creating the external table
Line: -----
CREATE TABLE <table_name> (
<column_definitions>)
ORGANIZATION EXTERNAL
(TYPE oracle_loader
DEFAULT DIRECTORY <oracle_directory_object_name>
ACCESS PARAMETERS (
RECORDS DELIMITED BY newline
BADFILE <file_name>
DISCARDFILE <file_name>
LOGFILE <file_name>
[READSIZE <bytes>]
[SKIP <number_of_rows>
FIELDS TERMINATED BY '<terminator>'
REJECT ROWS WITH ALL NULL FIELDS
MISSING FIELD VALUES ARE NULL
(<column_name_list>))\
LOCATION ('<file_name>'))
[PARALLEL]
REJECT LIMIT <UNLIMITED | integer>;
Line: -----
Please note that the order of the items in the ACCESS PARAMETERS differs in your Create Table syntax. Also check whether the .CSV file is available in the TMP_DIR directory path.
Regards,
Sandhya G. -
SQL and External table question
Hello averyone,
I have a file to be read as an external table part of it is below:
ISO-10303-21;
HEADER;
FILE_DESCRIPTION((''),'2;1');
FILE_NAME('BRACKET','2005-07-08T',('broilo'),(''),
'PRO/ENGINEER BY PARAMETRIC TECHNOLOGY CORPORATION, 2004400',
'PRO/ENGINEER BY PARAMETRIC TECHNOLOGY CORPORATION, 2004400','');
FILE_SCHEMA(('CONFIG_CONTROL_DESIGN'));
ENDSEC;
DATA;
#5=CARTESIAN_POINT('',(5.5E0,5.5E0,-5.1E1));
#6=DIRECTION('',(0.E0,0.E0,1.E0));
#7=DIRECTION('',(-1.E0,0.E0,0.E0));
#8=AXIS2_PLACEMENT_3D('',#5,#6,#7);
The first question is: how to ignore the lines until the DATA; line or SQL already does it for me?
The second question is: since the fields of interest are separated by commas and the first field does not interest me (it is solved with a varchar2) how can I read the following fields as numbers ignoring the (,# and ) characters please?
Thanks for any help.
Sincerely yours,
André LuizThe SKIP option can be used with SQL*Loader to skip a certain number of lines before starting to load. Off hand I cannot see any easy way to load the data in the format given. The format does not resemble a typical CVS format. You can look at the test cases provided for SQ*Loader in the Oracle® Database Utilities guide - or simply write PL/SQL code to load this data manually using UTL_FILE.
-
Reject the footer using the external table
Hi,
I have a flat file with fixed length which have a header and a footer.
My file is something like this:
HADF.TXT0309
D12345ABCD
D22345ABCD
FOOTERHJ
I want to create an external table based on that file, but
I don't want to have the header and the footer in my table. To eliminate the header I used skip 1, but I don't know how to eliminate the footer.
Any example and suggestions will be appreciated
Thank you for your time and consideration
CatalinHi,
This problem may be due to several reasons. I am aware of few reasons.
1)Have you deployed the external table first?
2) If you do not have your data base client and server running in the same machine, you should place the csv file in the database server machine's 'c:\CSV' folder in order to create the external table through database. Then do a select count(*) statement.
3)Another reason may be as gerardnico said the file name you refered may be wrong.
I don't know your requirement. If you could create the external table succefully and if you get value for the select count(*) from <external_table_name>, then try to import the external table into the Design Center and map it with the Table you need.
If you are doing it purely with OWB then,
Do you have the file Export_WithHeaders.csv in the Server machine's 'c:\CSV_FILE' folder?
Because while importing the metadata of the CSV file the OWB will point to your local machine's 'c:\CSV_FILE' that is why your Validation and Deployment is success without errors.
But while executing the map it will take the data from Server machine. It will search for the Location 'c:\CSV_FILE' in the server machine and will look for the file Export_WithHeaders.csv there. So create athe same folder setup which you have in your client machine and run this again.
Try this if you do not get any better answers in this thread -
External table.How to load numbers (decimal and scientific notation format)
Hi all, I need to load inside an external table records that contain 7 fields. The last field is called AMOUNT and it's represented in some records with the decimal format, in others records with the scientific notation format as, for example, below:
CY001_STATU;2009;Jan;11220020GR;'03900;CYZ900;-9,99999999839929e-03
CY001_STATU;2009;Jan;11200100;'60800;CYZ900;41380,77
The External table's script is the following:
CREATE TABLE HYP_DATA
COUNTRY VARCHAR2(50 BYTE),
YEAR VARCHAR2(20 BYTE),
PERIOD VARCHAR2(20 BYTE),
ACCOUNT VARCHAR2(50 BYTE),
DEPT VARCHAR2(20 BYTE),
ACTIVITY_LOC VARCHAR2(20 BYTE),
AMOUNT VARCHAR2(50 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY HYP_DATA_DIR
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
BADFILE 'HYP_BAD_DIR':'HYP_LOAD.bad'
DISCARDFILE 'HYP_DISCARD_DIR':'HYP_LOAD.dsc'
LOGFILE 'HYP_LOG_DIR':'HYP_LOAD.log'
SKIP 0
FIELDS TERMINATED BY ";"
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
"COUNTRY" Char,
"YEAR" Char,
"PERIOD" Char,
"ACCOUNT" Char,
"DEPT" Char,
"ACTIVITY_LOC" Char,
"AMOUNT" Char
LOCATION (HYP_DATA_DIR:'Total.txt')
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;
If, for the field AMOUNT I use the datatype VARCHAR (as above), the table is loaded but I have some records rejected, and all these records contain the last field AMOUNT with the scientific notation as:
CY001_STATU;2009;Jan;11220020GR;'03900;CYZ900;-9,99999999839929e-03
CY001_STATU;2009;Feb;11220020GR;'03900;CYZ900;-9,99999999839929e-03
CY001_STATU;2009;Mar;11220020GR;'03900;CYZ900;-9,99999999839929e-03
CY001_STATU;2009;Dec;11220020GR;'03900;CYZ900;-9,99999999839929e-03
All the others records with a decimal AMOUNT are loaded correctly.
So, my problem is that I NEED to load all the records (with the decimal and the scientific notation format) together (without records rejected), but I don't know which datatype I have to use for the AMOUNT field....
Anybody has any idea ???
Any help would be appreciated
Thanks in advance
Alex@OP,
What version of Oracle are you using?
Just cut'n'paste of you script and example woked FINE for me.
however my quation is... An external table will LOAD all data or none at all. How are you validating/concluding that...
I have some records rejected, and all these records contain the last field AMOUNT with the scientific notation
select * from v$version where rownum <2;
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
select * from mydata;
CY001_STATU 2009 Jan 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Feb 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Jan 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Jan 11200100 '60800 CYZ900 41380,77
CY001_STATU 2009 Mar 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Dec 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Jan 11220020GR '03900 CYZ900 -9,99999999839929e-03
CY001_STATU 2009 Jan 11200100 '60800 CYZ900 41380,77MYDATA table script is...
drop table mydata;
CREATE TABLE mydata
COUNTRY VARCHAR2(50 BYTE),
YEAR VARCHAR2(20 BYTE),
PERIOD VARCHAR2(20 BYTE),
ACCOUNT VARCHAR2(50 BYTE),
DEPT VARCHAR2(20 BYTE),
ACTIVITY_LOC VARCHAR2(20 BYTE),
AMOUNT VARCHAR2(50 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY IN_DIR
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
BADFILE 'IN_DIR':'HYP_LOAD.bad'
DISCARDFILE 'IN_DIR':'HYP_LOAD.dsc'
LOGFILE 'IN_DIR':'HYP_LOAD.log'
SKIP 0
FIELDS TERMINATED BY ";"
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
"COUNTRY" Char,
"YEAR" Char,
"PERIOD" Char,
"ACCOUNT" Char,
"DEPT" Char,
"ACTIVITY_LOC" Char,
"AMOUNT" Char
LOCATION (IN_DIR:'total.txt')
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;vr,
Sudhakar B. -
Syntax Error, while Creating External Table
Hi,
Can anyone tell this Syntax is correct or not. And how it look like:
CREATE TABLE emp_load (T_DATE DATE NOT NULL,
T_NO DOUBLE PRECISION,
T_TYPE CHAR(1),
T_CO VARCHAR(30),
T_CONTRACT DOUBLE PRECISION,
T_PARTY VARCHAR(15),
T_BILL_NO DOUBLE PRECISION,
T_BILL_DATE DATE,
T_QTY DOUBLE PRECISION,
T_RATE DOUBLE PRECISION,
T_BKG DOUBLE PRECISION NOT NULL,
T_TAX DOUBLE PRECISION,
T_OTHER DOUBLE PRECISION,
T_DIV DOUBLE PRECISION,
T_STAMPS DOUBLE PRECISION,
T_DC_NO DOUBLE PRECISION,
T_SPOT CHAR(2),
T_CITY VARCHAR(3),
T_ORDER DOUBLE PRECISION,
T_TRADE DOUBLE PRECISION,
T_TIME DATE,
T_FORM CHAR(1),
HEADER VARCHAR(2),
T_DC_DATE DATE,
T_POD VARCHAR(30),
T_POD_DATE DATE,
T_SET INTEGER,
T_MARGIN DOUBLE PRECISION NOT NULL WITH DEFAULT,
T_MKT_TYPE VARCHAR(3) NOT NULL,
T_MEMBER_CODE VARCHAR(15),
T_EXIM SMALLINT,
T_P VARCHAR(15),
T_C VARCHAR(30),
T_TERM VARCHAR(8),
T_CUST VARCHAR(12),
T_SUBBKG DOUBLE PRECISION,
T_BILL_TYPE VARCHAR(1),
T_OPN_CLS DOUBLE PRECISION,
T_AUCTION DOUBLE PRECISION,
T_BRANCH VARCHAR(8),
T_UNQID VARCHAR(20),
T_SQ SMALLINT,
T_CBKG DOUBLE PRECISION,
T_COTHER DOUBLE PRECISION,
T_MOD DATE,
T_ORIG_CUST VARCHAR(20),
T_TOT DOUBLE PRECISION,
T_FIRM SMALLINT,
T_ORDER_TIME DATE,
T_NON_MT SMALLINT)
ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY ext_tab_dir
ACCESS PARAMETERS (RECORDS FIXED 62 FIELDS (T_DATE DATE NOT NULL,
T_NO DOUBLE PRECISION,
T_TYPE CHAR(1),
T_CO VARCHAR(30),
T_CONTRACT DOUBLE PRECISION,
T_PARTY VARCHAR(15),
T_BILL_NO DOUBLE PRECISION,
T_BILL_DATE DATE,
T_QTY DOUBLE PRECISION,
T_RATE DOUBLE PRECISION,
T_BKG DOUBLE PRECISION NOT NULL,
T_TAX DOUBLE PRECISION,
T_OTHER DOUBLE PRECISION,
T_DIV DOUBLE PRECISION,
T_STAMPS DOUBLE PRECISION,
T_DC_NO DOUBLE PRECISION,
T_SPOT CHAR(2),
T_CITY VARCHAR(3),
T_ORDER DOUBLE PRECISION,
T_TRADE DOUBLE PRECISION,
T_TIME DATE,
T_FORM CHAR(1),
HEADER VARCHAR(2),
T_DC_DATE DATE,
T_POD VARCHAR(30),
T_POD_DATE DATE,
T_SET INTEGER,
T_MARGIN DOUBLE PRECISION NOT NULL WITH DEFAULT,
T_MKT_TYPE VARCHAR(3) NOT NULL,
T_MEMBER_CODE VARCHAR(15),
T_EXIM SMALLINT,
T_P VARCHAR(15),
T_C VARCHAR(30),
T_TERM VARCHAR(8),
T_CUST VARCHAR(12),
T_SUBBKG DOUBLE PRECISION,
T_BILL_TYPE VARCHAR(1),
T_OPN_CLS DOUBLE PRECISION,
T_AUCTION DOUBLE PRECISION,
T_BRANCH VARCHAR(8),
T_UNQID VARCHAR(20),
T_SQ SMALLINT,
T_CBKG DOUBLE PRECISION,
T_COTHER DOUBLE PRECISION,
T_MOD DATE,
T_ORIG_CUST VARCHAR(20),
T_TOT DOUBLE PRECISION,
T_FIRM SMALLINT,
T_ORDER_TIME DATE,
T_NON_MT SMALLINT))
LOCATION ('BR271107.DAT'))
Error at Command Line:28 Column:40
Error report:
SQL Error: ORA-00905: missing keyword
00905. 00000 - "missing keyword"
Thank u..!
RaviWhere can we find that directory in the server. You have to provide for it's existence.
So you must create C:/Oracle on the server or have your ext_tab_dir point to some existing directory on the server (better if dedicated to external tables for not creating confusion)
You must also see to have read and write OS rights and have granted read (and write) privileges on directory ext_tab_dir to your_user_name
Regards
Etbin
If you can use utl_file try to use utl_file_dir as your ext_tab_dir to perform the test => copy your file to the directory your utl_file_dir is pointing to and do select * from test
Message was edited by: Etbin
user596003 -
Error in Deploying External Table
Hi,
I am using OWB 10.2g version to create a database. While deploying the external table, I got the following message:
"TSS_15MIN_EX ErrMsgKey VLD-0180: A default location is required for external tables."
Could you help me in solving this issue?
Thanks,
VipulHi Sutirtha,
I tried to double click on the external table (in the Control Center) but nothing happens. I could only right click and select the only highlighted "Configure" option. In the configure option, only the following file locations turn up that all uses default file location:
Bad File Location
Discard file location
Log file location
To give you a head start, It is the first time that we are deploying these tables as we are in a process of migrating the server to a different machine. In our current server, all these external tables are probably in C:\ or directed in C:\ but we have changed the path to D:\ in the new server. Do you think it has to do something while we import the metadata?
Thanks,
Vipul -
Issues with external table from excel file
dear all,
i have been trying to use the below statement to create an external table.this table is referencing an excel file.
CREATE TABLE EMPFRAUD_TEST
SERIAL_NUM VARCHAR2(10 BYTE),
BRANCH_CODE VARCHAR2(10 BYTE),
BUSINESS_ADD VARCHAR2(100 BYTE),
REGIONS VARCHAR2(50 BYTE),
TRANSACTION_DATE_TIME DATE,
REPORT_DATE_TIME DATE,
NO_OF_TRANS VARCHAR2(4 BYTE),
AMOUNT NUMBER,
FRAUD_TYPE VARCHAR2(25 BYTE),
IMPACT_CATEGORY VARCHAR2(10 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY EXT_EMP_TEST
ACCESS PARAMETERS
( records delimited by newline
badfile 'empfraud%a.bad'
logfile 'empfraud%a.log'
fields terminated by ','
optionally enclosed by '"'lrtrim
missing field values are null
LOCATION ('fraud.csv')
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;
the problems is as follows
1) when i run the query above the table will be created,
but when i try to select from the table,an empty table will be display.
when i checked the error log file,the following message was given.
it was gotten from an oracle db on unix server.
"L_NUM
KUP-04036: second enclosing delimiter not found
KUP-04101: record 71 rejected in file /home/oracle/ext_folder_test/fraud.csv
KUP-04021: field formatting error for field ACCOUNT_KEY
KUP-04036: second enclosing delimiter not found
KUP-04101: record 79 rejected in file /home/oracle/ext_folder_test/fraud.csv
KUP-04021: field formatting error for field SERIAL_NUM
KUP-04036: second enclosing delimiter not found
KUP-04101: record 80 rejected in file /home/oracle/ext_folder_test/fraud.csv
error processing column TRANSACTION_DATE_TIME in row 1 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01858: a non-numeric character was found where a numeric was expected
error processing column TRANSACTION_DATE_TIME in row 2 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01843: not a valid month
error processing column TRANSACTION_DATE_TIME in row 3 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01843: not a valid month
error processing column TRANSACTION_DATE_TIME in row 8 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01843: not a valid month
error processing column TRANSACTION_DATE_TIME in row 9 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01843: not a valid month
error processing column TRANSACTION_DATE_TIME in row 10 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01843: not a valid month
error processing column TRANSACTION_DATE_TIME in row 11 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01858: a non-numeric character was found where a numeric was expected
error processing column TRANSACTION_DATE_TIME in row 12 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01843: not a valid month
error processing column TRANSACTION_DATE_TIME in row 13 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01843: not a valid month
error processing column TRANSACTION_DATE_TIME in row 14 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01843: not a valid month
error processing column TRANSACTION_DATE_TIME in row 15 for datafile /home/oracle/ext_folder_test/fraud.csv
ORA-01843: not a valid month"
pls i need help to resolve it fast
thank
regards
ajani abdulrahman olayide
NB:
after conversion to .csv format,
BELOW IS THE DATA I AM TRYING TO ACCESS FROM THE EXCEL FILE
BUSINESS OFFICE,REGIONS,Transaction_Date_Time,Report_Date_Time,Account_Key (Account No), Number_of_Transactions,Total_Amount (N)
1,162,9 ojo street,Lagos South,various ,17/01/10,16200388749987,1,5100000,CHEQUE
2,0238,"10 cyril Road, Enugu",East,21/06/2006,23/12/10,020968765357 09867653920174,1,20000000
3,0127,"261, obiageli Rd, Asaba",Mid-West,22/12/2010,23/12/10,'00160030006149,1,6000000
4,0519,"just road, Onitsha
",East,12/03/2010,14/02/11,0896002416575,1,5000000
5,0519,"just road, Onitsha
",East,03/12/2010,14/02/11,06437890134356,1,5000000
6,149,olayide street,Lagos South,10/02/2010,17/02/11,NGN01492501036 ,1,6108950
7,0066,wale,Mid - west,18/02/2011,18/02/10,'05590020002924,1,55157977.53
8,66,john,Mid- west,11/03/2010,14/03/09,'00660680054177,1,6787500
9,0273,waheed Biem,N/Central,Jan 09 to Dec 2010,01/04/11,Nil,1,14146040As others suggested, you have to do the debugging yourself, To avoid the date error you may need something like this:
CREATE TABLE EMPFRAUD_TEST
SERIAL_NUM VARCHAR2(10),
BRANCH_CODE VARCHAR2(10),
BUSINESS_ADD VARCHAR2(100),
REGIONS VARCHAR2(50),
TRANSACTION_DATE_TIME DATE ,
REPORT_DATE_TIME DATE ,
NO_OF_TRANS VARCHAR2(50),
AMOUNT NUMBER,
FRAUD_TYPE VARCHAR2(25),
IMPACT_CATEGORY VARCHAR2(10)
ORGANIZATION EXTERNAL
type oracle_loader default directory saubhik
access parameters
( records delimited by newline
badfile 'empfraud%a.bad'
logfile 'empfraud%a.log'
skip 1
fields terminated by ','
optionally enclosed by '"' ltrim
missing field values are null
( serial_num ,
branch_code ,
business_add ,
regions ,
transaction_date_time date "dd/mm/rrrr",
report_date_time date "dd/mm/rr",
no_of_trans ,
amount ,
FRAUD_TYPE ,
IMPACT_CATEGORY ) ) LOCATION ('fraud.csv')
REJECT LIMIT UNLIMITED
{code} -
Selecting data from external table
Hi there
I was wondering if somebody could assist me. When I try to select data from an external table, no data is displayed, and in my log file I receive the following error:
KUP-04026: field too long for datatype. Please find attached my external table script.
CREATE TABLE DEMO_FILE_EXT
MACODE NUMBER(7),
MANO NUMBER(7),
DEPNO VARCHAR2(2 BYTE),
DEPTYPE NUMBER(5),
STARTDATE NUMBER(8),
ENDDATE NUMBER(8),
OPTIONSTART NUMBER(8),
BENEFITSTART NUMBER(8),
STARTSUSPEND NUMBER(8),
ENDSUSPEND NUMBER(8),
INITIALS VARCHAR2(5 BYTE),
FIRSTNAME VARCHAR2(20 BYTE),
SURNAME VARCHAR2(25 BYTE),
STR1 VARCHAR2(30 BYTE),
STR2 VARCHAR2(30 BYTE),
STR3 VARCHAR2(30 BYTE),
STR4 VARCHAR2(30 BYTE),
SCODE VARCHAR2(6 BYTE),
POS1 VARCHAR2(30 BYTE),
POS2 VARCHAR2(30 BYTE),
POS3 VARCHAR2(30 BYTE),
POS4 VARCHAR2(30 BYTE),
PCODE VARCHAR2(6 BYTE),
TELH VARCHAR2(10 BYTE),
TELW VARCHAR2(10 BYTE),
TELC VARCHAR2(10 BYTE),
IDNUMBER VARCHAR2(13 BYTE),
DOB NUMBER(8),
GENDER VARCHAR2(1 BYTE),
EMPLOYER_CODE VARCHAR2(10 BYTE),
EMPLOYER_NAME VARCHAR2(900 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY DEMO_FILES
ACCESS PARAMETERS
( RECORDS DELIMITED BY newline
BADFILE 'Tinusb.txt'
DISCARDFILE 'Tinusd.txt'
LOGFILE 'Tinusl.txt'
SKIP 1
FIELDS TERMINATED BY '|'
MISSING FIELD VALUES ARE NULL
(MACODE,
MANO,
DEPNO,
DEPTYPE,
STARTDATE,
ENDDATE,
OPTIONSTART,
BENEFITSTART,
STARTSUSPEND,
ENDSUSPEND,
INITIALS,
FIRSTNAME,
SURNAME,
STR1,
STR2,
STR3,
STR4,
SCODE,
POS1,
POS2,
POS3,
POS4,
PCODE,
TELH,
TELW,
TELC,
IDNUMBER,
DOB,
GENDER,
EMPLOYER_CODE,
EMPLOYER_NAME
LOCATION (DEMO_FILES:'Test1.txt')
REJECT LIMIT UNLIMITED
LOGGING
NOCACHE
NOPARALLEL;
I have the correct privileges on the directory, but the error seems to be on the EMPLOYER_NAME field. The file I try to upload is in pipe-delimited format. The last field in the file does not have a pipe-delimiter at the end. Can this be the problem? Must I go and look for any trailing spaces? Can I specify in the external table script how many characters I need for the employer_name field? We receive this file from an external company
Thank you very much for the help
Ferdiecommon mistake, you gave the field sizes in the
column listing of the table, but not in the file
definition. oracle does not apply one to the other.
in the file defintion section, give explict field
sizes.Hi shoblock
Sorry for only coming back to you now, thank you for your help, I had to give the explicit field size for the last column (employer name).
Thank you once again!!
Ferdie
Maybe you are looking for
-
How to switch iPhone information from iTunes on one computer to another?
I just bought a Mac and I want to switch my iPhone and all of its music and photos and information over to my new computer, how do I switch everything to itunes on my new computer?
-
Mail: Check as Read only after opening in a separate window
I would like to keep my emails unread at all times onless i manually set them as read or open them on a separete window. Is this possible? how do i do it?
-
Java help for a newbie.
ok so I have 2 classes at the moment. One to make the GUI and one to read a file. All I want to know is how to make a button press activate the file reading method from the other class. I'll post my code below. Thanks Craig this is the GUI import jav
-
Howto sync between alsb console and the Oracle Workshop
I was wondering if it's possible to sync between my project in Oracle Workshop for WebLogic and the project which is deployed on the server. When i do some changes in the alsb-console i want to see/sync/import them in my project in the workshop too.
-
Create Display Authorization Profile for SAP Transaction SPRO (IMG).
Dear All, In my current implementation project there is an requirement to create display authorization profile for SPRO. I have tried a lot but was not able to do so. Any one is having an experience in creating display profile for SPRO (IMG) ? If any