Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Anuja.

Asked: April 24, 2003 - 12:07 pm UTC

Last updated: October 11, 2011 - 8:23 am UTC

Version: 9.0.1

Viewed 10K+ times! This question is

You Asked

Hi Tom
Can you please show me with an example , how to use external table in a procedure (to refresh the staging table). I would then like to call this procedure in dbms_job to run daily .
Thanks
Sangita


and Tom said...

No --

why?

the external table IS YOUR STAGING TABLE....

But even so -- think about it -- what is an external table? A database table that happens to be in a flat file. How do you interact with it? Using SQL. So, if you know how to move data from tableA to tableB you already know the answer.


an external table looks, feels, acts no differently to your queries then a HEAP table or an INDEX table. Just query it.

Rating

  (7 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Is it possible to access flat file from network ??

sanjay joshi, June 17, 2003 - 8:07 am UTC

Tom,
I have mapped a network drive e.g. Z: of another PC on which
a file ( result.dat ) is getting continiously appended by a
spectro-meter analysis.
I have created a directory as 
SQL> create directory data_dir as 'Z:\';
Then I have created external table.
But by using external table I am not getting the result.
Error as below.

ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file EXT_TAB_1572_3780.log
OS error The system cannot find the file specified.
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1

If I open that file through network(File->open->Notepad), showing data. 

Can we Index an ExT table

A reader, November 07, 2004 - 2:39 am UTC

Hello Sir,
Can we index an external table.
One thing that comes to my mind is create a temp table on that external table then index that.

How about indexing the actual external table which is an os file ??

Tom Kyte
November 07, 2004 - 2:41 pm UTC

No you cannot.

Same KUP-04063 error but different?

Tony, May 04, 2005 - 12:08 pm UTC

Oracle 9.2.0.6 on a Unix system. (UTF8 DB)

I have mapped a directory "\export\home\myproject".
And I have tested it on another machine (Windows) but now I can't get it to work.
(priviliges for the Oracle User is set for the folder and files, and the data and tables match)

This is the error I get:

ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file mydata_1264.log
OS error Permission denied
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1

Do you think this is the same problem as you mentioned in
</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:241814624807 <code>

Any ideas what this could be other than that clearly permissions must be set or used in some other way (maybe I am not understanding your point in your link above... ;-)

Can I disable logs for external tables in 9.2?

Thanks,
/Tony

Tom Kyte
May 04, 2005 - 1:46 pm UTC

if you want the database to see a mapped drive, you have to do what that other link says to do.

And if you want to write to that mapped drive, you have to make sure you mounted it "right"

You can disable logs, NOLOGFILE

</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:6790030213850#28508960108156 <code>

ORA-29913: error in executing ODCIEXTTABLEOPEN callout

C L, August 04, 2006 - 5:30 pm UTC

I got the similar error as Tony.

ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04063: unable to open log file New_Departments.log
OS error Permission denied
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1

After changed the permission of network directories in OS level. It works!!! Looks like the Oracle user in the server needs to have full privileges on the directories defined in the sys.all_directories.

Tom Kyte
August 05, 2006 - 10:48 am UTC

or more specifically:

if you are going to use a log file (yes by default, you can 'no logfile' it), then the place where the logfile is created must be writeable by Oracle.

ora - 29913

Raja Sekhar K, February 08, 2007 - 6:49 am UTC

Hi Tom .,

I have Created the Directory on the Server ORACLE_DATAPUMP and while querying the external table i am gettig the error ORA - 29913 ., even though i gave the read & Write privilages to the current on the directory i have created .,

Pl., help me out In regards .,

Regards
Raja K
Hyd
India
Tom Kyte
February 08, 2007 - 8:32 am UTC

insufficient data - that error simply says "please look at the real error over there"

[tkyte@desktop ~]$ oerr ora 29913
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.

external table

sirajul, October 11, 2011 - 6:47 am UTC

Hi tom,
plz help...

Enter user-name: sys as sysdba
Enter password:

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> show user
USER is "SYS"
SQL> create directory external_directory as 'c:\temp';

Directory created.

SQL>
SQL> create table external_arq(
2 text1 varchar2(1),
3 text2 varchar2(20)
4 )
5 organization external
6 (type oracle_loader
7 default directory external_directory
8 access parameters
9 (
10 records delimited by newline
11 fields
12 missing field values are null
13 (text1 position(1:1),
14 text2 position(2:20)
15 )
16 )
17 location ('TEST.TXT')
18 )
19 /

Table created.


SQL> select * from external_arq;
select * from external_arq
*
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file TEST.TXT in EXTERNAL_DIRECTORY not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19

Tom Kyte
October 11, 2011 - 8:23 am UTC

Enter user-name: sys as sysdba


stop it, stop doing that, stop using sysdba for anything other than upgrading and other truly ADMINISTRATIVE things. Just stop - now and forever.

use your OWN DBA account. period.



You do not have a file named TEST.TXT in the directory C:\TEMP on the database server (the file HAS to be on the server)

grt it!!!!!!

sirajul, October 11, 2011 - 6:56 am UTC

dear TOM

SORRY get it me wrong...
file naming.. !!!!!!

its ok now....


SQL> host dir c:\temp
Volume in drive C has no label.
Volume Serial Number is 482F-F64A

Directory of c:\temp

10/11/2011 05:51 PM <DIR> .
10/11/2011 05:51 PM <DIR> ..
10/11/2011 05:01 PM 24 TEST.TXT.txt
1 File(s) 24 bytes
2 Dir(s) 32,259,559,424 bytes free

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library