Oracle 9i External Tables
Helllo Everyone.
I am new to external tables concept and I have only used using flat files.
Is there a complete reference on on external tables somewhere?
Also, instead of .csv or text based datafiles, can I use XML as data source for these external tables? If so, how?
Thanks,
R
The link to the documentation has been already posted.
About the xml as a possible datasource, in Oracle9i only the ORACLE_LOADER driver is supported, it allows you to read data using SQL*Loader, that is to say only plain text files.
In Oracle10g a new driver has been added: ORACLE_DATAPUMP, it allows you to read with an external table a dump file created from other Oracle tables using the same ORACLE_DATAPUMP driver.
Unfortunately the ORACLE_DATAPUMP driver doesn't support the XMLTYPE datatype:
SQL> desc tbl_xml
Nome Nullo? Tipo
XML PUBLIC.XMLTYPE
SQL> CREATE TABLE xml_ext
2 ORGANIZATION EXTERNAL
3 (
4 TYPE ORACLE_DATAPUMP
5 DEFAULT DIRECTORY DATA_PUMP_DIR
6 LOCATION ('xml_ext.dmp')
7 )
8 AS SELECT * FROM tbl_xml;
CREATE TABLE xml_ext
ERRORE alla riga 1:
ORA-30656: tipo di colonna non supportato in una tabella organizzata esterna
SQL>Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com/2009/12/18/table-elimination-oppure-join-elimination-lottimizzatore-si-libera-della-zavorra/]
Similar Messages
-
Oracle 11g - External Table/SQL Developer Issue?
Oracle 11g - External Table/SQL Developer Issue?
==============================
I hope this is the right forum for this issue, if not let me, where to go.
We are using Oracle 11g (11.2.0.1.0) on (Platform : solaris[tm] oe (64-bit)), Sql Developer 3.0.04
We are trying to use oracle external table to load text files in .csv format. Here is our data look like.
======================
Date1,date2,Political party,Name, ROLE
20-Jan-66,22-Nov-69,Democratic,"John ", MMM
22-Nov-70,20-Jan-71,Democratic,"John Jr.",MMM
20-Jan-68,9-Aug-70,Republican,"Rick Ford Sr.", MMM
9-Aug-72,20-Jan-75,Republican,Henry,MMM
------ ALL NULL -- record
20-Jan-80,20-Jan-89,Democratic,"Donald Smith",MMM
======================
Our Expernal table structures is as follows
CREATE TABLE P_LOAD
DATE1 VARCHAR2(10),
DATE2 VARCHAR2(10),
POL_PRTY VARCHAR2(30),
P_NAME VARCHAR2(30),
P_ROLE VARCHAR2(5)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY P_EXT_TAB_D
ACCESS PARAMETERS (
RECORDS DELIMITED by NEWLINE
SKIP 1
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
REJECT ROWS WITH ALL NULL FIELDS
MISSING FIELD VALUES ARE NULL
DATE1 CHAR (10) Terminated by "," ,
DATE2 CHAR (10) Terminated by "," ,
POL_PRTY CHAR (30) Terminated by "," ,
P_NAME CHAR (30) Terminated by "," OPTIONALLY ENCLOSED BY '"' ,
P_ROLE CHAR (5) Terminated by ","
LOCATION ('Input.dat')
REJECT LIMIT UNLIMITED;
It created successfully using SQL Developer
Here is the issue.
It is not loading the records, where fields are enclosed in '"' (Rec # 2,3,4,7)
It is loading all NULL value record (Rec # 6)
*** If we remove the '"' from input data, it loads all records including all NULL records
Log file has
KUP-04021: field formatting error for field P_NAME
KUP-04036: second enclosing delimiter not found
KUP-04101: record 2 rejected in file ....
Our questions
Why did "REJECT ROWS WITH ALL NULL FIELDS" not working?
Why did Terminated by "," OPTIONALLY ENCLOSED BY '"' not working?
Any idea?
Thanks in helping.I don't think this is a SQLDeveloper issue. You will get better answers in the Database - General or perhaps SQL and PL/SQL forums.
-
Oracle 11g - External Table/Remote File Issue?
Oracle 11g - External Table/Remote File Issue?
=============================
I hope this is the right forum for this issue, if not let me, where to go.
We are using Oracle 11g (11.2.0.1.0) on (Platform : solaris[tm] oe (64-bit)), Sql Developer 3.0.04
We are not allowed to put files on the CSV file system (Server A), where DB instance is running. We are able place CSV files on another server(Server B), where DB instance is not running.
We are trying to use oracle external table to load text files in .CSV format.
How do we create a Directory (Create Directory) on Server A DB to point to File system of Server B?
Is it feasible?
Any idea?
Thanks in helping.The Solaris DBA should be able to mount the filesystem for you. Either that or you have to get creative transferring the file like this;
http://www.linkedin.com/groups/Getting-creative-external-table-preprocessor-140609.S.50474382?qid=ba673ce4-c4bb-40c5-8367-52bd2a2dfc80&trk=group_search_item_list-0-b-ttl&goback=%2Egmp_140609
Cheers
David -
Oracle 11g - External Table Issue SQL - PL/SQL?
Oracle 11g - External Table Issue?
=====================
I hope this is the right forum for this issue, if not let me, where to go.
We are using Oracle 11g (11.2.0.1.0) on (Platform : solaris[tm] oe (64-bit)), Sql Developer 3.0.04
We are trying to use oracle external table to load text files in .csv format. Here is our data look like.
======================
Date1,date2,Political party,Name, ROLE
20-Jan-66,22-Nov-69,Democratic,"John ", MMM
22-Nov-70,20-Jan-71,Democratic,"John Jr.",MMM
20-Jan-68,9-Aug-70,Republican,"Rick Ford Sr.", MMM
9-Aug-72,20-Jan-75,Republican,Henry,MMM
ALL NULL -- record
20-Jan-80,20-Jan-89,Democratic,"Donald Smith",MMM
======================
Our Expernal table structures is as follows
CREATE TABLE P_LOAD
DATE1 VARCHAR2(10),
DATE2 VARCHAR2(10),
POL_PRTY VARCHAR2(30),
P_NAME VARCHAR2(30),
P_ROLE VARCHAR2(5)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY P_EXT_TAB_D
ACCESS PARAMETERS (
RECORDS DELIMITED by NEWLINE
SKIP 1
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
REJECT ROWS WITH ALL NULL FIELDS
MISSING FIELD VALUES ARE NULL
DATE1 CHAR (10) Terminated by "," ,
DATE2 CHAR (10) Terminated by "," ,
POL_PRTY CHAR (30) Terminated by "," ,
P_NAME CHAR (30) Terminated by "," OPTIONALLY ENCLOSED BY '"' ,
P_ROLE CHAR (5) Terminated by ","
LOCATION ('Input.dat')
REJECT LIMIT UNLIMITED;
It created successfully using SQL Developer
Here is the issue.
It is not loading the records, where fields are enclosed in '"' (Rec # 2,3,4,7)
It is loading all NULL value record (Rec # 6)
*** If we remove the '"' from input data, it loads all records including all NULL records
Log file has
KUP-04021: field formatting error for field P_NAME
KUP-04036: second enclosing delimiter not found
KUP-04101: record 2 rejected in file ....
Our questions
Why did "REJECT ROWS WITH ALL NULL FIELDS" not working?
Why did Terminated by "," OPTIONALLY ENCLOSED BY '"' not working?
Any idea?
Thanks in helping.
Edited by: qwe16235 on Jun 11, 2011 11:31 AMI'm not sure, but maybe you should get rid of the redundancy that you have in your CREATE TABLE statement.
This line covers all fields:
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
{code}
So I would change the field list to:
{code}
DATE1 CHAR (10),
DATE2 CHAR (10),
POL_PRTY CHAR (30),
P_NAME CHAR (30),
P_ROLE CHAR (5)
{code}
It worked on my installation. -
Oracle 11g - External Table Issue?
Oracle 11g - External Table Issue?
=====================
I hope this is the right forum for this issue, if not let me, where to go.
We are using Oracle 11g (11.2.0.1.0) on (Platform : solaris[tm] oe (64-bit)), Sql Developer 3.0.04
We are trying to use oracle external table to load text files in .csv format. Here is our data look like.
======================
Date1,date2,Political party,Name, ROLE
20-Jan-66,22-Nov-69,Democratic,"John ", MMM
22-Nov-70,20-Jan-71,Democratic,"John Jr.",MMM
20-Jan-68,9-Aug-70,Republican,"Rick Ford Sr.", MMM
9-Aug-72,20-Jan-75,Republican,Henry,MMM
------ ALL NULL -- record
20-Jan-80,20-Jan-89,Democratic,"Donald Smith",MMM
======================
Our Expernal table structures is as follows
CREATE TABLE P_LOAD
DATE1 VARCHAR2(10),
DATE2 VARCHAR2(10),
POL_PRTY VARCHAR2(30),
P_NAME VARCHAR2(30),
P_ROLE VARCHAR2(5)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY P_EXT_TAB_D
ACCESS PARAMETERS (
RECORDS DELIMITED by NEWLINE
SKIP 1
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
REJECT ROWS WITH ALL NULL FIELDS
MISSING FIELD VALUES ARE NULL
DATE1 CHAR (10) Terminated by "," ,
DATE2 CHAR (10) Terminated by "," ,
POL_PRTY CHAR (30) Terminated by "," ,
P_NAME CHAR (30) Terminated by "," OPTIONALLY ENCLOSED BY '"' ,
P_ROLE CHAR (5) Terminated by ","
LOCATION ('Input.dat')
REJECT LIMIT UNLIMITED;
It created successfully using SQL Developer
Here is the issue.
It is not loading the records, where fields are enclosed in '"' (Rec # 2,3,4,7)
It is loading all NULL value record (Rec # 6)
*** If we remove the '"' from input data, it loads all records including all NULL records
Log file has
KUP-04021: field formatting error for field P_NAME
KUP-04036: second enclosing delimiter not found
KUP-04101: record 2 rejected in file ....
Our questions
Why did "REJECT ROWS WITH ALL NULL FIELDS" not working?
Why did Terminated by "," OPTIONALLY ENCLOSED BY '"' not working?
Any idea?
Thanks in helping.
Edited by: qwe16235 on Jun 10, 2011 2:16 PMThe following worked for me:
drop table p_load;
CREATE TABLE P_LOAD
DATE1 VARCHAR2(10),
DATE2 VARCHAR2(10),
POL_PRTY VARCHAR2(30),
P_NAME VARCHAR2(30),
P_ROLE VARCHAR2(5)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY scott_def_dir1
ACCESS PARAMETERS (
RECORDS DELIMITED by NEWLINE
badfile scott_def_dir2:'p_load_%a_%p.bad'
logfile scott_def_dir2:'p_load_%a_%p.log'
SKIP 1
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
DATE1 CHAR (10) Terminated by "," ,
DATE2 CHAR (10) Terminated by "," ,
POL_PRTY CHAR (30) Terminated by "," ,
P_NAME CHAR (30) Terminated by "," OPTIONALLY ENCLOSED BY '"' ,
P_ROLE CHAR (5) Terminated by ","
LOCATION ('Input.dat')
REJECT LIMIT UNLIMITED;
Note that I had to interchange the two lines:
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
Just to get the access parameters to parse correctly.
I added two empty lines, one in the middle and one at the end - both were rejected.
In the log file, you will see the rejectiions:
$ cat p_load_000_9219.log
LOG file opened at 07/08/11 19:47:23
Field Definitions for table P_LOAD
Record format DELIMITED BY NEWLINE
Data in file has same endianness as the platform
Reject rows with all null fields
Fields in Data Source:
DATE1 CHAR (10)
Terminated by ","
Enclosed by """ and """
Trim whitespace same as SQL Loader
DATE2 CHAR (10)
Terminated by ","
Enclosed by """ and """
Trim whitespace same as SQL Loader
POL_PRTY CHAR (30)
Terminated by ","
Enclosed by """ and """
Trim whitespace same as SQL Loader
P_NAME CHAR (30)
Terminated by ","
Enclosed by """ and """
Trim whitespace same as SQL Loader
P_ROLE CHAR (5)
Terminated by ","
Enclosed by """ and """
Trim whitespace same as SQL Loader
KUP-04073: record ignored because all referenced fields are null for a record
KUP-04073: record ignored because all referenced fields are null for a record
Input Data:
Date1,date2,Political party,Name, ROLE
20-Jan-66,22-Nov-69,Democratic,"John ", MMM
22-Nov-70,20-Jan-71,Democratic,"John Jr.",MMM
20-Jan-68,9-Aug-70,Republican,"Rick Ford Sr.", MMM
9-Aug-72,20-Jan-75,Republican,Henry,MMM
4-Aug-70,20-Jan-75,Independent
Result:
SQL> select * from p_load;
DATE1 DATE2 POL_PRTY P_NAME P_ROL
20-Jan-66 22-Nov-69 Democratic John MMM
22-Nov-70 20-Jan-71 Democratic John Jr. MMM
20-Jan-68 9-Aug-70 Republican Rick Ford Sr. MMM
9-Aug-72 20-Jan-75 Republican Henry MMM
Regards,
- Allen -
Accesing windows files using oracle unix external tables.
Hi, I'm trying to access files on windows2k using oracle external tables on unix:
Oracle server on unix: oracle ver. is 9.2.0.6 and OS is 5.8 Generic_117000-03 sun4u sparc SUNW,Sun-Fire
1. Created dir object on oracle unix pointing to windows path
2. created user
3. Assigned read and write privs on dir to user
4. created external table using dir step 1
5. select on external table
When I FTP the files into unix and recreate dir object, it works, but if I point dir object into windows path, it fails.
Is possible to do this?
Tks
GAPHi
The directory object must be accesible to your Database server, so if the Database is in unix you must create the directory in unix.
I don´t know software that allow unix systems to see a windows file system. Maybe windows can see unix from a samba server or NFS. -
Oracle 9i External Tables Error
Hello,
I am getting following error in querying an external table.
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 "identifier": expecting one of: "comma, char, date, defaultif, decimal, double, float, integer, (, nullif, oracle_date, oracle_number, position, raw, recnum, ), unsigned, varrawc, varchar, varraw, varcharc, zoned"
KUP-01008: the bad identifier was: number
KUP-01007: at line 8 column 23
ORA-06512: at "SYS.ORACLE_LOADER", line 14
OR
Below is how External table is created.
CREATE TABLE CXS_Datatraffic (
tablespace_name varchar2(30),
owner varchar2(30),
index_name varchar2(30),
clustering_factor number,
leaf_blocks number,
blevel number,
next_extent number,
extents number,
isegment_type varchar2(18),
index_bytes number,
table_tspace_name varchar2(30),
table_owner varchar2(30),
table_name varchar2(30),
table_extent number,
table_extents number,
tsegment_type varchar2(18),
table_bytes NUMBER,
Acurdate date
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY CXS_XMLPATH
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
tablespace_name char(30),
owner char(30),
index_name char(30),
clustering_factor number,
leaf_blocks number,
blevel number,
next_extent number,
extents number,
isegment_type char(18),
index_bytes number,
table_tspace_name char(30),
table_owner char(30),
table_name char(30),
table_extent number,
table_extents number,
tsegment_type char(18),
table_bytes NUMBER,
Acurdate date
LOCATION ('DataTraffic.csv')
PARALLEL 5
REJECT LIMIT UNLIMITED;
And below is the datafile content(just one record) I am trying to read.
"APPLSYSX","APPLSYS","FND_ATTACHED_DOCUMENTS_U1",1100732,17459,2,,56,"INDEX",162660352,"APPLSYSD","APPLSYS",,"FND_ATTACHED_DOCUMENTS",,84,"TABLE",344981504,21-DEC-09
I am not sure where I am doing wrong.
Please help.
Thank you for your time in reading this post.
-RRECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','i think this is the problem. DELIMITED should be ',' and TERMINATED must be NEWLINE -
Hi,
I am working in Oracle 8i. I need to use Oracle 8i External Table to load data in the database. But I am getting the following error
ORA-00922: Missing or Invalid Option
The snippet which I used is as follows:
create table ext_table_csv (
a NUMBER,
n NUMBER,
m NUMBER
organization external
type oracle_loader
default directory swami
access parameters (
records delimited by newline
fields terminated by ';'
missing field values are null
location ('sample.txt')
PARALLEL
reject limit 0
The input file data is
018307;20080421;123457
018307;20080421;123457
Please let me know how this can be done in Oracle 8i and I have to use Oracle Loader only.Its a new feature introduced in Oracle 9i.
http://download.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90120/ch2_feat.htm#58871
For 8i, SQL*Loader is the only option. -
XML File in External Table - OS error permission denied.
Hi.
10g R2, Red Hat Linux
I'm using the article (see below, taken from http://www.dbazine.com/olc/olc-articles/scardina1 by Mark Scardina) to create an external table where I'd store my XML file.
So, I
1. Created a directory xmlfile_dir
2. Granted access to needed db user
3. Created the table
CREATE TABLE relayxml_xt (doc CLOB)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY xmlfile_dir
ACCESS PARAMETERS
FIELDS (lobfn CHAR TERMINATED BY ',')
COLUMN TRANSFORMS (doc FROM lobfile (lobfn))
LOCATION ('xml.dat')
REJECT LIMIT UNLIMITED;
4. mv relay.xml /xmlfile_dir/xml.dat
When I run SELECT * FROM relayxml_xt I get this:
Error starting at line 1 in command:
select * from relayxml_xt
Error report:
SQL Error: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file RELAYXML_XT_28773.log
OS error Permission denied
ORA-06512: at "SYS.ORACLE_LOADER", line 19
29913. 00000 - "error in executing %s callout"
*Cause: The execution of the specified callout caused an error.
*Action: Examine the error messages take appropriate action.
What am I doing wrong?
Thanks,
Using External Tables
Introduced in Oracle9i, Oracle’s external table feature offers a solution to define a table in the database while leaving the data stored outside of the database. Prior to Oracle Database 10g, external tables can be used only as read-only tables. In other words, if you create an external table for XML files, these files can be queries and the table can be joined with other tables. However, no DML operations, such as INSERT, UPDATE, and DELETE, are allowed on the external tables.
Note: In Oracle Database 10g , by using the ORACLE_DATAPUMP driver instead of the default ORACLE_DRIVER, you can write to external tables. In Oracle Database 10g, you can define VARCHAR2 and CLOB columns in external tables to store XML documents. The following example shows how you can create an external table with a CLOB column to store the XML documents. First, you need to create a DIRECTORY to read the data files:
CREATE DIRECTORY data_file_dir AS 'D:\xmlbook\Examples\Chapter9\src\xml';
GRANT READ, WRITE ON DIRECTORY data_file_dir TO demo;
Then, you can use this DIRECTORY to define an external table:
CREATE TABLE customer_xt (doc CLOB)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY data_file_dir
ACCESS PARAMETERS
FIELDS (lobfn CHAR TERMINATED BY ',')
COLUMN TRANSFORMS (doc FROM lobfile (lobfn))
LOCATION ('xml.dat')
REJECT LIMIT UNLIMITED;
The xml.dat file follows:
customer1.xml
customer2.xml
If you describe the table, you can see the following definition:
SQL> DESC customer_xt;
Name Null? Type
DOC CLOB
Then, you can query the XML document as follows:
SELECT XMLType(doc).extract('/Customer/EMAIL')
FROM customer_xt;
Though the query requires run-time XMLType creation and XPath evaluation, this approach is useful when applications just need a few queries on the XML data and don’t want to upload the XML data into database. In Oracle Database 10g, you cannot create external tables that contain pre-defined XMLType column types.
Message was edited by:
vi2167Your don't have the proper operating system privileges. Be sure that you (=oracle OS user / the OS Linux user that is starting the database) are allowed have read privs on the path and/or file.
for example...
chown -Rf /xxxxxxx/xxxx/etc
ls -l file.xml
file.xml oracle:oinstall rw-rw-rw -
We have excel spread sheet.
We wanted to load data from excel spread sheet to Oracle via external table.
I saved my file into .txt format.
No I need to create external table in oracle DB.
my question is as follows:
Do I need to define exact lenght of datatype per data?
Now data of column city take 16 slots in data file.
But I defined size 30, is it ok?
SQL>CREATE TABLE External_City
CITY VARCHAR2(30),
STATE VARCHAR2(20),
ZIP VARCHAR2(10),
COUNTRY VARCHAR2(30)
ORGANIZATION EXTERNAL
TYPE ORACLE_LOADER
DEFAULT DIRECTORY DATALOAD
ACCESS PARAMETERS
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ‘,’
MISSING FIELD VALUES ARE NULL
LOCATION (’city_comma.txt’)
REJECT LIMIT UNLIMITED;
Do we need to define data position in external table?I do not think it has to do with your data or positon of data in it. I am not sure what or where your file is. You need to ensure accessibility to it. it is not seeing the file at all.
BTW - avoid using udump location as your directory location. Change the directory location (I am not saying it is the cause).
Here is my test. Although my class.dat file is empty, it shows that your external table should work once your file and directory is accessible. I have only replaced DATALOAD with mytest_dir
testdb@DBMSDIRECT01:/export/home/oracle/dbmsdirect/test:touch class.dat
testdb@DBMSDIRECT01:/export/home/oracle/dbmsdirect/test:sqlplus /nolog
SQL*Plus: Release 10.2.0.2.0 - Production on Mon May 19 15:34:55 2008
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
SQL> connect testuser
Enter password:
Connected.
SQL> create or replace directory mytest_dir as '/export/home/oracle/dbmsdirect/test';
Directory created.
SQL>
SQL>
SQL> create table external_class
2 (
3 item_no number(10),
4 class varchar2(255),
5 level_date date,
6 note varchar2(4),
7 sched_level varchar2(10),
8 min_range number(12),
9 max_range number(14)
10 )
11 ORGANIZATION EXTERNAL
12 (
13 TYPE oracle_loader
14 DEFAULT DIRECTORY mytest_dir
15 ACCESS PARAMETERS (
16 RECORDS DELIMITED BY NEWLINE
17 FIELDS TERMINATED BY ','
18 MISSING FIELD VALUES ARE NULL
19 REJECT ROWS WITH ALL NULL FIELDS
20 (item_no, class, level_date, note,sched_level,min_range,max_range)
21 )
22 LOCATION ('class.dat')
23 )
24 PARALLEL
REJECT LIMIT 0;
25
Table created.
SQL> desc external_class
Name Null? Type
ITEM_NO NUMBER(10)
CLASS VARCHAR2(255)
LEVEL_DATE DATE
NOTE VARCHAR2(4)
SCHED_LEVEL VARCHAR2(10)
MIN_RANGE NUMBER(12)
MAX_RANGE NUMBER(14)
SQL>
SQL> select * from external_class;
no rows selected
SQL>
SQL> ho rm class.dat
SQL>
SQL> select * from external_class;
select * from external_class
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file class.dat in MYTEST_DIR not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19
SQL>
SQL> ho touch class.dat
SQL>
SQL> select * from external_class;
no rows selected
SQL>
SQL>
SQL> col DIRECTORY_PATH format a50
SQL> set lines 200
SQL> select * from dba_directories where DIRECTORY_NAME = 'MYTEST_DIR';
OWNER DIRECTORY_NAME DIRECTORY_PATH
SYS MYTEST_DIR /export/home/oracle/dbmsdirect/test
SQL> -
Setting reject_limit error in external tables
I am setting the reject_limit for an external table but it is giving this error.
My access data in csv i am importing into oracle using external tables.
Please suggest how i can set the reject limit
thnak you
SQL> ALTER TABLE AIRFIELD_TEMP SET REJECT_LIMIT 100;
ALTER TABLE AIRFIELD_TEMP SET REJECT_LIMIT 100
ERROR at line 1:
ORA-02000: missing UNUSED keywordRemove the "SET" keyword.
-
When will external table field_list in access parameters support varchar2?
Hello all,
Currently I'm working on a CSV error check/upload/download utility (in pl/sql) using external tables. However, within the access parameters section, when I tried to use varchar2 in the field list to map to data fields in csv, oracle (10g) complaint that I cannot use varchar2.
Therefore I am forced to use char (Feuerstein explictly told us not to use varchar in PL/SQL Programming) to map to the data. However, since some fields in the DB are actually varchar2(4000), and the max length supported by char type in sqlplus is 2000, I'm creating this ridiculous machine:
- data in csv can hava a maxlength of 4000 characters
- staging table to which csv data will go to is varchar2(4000)
- field list in external table creates a bottleneck of char(2000)
As a result, I'm betting on the user never will enter any string longer than 2000 character into csv, even though the DB supports it. However, this would be way too fragile to go into production.
Does anybody know if Oracle 11g external tables support varchar2, or are there any workarounds (besides using sqlldr)? Many thanks.Hi, my external table spec is something like this:
create table x_table (
field1 varchar2(4000),
field2 varchar2(4000),
field3 varchar2(4000))
organization external (type oracle_loader default directory ext_tab_dir
access parameters (
records delimited by newline
badfile ext_tab_dir:'importcsv.bad'
discardfile ext_tab_dir:'discarded.txt'
logfile ext_tab_dir:'importcsv.log'
skip 1
fields terminated by '|' lrtrim
missing field values are null
reject rows with all null fields
(field1 char(2000),
field2 char(2000),
field3 char(2000))
location ('test_xtable.csv'))
reject limit unlimited;
The portion below the phrase "reject rows with all null fields" is what I meant by "field mapping", since I use it to match the csv structure. The order within the fields specification above the "organization external" can be rearranged any way I like, as long as the field name has a matching one in the "field mapping". Right now, I can only use char(2000) or varchar(2000) in the "field mapping" area, but not varchar2. Any ideas? -
Error while creating oracle external table
I am trying to create an external table with the following syntax. WhenI have executed this statement in my server which running in my machine, it is working fine. Whine I try to run the same statement on different server, it is giving the below error. I have verified the grants on both the schemas, they are simillar.
create table ext_ORGBASIC_CLIENT1(
Serial_Number varchar2(1000),
Add_Edit_Organization varchar2(1000),
Parent_Organization varchar2(1000),
Organization_Code varchar2(1000),
Organization_Name varchar2(1000),
Legal_Entity varchar2(1000),
Active varchar2(1000),
Require_Entity_Use__as_Matchin varchar2(1000),
Pass_On_Tax_On_Tax_To_Customer varchar2(1000),
Allow_Exemption_Without_Receiv varchar2(1000),
Entiy_Use_Code_Association varchar2(1000),
Tax_Calculation_Type_Code varchar2(1000),
Transaction_Type_Code varchar2(1000),
Transaction_Source_Code varchar2(1000),
Taxware_Delivery_Terms_Code varchar2(1000),
Taxware_Mode_of_Transport_Code varchar2(1000),
Debit_Credit_Indicator varchar2(1000),
Discount_Type_Code varchar2(1000),
Place_of_Principal_Negotiation varchar2(1000),
Quantity_Unit_of_Measure_Code varchar2(1000),
Good_Service_Category_Code varchar2(1000),
Tax_Rate_Of_Geo_Code_To_Be_Aut varchar2(1000))
organization external
( type oracle_loader default directory EXT_TAB_DIR
access parameters ( records delimited by newline characterset US7ASCII load
when (serial_number != 'Number' and serial_number != '#')
badfile 'EXT_TAB_DIR':'CLIENT1.bad'
logfile 'EXT_TAB_DIR':'CLIENT1.log'
fields terminated by ',' optionally enclosed by '"' lrtrim missing field values are null
reject rows with all null fields )
location ('C_CLIENT1_TXWR_FS1_TWEBULK_ORGBASIC_1_1_20091126102230_001_CSV.csv') )
parallel reject limit unlimited
while querieng from the table I am getting the below error
select * from ext_orgbasic_client1;
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04001: error opening file CLIENT1.log
ORA-06512: at "SYS.ORACLE_LOADER", line 19I try to run the same statement on different server, it is giving the below errorSame OS name & version?
Same Oracle version to 4 decimal places?
Same OS file permissions?
Same OS pathnames? -
Hi,
I am trying to insert a csv file as a single record as a CLOB (one row for entire csv file) and trying to do that via external table. But unalbe to do so. Following is the syntax I tried with:
create table testext_tab2
( file_data clob
organization external
TYPE ORACLE_LOADER
DEFAULT DIRECTORY dir_n1
access parameters
RECORDS DELIMITED BY NEWLINE
BADFILE DIR_N1:'lob_tab_%a_%p.bad'
LOGFILE DIR_N1:'lob_tab_%a_%p.log'
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
clob_filename CHAR(100)
COLUMN TRANSFORMS (file_data FROM LOBFILE (clob_filename) FROM (DIR_N1) CLOB)
LOCATION ('emp.txt')
REJECT LIMIT UNLIMITED
--it gives the output that the table is created but the table does not have any rows (select count(*) from testext_tab2 gives 0 rows)
-- and the logfile has entries like follows:
Fields in Data Source:
CLOB_FILENAME CHAR (100)
Terminated by ","
Trim whitespace same as SQL Loader
Column Transformations
FILE_DATA
is set from a LOBFILE
directory is from constant DIR_N1
directory object list is ignored
file is from field CLOB_FILENAME
file contains character data
in character set WE8ISO8859P1
KUP-04001: error opening file /oracle/dba/dir_n1/7369
KUP-04017: OS message: No such file or directory
KUP-04065: error processing LOBFILE for field FILE_DATA
KUP-04101: record 1 rejected in file /oracle/dba/dir_n1/emp.txt
KUP-04001: error opening file /oracle/dba/dir_n1/7499
KUP-04017: OS message: No such file or directory
KUP-04065: error processing LOBFILE for field FILE_DATA
KUP-04101: record 2 rejected in file /oracle/dba/dir_n1/emp.txt
KUP-04001: error opening file /oracle/dba/dir_n1/7521
KUP-04017: OS message: No such file or directory
KUP-04065: error processing LOBFILE for field FILE_DATA
KUP-04101: record 3 rejected in file /oracle/dba/dir_n1/emp.txt
and also the file to be loaded (emp.txt) has data like this:
7369,SMITH,CLERK,7902,12/17/1980,800,null,20
7499,ALLEN,SALESMAN,7698,2/20/1981,1600,300,30
7521,WARD,SALESMAN,7698,2/22/1981,1250,500,30
7566,JONES,MANAGER,7839,4/2/1981,2975,null,20
7654,MARTIN,SALESMAN,7698,9/28/1981,1250,1400,30
7698,BLAKE,MANAGER,7839,5/1/1981,2850,null,30
7782,CLARK,MANAGER,7839,6/9/1981,2450,null,10
7788,SCOTT,ANALYST,7566,12/9/1982,3000,null,20
7839,KING,PRESIDENT,null,11/17/1981,5000,null,10
7844,TURNER,SALESMAN,7698,9/8/1981,1500,0,30
7876,ADAMS,CLERK,7788,1/12/1983,1100,null,20
7900,JAMES,CLERK,7698,12/3/1981,950,null,30
7902,FORD,ANALYST,7566,12/3/1981,3000,null,20
7934,MILLER,CLERK,7782,1/23/1982,1300,null,10I will be thankful for help on this. Also I read on asktom site (http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1669379500346411993)
that LOB are not supported for external tables but there are other sites with examples of CLOB being loaded by external tables.
With regards,
OrausernCMcM wrote:
Hi all
We have an application that runs fine on 10.2.0.4 on most platforms, but a customer has reported an error when running 10.2.0.3 on HP. We have since reproduced the error on 10.2.0.3 on XP but have failed to reproduce it on Solaris or Linux.
The exact error is within a set of procedures, but the simplest reproducible form of the error is pasted in below.Except that you haven't pasted output to show us what the actual error is. Are we supposed to guess?
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> ed
Wrote file afiedt.buf
1 declare
2 vstrg clob:= 'A';
3 Thisstrg varchar2(32000);
4 begin
5 for i in 1..31999 loop
6 vstrg := vstrg||'A';
7 end loop;
8 ThisStrg := vStrg;
9* end;
SQL> /
PL/SQL procedure successfully completed.
SQL>Works ok for me on 10.2.0.1 (Windows 2003 server) -
External tables in Oracle 11g database is not loading null value records
We have upgraded our DB from Oracle 9i to 11g...
It was noticed that data load to external tables in 9i is rejecting the records with null columns..However upgrading it to 11g,it allows the records with null values.
Is there are way to restrict loading the records that has few coulmns that are null..
Can you please share if this is the expected behaviour in Oracle 11g...
Thanks.Data isn't really loaded to an External Table. Rather, the external table lets you query an external data source as if it were a regular database table. To not see the rows with the NULL value, simply filter those rows out with your SQL statement:
SELECT * FROM my_external_table WHERE colX IS NOT NULL;
HTH,
Brian
Maybe you are looking for
-
Contact info not sync-ed when using iPod
Have new 80 gig photo iPod. The calendar sync's just fine with my other Macs. But the contact/address book is only bring SOME of the field data over the iPod. All the iPod shows is the name and email fields, and not the other fields. Am I doing somet
-
Pricing Procedure to be configured for calculating excise
Hello , I have new pricing procedure to be configured for calculating excise on base value , the procedure is as under Base Price - X Amount Surface transport - Y Amo
-
How do you create a Social Sharing menu button like the one available in Android?
For sharing images via: Facebook Flickr Picasa Email MMS Is there an API for this? I've seen a lot of Android apps have this feature, so it seems like an API built into Android but do we get access to this feature too?
-
JAXB 2.0 - another newbie
I am generating an XML file for the following Java class. public class NCIPConfig private String name; private int port; private boolean enabled = true; @XmlElement(name="message", type=Message.class) public List<Message> m
-
Ipod nano as a hard drive?
Can you use the Ipod nano as a hard disk on your computer like the other Ipods since it uses a flash drive?