External Table - FIELDS TERMINATED BY
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Prod
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
Sample:
CREATE TABLE emp_load (first_name CHAR(15), last_name CHAR(20), year_of_birth CHAR(4))
ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY ext_tab_dir
ACCESS PARAMETERS (FIELDS TERMINATED BY "," ENCLOSED BY "(" AND ")")
LOCATION ('info.dat'));In the clause
FIELDS TERMINATED BY ...
Does Oracle support REGEX to terminate a field? tx
Edited by: read code on May 20, 2012 7:39 PM
Edited by: read code on May 20, 2012 7:57 PM
Edited by: read code on May 20, 2012 11:47 PM
The syntax specified by Oracle External Table for field definition says :
FIELD TERMINATED BY ( string | WHITESPACE ) .... [ OPTIONALLY CLAUSE ]
{code}
So you can specify either keywork WHITESPACE or delimiter as string. When you specify any function or expression it is treated as literal
# You cannot even use simple function. For example you cannot specify CHR(36) for $ though we know CHR(36) is equal to '$' character but oracle does not computer function to calculate the string literal.
# Similar case is for regular expression function
Hope it helps.
Similar Messages
-
Modifying field lenght for an external table via OWB
Hi folks,
After, I would like to thanks everyone that helps to improve the level of quality of this forum with questions and answers!
I am having a problem with flat files and external tables:
I can't specify the field length in the ORACLE_LOADER parameters via OWB, so the driver consider that all my fields are CHAR(255). Concerning the online documentation for Oracle Utilities Part. no. A96652-01 on page 12-21, it's write that the lack of specification about the datatype or length of a field, the driver will assume the fields name and order of the fields defined on the external table fields and they will be CHAR(255). My problem is that we need to use a field bigger than CHAR(255), so I made this external table for example about our problem:
CREATE TABLE "TESTE"
"NOME" VARCHAR2(300),
"SOBRENOME" VARCHAR2(300))
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY TARGET_LOC_SRC_FILES_LOC
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
CHARACTERSET WE8MSWIN1252
STRING SIZES ARE IN BYTES
NOBADFILE
NODISCARDFILE
NOLOGFILE
FIELDS
TERMINATED BY ';'
NOTRIM
"NOME" ,
"SOBRENOME"
) LOCATION (
TARGET_LOC_SRC_FILES_LOC:'Partners.txt'
REJECT LIMIT UNLIMITED
NOPARALLEL
When we put by hand the field length in this script, it works fine!
Is there a way to put the length of the fields in the FIELDS clause of the SQL*Loader control file using OWB?Carlos,
Have you tried the following:
- Update the data types in the sampled flat file (i.e. go into the field definitions and edit the length).
- Go into the mapping and inbound reconcile the table (right-mouse click the file operator and select inbound reconcile).
- Regenerate, and review the result.
Thanks,
Mark. -
Substr in external table definition
Hi Guys,
I have an external table where I am loading a txt file. The issue being, in the txt file I have a column with a variable length. This column houses the application/website link that is not of a fixed length. My external table field width is 100, but the txt file value is more than that. Now, I want to only insert this field for the 100 characters.
I tried using substr as shown in the example below, but it fails. Any idea what could be the alternative or if I am doing it right?
Here's my external table properties (access parameters) and I am trying to use 'substr' on field4
records delimited BY NEWLINE
badfile BAD_DIR:'email_events%a_%p.bad'
LOGFILE LOG_DIR:'email_events%a_%p.log'
fields terminated by '\t'
missing field values are null
event_type,
cm_timestamp,
issue_id,
cm_uid,
field1,
field2,
field3,
field4 "substr(:field4,1,100)",
field5,
field6,
field7,
field8,
field9,
field10,
field11,
field12,
field13,
field14
)Just set your external table definition to query the full thing and then when you come to insert that data to a real table from the external table you can apply the substr in that query.
-
Fields terminated by (SQL loader, external table) question?
Hello.
I have a txt file which looks like:
Columns:
A..........B.........C...........D.........E..............F.............G...........H
739.......P.........0002......05........25012006..25012006..5...........data group
. = space
There are different number of spaces between columns.
What must i use in FIELDS TERMINATED BY to import this?
Thanks.So, don't use FIELDS TERMINATED BY, but, as Ino suggested, fixed format, something like
LOAD DATA
TRUNCATE INTO TABLE <table name>
(a position(1:10),
b position(11:20),
c position(21:30),
d position(31:40),
e position(41:48) date "ddmmyyyy",
f position(51:58) date "ddmmyyyy",
g position(61:72),
h position(73:92)) -
Using MISSING FIELD VALUES ARE NULL for external table
I want to place a null for values missing in the sub_account field. Here is my external table:
CREATE OR REPLACE DIRECTORY INCOMING_ORDERS_log_dir
AS 'c:\starpubs\starpubs\dataformats\logs\INCOMING_ORDERS\log';
CREATE OR REPLACE DIRECTORY INCOMING_ORDERS_bad_dir
AS 'c:\starpubs\starpubs\dataformats\logs\INCOMING_ORDERS\bad';
create table ext_INCOMING_ORDERS_table (
Account varchar(5),
Sub_Account varchar(1),
Override_Code varchar(1),
Nomenclature varchar(28),
chg_nbr varchar(3),
quantity integer,
U_I varchar(5),
zipcode varchar(5),
type_reject varchar(2)
organization external
type oracle_loader
default directory user_dir
access parameters
records delimited by newline
missing field values are null
badfile INCOMING_ORDERS_bad_dir:'INCOMING_ORDERS%a_%p.bad'
logfile INCOMING_ORDERS_log_dir:'INCOMING_ORDERS%a_%p.log'
fields
Account(1:5) char(5),
Sub_Account(7:7) char(1),
Override_Code(10:10) char(1),
Nomenclature(11:38) char(28),
chg_nbr(40:42) char(3),
quantity(44:48) integer external,
U_I(50:54) char(5),
zipcode(56:60) char(5),
type_reject(61:62) char(2)
location('PTCLICK.MANUAL.NOMEN.TXT','PTCLICK.ORDERS.TXT', 'EUR_RES.TXT', 'MQ.TXT', 'BPRO.TXT')
reject limit unlimited;
How can I place the MISSING FIELD VALUES ARE NULL for missing values for the sub_account?made the change I received this error:
SQL> select * from ext_INCOMING_ORDERS_table;
select * from ext_INCOMING_ORDERS_table
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 "no": expecting one of: "comma, date_format,
defaultif, enclosed, ltrim, lrtrim, ldrtrim, notrim, nullif, optionally, ),
rtrim, terminated"
KUP-01007: at line 7 column 26
CREATE OR REPLACE DIRECTORY INCOMING_ORDERS_log_dir
AS 'c:\starpubs\starpubs\dataformats\logs\INCOMING_ORDERS\log';
CREATE OR REPLACE DIRECTORY INCOMING_ORDERS_bad_dir
AS 'c:\starpubs\starpubs\dataformats\logs\INCOMING_ORDERS\bad';
create table ext_INCOMING_ORDERS_table (
Account varchar(5),
Sub_Account varchar(1),
Override_Code varchar(1),
Nomenclature varchar(28),
chg_nbr varchar(3),
quantity integer,
U_I varchar(5),
zipcode varchar(5),
type_reject varchar(2)
organization external
type oracle_loader
default directory user_dir
access parameters
records delimited by newline
badfile INCOMING_ORDERS_bad_dir:'INCOMING_ORDERS%a_%p.bad'
logfile INCOMING_ORDERS_log_dir:'INCOMING_ORDERS%a_%p.log'
fields
Account(1:5) char(5),
Sub_Account(7:7) char(1) NO PRESERVE BLANKS,
Override_Code(10:10) char(1),
Nomenclature(11:38) char(28),
chg_nbr(40:42) char(3),
quantity(44:48) integer external,
U_I(50:54) char(5),
zipcode(56:60) char(5),
type_reject(61:62) char(2)
location('PTCLICK.MANUAL.NOMEN.TXT','PTCLICK.ORDERS.TXT', 'EUR_RES.TXT', 'MQ.TXT', 'BPRO.TXT')
reject limit unlimited; -
Creating external table - from a file with multiple field separators
I need to create an external table from a flat file containing multiple field separators (",", ";" and "|").
Is there any way to specifiy this in the CREATE TABLE (external) statement?
FIELDS TERMINATED BY "," -- Somehow list more than just comma here?
We receive the file from a vendor every week. I am trying to set up a process for some non-technical users, and I want to keep this process transparent to them and not require them to load the data into Oracle.
I'd appreciate your help!scott@ORA92> CREATE OR REPLACE DIRECTORY my_dir AS 'c:\oracle'
2 /
Directory created.
scott@ORA92> CREATE TABLE external_table
2 (COL1 NUMBER,
3 COL2 VARCHAR2(6),
4 COL3 VARCHAR2(6),
5 COL4 VARCHAR2(6),
6 COL5 VARCHAR2(6))
7 ORGANIZATION external
8 (TYPE oracle_loader
9 DEFAULT DIRECTORY my_dir
10 ACCESS PARAMETERS
11 (FIELDS
12 (COL1 CHAR(255)
13 TERMINATED BY "|",
14 COL2 CHAR(255)
15 TERMINATED BY ",",
16 COL3 CHAR(255)
17 TERMINATED BY ";",
18 COL4 CHAR(255)
19 TERMINATED BY ",",
20 COL5 CHAR(255)
21 TERMINATED BY ","))
22 location ('flat_file.txt'))
23 /
Table created.
scott@ORA92> select * from external_table
2 /
COL1 COL2 COL3 COL4 COL5
1 Field1 Field2 Field3 Field4
2 Field1 Field2 Field3 Field4
scott@ORA92> -
How to remove carraige return from the field while loading external table
I am facing an issue of not getting rid of carraige returns present in the fileds of the source .csv file while loading the records into external table.
I had tried using LRTRIM, but it does not help.
The error I am getting is:
KUP-04021: field formatting error for field POPULATION_DESCRIPTION
KUP-04037: terminator not found
I am pasting one record out of the .csv file which is causing this error as below:
"Business Card Accounts
",123,7 BizCard - Gamers,Control,"Business Card Accounts
",75270,75271
You can see the carraige return in the 1st field as well as 5th field. Filed are separated by commas & eclosed by double quotes.
Could anybody help on this please?Can you copy the file to an external table only version, and then dos2unix it?
Alternatively, you can use the ACCESS PARAMETERS area in your external table definition to set that your RECORDS DELIMITED BY carriage returns, instead of the default.
Check out the example here http://www.psoug.org/reference/externaltab.html -
How not to consider a missing field for external tables
My Oracle vers. is 10gR2
I've created an external table using this syntax:
create table ext_table
(a number(5),
b number(5),
c varchar2(1000))
organization external
(type ORACLE_LOADER
default directory FLAISTD
access parameters (records delimited by newline
fields terminated by "#"
(a char(5),
b char(5),
c char(1000)))
location ('file.csv')
My problem is this. I've got a file.XLS that I save as file.CSV Sometimes any row of the file.XLS misses of the last column and so in my file.CSV I can have something like this:
123#123#xxx
456#456
and when I try to perform a select * from ext_table I get an error because it expects a missing field.
How can I do? Can I "say" in the create table above something for warning that the last field might miss?
Thanks in advance!Solomon Yakobson wrote:
Use TRAILING NULLCOLS:Oops, it is external table not SQL*Loader. So it should be MISSING FIELD VALUES ARE NULL:
create table ext_table
(a number(5),
b number(5),
c varchar2(1000))
organization external
(type ORACLE_LOADER
default directory TEMP
access parameters (records delimited by newline
fields terminated by "#" missing field values are null
(a char(5),
b char(5),
c char(1000)))
location ('file.csv')
Table created.
SQL> select *
2 from ext_table
3 /
A B C
123 123 xxx
456 456
SQL>SY. -
External table varchar2(4000 byte) field storing 255 bytes only
Hi all,
wondering if someone can tell me what im missing here.
I have an external table with a column defined as varchar2(4000 byte). the file has a row in it with 255 characters (all number 2's for simplicity). when i query the table all is well. if i add 1 more 2 to the string (256 chars) it fails. im sure its something stupidly simple but what am i missing? shouldnt it query fine until 4000 chars?
thanks,
DaveI ran your testcase, thanks for that.
Make sure to read the SQL and PL/SQL FAQ as well (the first sticky thread on this forum), it explains how to post formatted code and lots of other stuff.
Anyway, .log file gave me:
LOG file opened at 07/18/11 20:05:33
Field Definitions for table DAVEP2
Record format DELIMITED, delimited by 0A
Data in file has same endianness as the platform
Rows with all null fields are accepted
Fields in Data Source:
MY_STRING CHAR (255)
Terminated by ","
Enclosed by """ and """
Trim whitespace same as SQL LoaderSo, what happens if you create the table as follows:
CREATE TABLE davep2 (
my_string VARCHAR2(4000 BYTE) NULL
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY FILE_TEST
ACCESS PARAMETERS
( RECORDS DELIMITED BY 0x'0A' BADFILE FILE_TEST:'davep2.bad'
LOGFILE FILE_TEST:'davep2.log'
FIELDS TERMINATED BY ',' optionally enclosed by '"' and '"'
missing field values are null
my_string char(4000)
LOCATION (FILE_TEST:'DaveP.csv')) REJECT LIMIT 0 NOPARALLEL -
DATE fields and LOG files in context with external tables
I am facing two problems when dealing with the external tables feature in Oracle 9i.
I created an External Table with some fileds with the DATE data type . There were no issues during the creation part. But when i query the table, the DATE fields are not properly selected though the data is there in the files. Is there any ideas to deal with this ?
My next question is regarding the log files. The contents in the log file seems to be growing when querying the external tables. Is there a way to control this behaviour?
Suggestions / Advices on the above two issues are welcome.
Thanks
LakshminarayananHi
If you have date datatypes than:
select
greatest(TABCASER1.CASERRECIEVEDDATE, EVCASERS.FINALEVDATES, EVCASERS.PUBLICATIONDATE, EVCASERS.PUBLICATIONDATE, TABCASER.COMPAREACCEPDATE)
from TABCASER, TABCASER1, EVCASERS
where ...-- join and other conditions
1. greatest is good enough
2. to_date creates date dataype from string with the format of format string ('mm/dd/yyyy')
3. decode(a, b, c, d) is a function: if a = b than return c else d. NULL means that there is no data in the cell of the table.
6. to format the date for display use to_char function with format modell as in the to_date function.
Ott Karesz
http://www.trendo-kft.hu -
Report query not returning the field value from external table
hi
I have an issue regarding reports. I have a query having 4 fields from external table and remaining from db tables. the report query returns all the fields from the db tables and only 2 fields from external table. but the same query if I tried in plsql developer it returns all the fields values.
Can anyone please help me in this issue.
Thanks and Regards
kkDuplicate post?
value not displaying in report whereas it returns in plsql developer
value not displaying in report whereas it returns in plsql developer
Please log a SR if you do not get any reply to your thread instead of creating new one.
Thanks,
Hussein -
External table ddl contains owbunuseX in the field list
Hi, we defined a external table in design center OWB11.1, and we defined columns like 'field1, field2... field50', but when it was generated, we found owbunused0, owbunuse1...in the field list of access parameters. why the field name is not same as the column name in the external table? Thanks.
Hi Gary
Ok, now I see. For an external table right click on it within designer tree and hit the Synchronize option, you will then get a dialog for synchronizing and when you regenerate you should be good to go.
Like other objects External Table may be bound to another object, the File (in this case). So you can synchronize the external table if you change the file (in the same way with mapping, when you change a table you can synchronize the table in and out of the mapping).
Cheers
David -
Updating a field for a number of forms from an external table
Good Day All;
This one I could not find in the help section.
I have designed a number of forms that all use the same “rates of pay” (there are 4 categories) for calculating. I was told to expect that a few more forms will be required and these new forms will also be using the same “rates of pay”
Currently I am using “switch” to insert the “rates of pay” when the user selects a category from a dropdown.
Is there a way I can update all the forms from an external “table” instead of having to update each form individually?
Thanks All
ChompHi,
If the form is Reader enabled with Acrobat, then that is going to cut out data connectons.
You should have a look at John Brinkman's blog: http://blogs.adobe.com/formfeed/2010/07/shared_data_in_packages_part_2.html. Two parts.
Also there is an example of inter-form communication here, but it may be too clunky: http://assure.ly/qQivbm.
Good luck,
Niall -
Error: while Selecting External table
Hi everybody,
When i Select an external table i am getting this error. The file is like this:
229|1|506460|SIGROUP |4890|100|0|0|10:31:01|2007/12/17|M009|20191395001|L|B|12|CLIENT|INE547A01012|10:31:00|
229|1|506460|SIGROUP |4900|900|0|0|10:31:01|2007/12/17|M009|20191395001|L|B|13|CLIENT|INE547A01012|10:31:00|
229|1|500407|SWARAJENG |21400|300|0|0|10:33:28|2007/12/17|OWN|20191397001|L|B|154|OWN|INE277A01016|10:33:28|
I had created the Table like this:
SQL> CREATE TABLE TEMP_SAUDA
2 (S_A VARCHAR2(20),
3 S_TYPE VARCHAR2(20),
4 S_CO VARCHAR2(20),
5 S_CONAME VARCHAR2(40),
6 S_RATE NUMBER,
7 S_QTY NUMBER,
8 S_G NUMBER,
9 S_H NUMBER,
10 S_TIME TIMESTAMP WITH TIME ZONE,
11 S_DATE DATE,
12 S_PCODE VARCHAR2(20),
13 S_SETNO VARCHAR2(20),
14 S_M VARCHAR2(20),
15 S_N VARCHAR2(20),
16 S_O VARCHAR2(20),
17 S_CLIENTOWN VARCHAR2(10),
18 S_ISIN VARCHAR2(12),
19 S_ORDER_TIME TIMESTAMP WITH TIME ZONE
20 )
21 ORGANIZATION EXTERNAL
22 (TYPE oracle_loader
23 DEFAULT DIRECTORY BSE17122007
24 ACCESS PARAMETERS
25 (RECORDS DELIMITED BY NEWLINE
26 FIELDS
27 (
28 S_A CHAR(20),
29 S_TYPE CHAR(20),
30 S_CO CHAR(20),
31 S_CONAME CHAR(20),
32 S_RATE CHAR(20),
33 S_QTY CHAR(20),
34 S_G CHAR(20),
35 S_H CHAR(20),
36 S_TIME CHAR(35) date_format TIMESTAMP WITH TIMEZONE mask "DD-MON-RR HH.MI.SSXFF AM TZH:TZM
37 S_DATE CHAR(22) date_format DATE mask "mm/dd/yyyy hh:mi:ss ",
38 S_PCODE CHAR(20),
39 S_SETNO CHAR(20),
40 S_M CHAR(20),
41 S_N CHAR(20),
42 S_O CHAR(20),
43 S_CLIENTOWN CHAR(20),
44 S_ISIN CHAR(20),
45 S_ORDER_TIME date_format TIMESTAMP WITH TIMEZONE mask "DD-MON-RR HH.MI.SSXFF AM TZH:TZM"
46 )
47 )
48 location (BSE17122007:'BR171207.DAT')
49 )
50 ;
Table created.
SQL> SELECT * FROM TEMP_SAUDA;
SELECT * FROM TEMP_SAUDA
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 "date_format": expecting one of: "binary_double,
binary_float, comma, char, date, defaultif, decimal, double, float, integer, (,
nullif, oracle_date, oracle_number, position, raw, recnum, ), unsigned,
varrawc, varchar, varraw, varcharc, zoned"
KUP-01007: at line 21 column 14
ORA-06512: at "SYS.ORACLE_LOADER", line 19
Is there any mistake in this table creation.
what i have to declare to the time format if the format in the file id hh:mm:ss
Thank u...!
RaviThe output you posted is completely wrong, I could not even create the table without errors.
Try with this.
CREATE TABLE TEMP_SAUDA
(S_A VARCHAR2(20),
S_TYPE VARCHAR2(20),
S_CO VARCHAR2(20),
S_CONAME VARCHAR2(40),
S_RATE NUMBER,
S_QTY NUMBER,
S_G NUMBER,
S_H NUMBER,
S_TIME TIMESTAMP WITH TIME ZONE,
S_DATE DATE,
S_PCODE VARCHAR2(20),
S_SETNO VARCHAR2(20),
S_M VARCHAR2(20),
S_N VARCHAR2(20),
S_O VARCHAR2(20),
S_CLIENTOWN VARCHAR2(10),
S_ISIN VARCHAR2(12),
S_ORDER_TIME TIMESTAMP WITH TIME ZONE
ORGANIZATION EXTERNAL
(TYPE oracle_loader
DEFAULT DIRECTORY BSE17122007
ACCESS PARAMETERS
(RECORDS DELIMITED BY NEWLINE
FIELDS terminated by "|"
S_A CHAR(20),
S_TYPE CHAR(20),
S_CO CHAR(20),
S_CONAME CHAR(20),
S_RATE CHAR(20),
S_QTY CHAR(20),
S_G CHAR(20),
S_H CHAR(20),
S_TIME CHAR(8) date_format TIMESTAMP WITH TIMEZONE mask "HH.MI.SSXFF AM TZH:TZM",
S_DATE CHAR(10) date_format DATE mask "yyyy/mm/dd",
S_PCODE CHAR(20),
S_SETNO CHAR(20),
S_M CHAR(20),
S_N CHAR(20),
S_O CHAR(20),
S_CLIENTOWN CHAR(20),
S_ISIN CHAR(20),
S_ORDER_TIME char(8) date_format TIMESTAMP WITH TIMEZONE mask "HH.MI.SSXFF AM TZH:TZM"
location (BSE17122007:'BR171207.DAT')
;With this you get:
SQL> col s_time format a40
SQL> col s_date format a40
SQL> col s_order_time format a40
SQL> r
1* select s_time,s_date,s_order_time from temp_sauda
S_TIME S_DATE S_ORDER_TIME
01-JAN-08 10.31.01.000000 AM +00:00 17.DEC.2007 00:00:00 01-JAN-08 10.31.00.000000 AM +00:00
01-JAN-08 10.31.01.000000 AM +00:00 17.DEC.2007 00:00:00 01-JAN-08 10.31.00.000000 AM +00:00
01-JAN-08 10.33.28.000000 AM +00:00 17.DEC.2007 00:00:00 01-JAN-08 10.33.28.000000 AM +00:00Be aware that your file does not contain date information for the time fields, so as you see above it is defaulted to 01-JAN-08 for the S_TIME and S_ORDER_TIME column. -
Error while creating external table
Hi i tried to create external table. The table is created but while selecting that table it is throwing below errors
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file Countries1.txt in EXT_TABLES not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19I've created temp directory in window under oracle directory " C:\oracle\product\10.2.0\temp"
In the temp directory i've a text file countries1.txt
the text file has the below information
ENG,England,English
SCO,Scotland,English
IRE,Ireland,English
WAL,Wales,WelshI've connected to system user and created one directory and granted the read and write permissions to user SCOTT.
SQL> create or replace directory ext_tables as 'C:\oracle\product\10.2.0\temp\';
Directory created.
SQL> grant read,write on directory ext_tables to scott;
Grant succeeded.The creation of external table query is
CREATE TABLE countries_ext (
country_code VARCHAR2(5),
country_name VARCHAR2(50),
country_language VARCHAR2(50)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY ext_tables
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
country_code CHAR(5),
country_name CHAR(50),
country_language CHAR(50)
LOCATION ('Countries1.txt')
PARALLEL 5
REJECT LIMIT UNLIMITED;And the error is
SQL> select *from countries_ext;
select *from countries_ext
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file Countries1.txt in EXT_TABLES not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19
SQL> Please help me in thisYou are missing something. Most probably the file does not exists in your specified path. This is working in my 10.2.0.3
Step1: Check the file is actually there.
C:\oracle\product\10.2.0>mkdir temp
C:\oracle\product\10.2.0>cd temp
C:\oracle\product\10.2.0\temp>dir
Volume in drive C is C_Drive
Volume Serial Number is 8A93-1441
Directory of C:\oracle\product\10.2.0\temp
07/30/2011 12:00 PM <DIR> .
07/30/2011 12:00 PM <DIR> ..
07/30/2011 12:00 PM 79 countries1.txt
1 File(s) 79 bytes
2 Dir(s) 50,110,582,784 bytes free
C:\oracle\product\10.2.0\temp>type countries1.txt
ENG,England,English
SCO,Scotland,English
IRE,Ireland,English
WAL,Wales,Welsh
C:\oracle\product\10.2.0\temp>Step 2: Creating the directory object.
SQL> show user
USER is "SYS"
SQL> SELECT * FROM v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
SQL> create or replace directory ext_tables as 'C:\oracle\product\10.2.0\temp';
Directory created.
SQL> grant read,write on directory ext_tables to scott;
Grant succeeded.
SQL>Step 3: Table definition.
C:\>sqlplus scott@orclsb/tiger
SQL*Plus: Release 10.1.0.4.2 - Production on Sat Jul 30 12:04:24 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> CREATE TABLE countries_ext (
2 country_code VARCHAR2(5),
3 country_name VARCHAR2(50),
4 country_language VARCHAR2(50)
5 )
6 ORGANIZATION EXTERNAL (
7 TYPE ORACLE_LOADER
8 DEFAULT DIRECTORY ext_tables
9 ACCESS PARAMETERS (
10 RECORDS DELIMITED BY NEWLINE
11 FIELDS TERMINATED BY ','
12 MISSING FIELD VALUES ARE NULL
13 (
14 country_code CHAR(5),
15 country_name CHAR(50),
16 country_language CHAR(50)
17 )
18 )
19 LOCATION ('Countries1.txt')
20 )
21 PARALLEL 5
22 REJECT LIMIT UNLIMITED;
Table created.
SQL> SELECT * FROM countries_ext;
COUNT COUNTRY_NAME
COUNTRY_LANGUAGE
ENG England
English
SCO Scotland
English
IRE Ireland
English
COUNT COUNTRY_NAME
COUNTRY_LANGUAGE
WAL Wales
Welsh
Maybe you are looking for
-
I have an iMac and MacBook Pro, both running Snow Leopard at current maintenance levels. I have an HP8500 printer connected via wi-fi. All have been working well until just recently. Now, the iMac cannot communicate with the printer. The printer icon
-
Photoshop Elements 11 download problem
I cannot reload Photoshop and Premier Elements 11 (after pc wipe clean) as it asks me to close dynamiclinkmanager.exe. I cannot find a file to close or delete only a folder with nothing to use. What do I do please?
-
Unable to start the Agent service in EPM
Hello Experts, I have installed HFM,FDQM,HFR Version 11.1.1.3 in 2003 os with Oracle database.I have the following questions 1.During the Configuration Financial management I have given 'Administrator' as a DCOM user instead of 'admin' what I have cr
-
SMB Symlinks Showing as 0kb on Windows PCs
Hello again everyone. After my previous post on problems with wide symlinks and how to fix that finally resolved I now have another irritating issue I can't seem to put my finger on. Seems that shares I have hosted off my Mac Pro over SMB are now r
-
Program not responding, webpage not responding
Lately when ever I am in Internet Exlorer 9, I often get "webpage" not responding. Webpage being whatever web page I am viewing. It also does it sometimes when I am using certain programs like Word, etc. It will eventually unfreeze, but it takes a co