473,748 Members | 6,037 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

USING EXTERNAL TABLE

debasisdas
8,127 Recognized Expert Expert
This thread contains some useful tips for using External tables.


USING EXTERNAL TABLE
=============== ========
1.THE TABLE POINTS TO EXTERNAL FILE. IF DATA IS ALTERED IN THE EXTERNAL FILE,DATA IN THE TABLE WILL ALSO CHANGE.
2.EXTERNAL TABLES CAN BE QUERIED IN THE SAME WAY AS STANDARD TABLES IN JOINS,VIEWS.... .AND CAN USE ALL TYPES OF FUNCTION ON THE EXTERNAL TABLE.
3.TO GET INFO REGARDING EXTERNAL TABLES QUERY THE "USER_EXTERNAL_ TABLES" DATA DICTIONARY VIEW.
4."USER_EXTERNA L_TABLES" DOES NOT SHOW THE NAME OF THE EXTERNAL FILE TO WHICH THE TABLE POINTS.FOR THIS QUERY "USER_EXTERNAL_ LOCATIONS"
5.USER CAN'T PERFORM ANY 'DML' OPERATION ON EXTERNAL TABLES.
6.EXTERNAL TABLES CAN'T BE INDEXED.
7.CONSTAINTS CAN'T BE SPECIFIED ON EXTERNAL TABLES,NOT EVEN A NOT NULL OR FOREIGN KEY CONSTRAINT.

First create a directory using following sample code.
Expand|Select|Wrap|Line Numbers
  1. CREATE DIRECTORY MYDIR AS 'D:\';
  2.  
Place the source file in the specified directory (path as above)

Data in the file should be specific to match the table structure.

Next

Grant read,write pregiledges to specified user.

Expand|Select|Wrap|Line Numbers
  1. GRANT READ,WRITE ON DIRECTORY MYDIR TO DEBASIS;
  2.  
Sample code to create EXTERNAL TABLE

Expand|Select|Wrap|Line Numbers
  1. create table extemp1
  2. (
  3. empno number(4),
  4. ename varchar2(10),
  5. JOB VARCHAR2(9),
  6. MGR NUMBER(4),
  7. HIREDATE DATE,
  8. SAL NUMBER(7,2),
  9. COMM NUMBER(7,2),
  10. DEPTNO NUMBER(2)
  11. )
  12. ORGANIZATION EXTERNAL
  13. (
  14. TYPE ORACLE_LOADER
  15. DEFAULT DIRECTORY MYDIR
  16. ACCESS PARAMETERS
  17. (
  18. RECORDS DELIMITED BY NEWLINE SKIP 1
  19. FIELDS TERMINATED BY ','
  20. (
  21. empno CHAR,
  22. ename CHAR,
  23. JOB CHAR,
  24. MGR CHAR,
  25. HIREDATE CHAR,
  26. SAL CHAR,
  27. COMM CHAR,
  28. DEPTNO CHAR
  29. ))
  30. LOCATION('DATA.LST')
  31. )
  32. REJECT LIMIT 1
  33. ;
  34.  
Sample example #2
=============== =======
Expand|Select|Wrap|Line Numbers
  1.  
  2. CREATE TABLE SCOTT.et
  3. (
  4.   id    NUMBER(8,3),
  5.   name  VARCHAR2(10)
  6. )
  7. ORGANIZATION EXTERNAL
  8.   (  TYPE ORACLE_LOADER
  9.      DEFAULT DIRECTORY DDD
  10.      ACCESS PARAMETERS 
  11.        (        RECORDS DELIMITED BY NEWLINE
  12.        BADFILE DDD:'et.bad'
  13.        DISCARDFILE DDD:'et.dsc'
  14.        LOGFILE DDD:'et.log'
  15.        READSIZE 512
  16.        DATE_CACHE 1000
  17.        SKIP 0
  18.        FIELDS TERMINATED BY ','
  19.        MISSING FIELD VALUES ARE NULL
  20.        REJECT ROWS WITH ALL NULL FIELDS
  21.        (
  22.          id CHAR,
  23.          name CHAR
  24.        ) )
  25.      LOCATION (DDD:'aa.txt')
  26.   )
  27. REJECT LIMIT Unlimited
  28. NOPARALLEL
  29. NOMONITORING;
  30.  
May 11 '07 #1
0 8856

Sign in to post your reply or Sign up for a free account.

Similar topics

4
9359
by: Erohsik | last post by:
I am using external tables to load data from the data file. But the log files are getting created in the datafile's directory (because of CREATE OR REPLACE DIRECTORY ...) But I want those log files get created in a perticular directory. How can I do that ? Thank you
0
11192
by: Sameers (theAngrycodeR) via .NET 247 | last post by:
I think I will get MAD very soon. Its very weired problem I amfacing here. Let me explain. I have two DBF files from which I want to export data in CSVformat. I created a desktop application and used followingconnectionstrings. Provider=Microsoft.Jet.OLEDB.4.0; DataSource=D:\MJGross\DataBases;Extended Properties=dBase III; And Provider=vfpoledb.1;Data Source=D:\MJGross\DataBases;ExtendedProperties=dBASE IV;Exclusive=false;Nulls=false ...
0
6586
by: Learner | last post by:
Gurus, I have a C# .NET Web application that downloads a datagrid to an Excel sheet. But when I upload the same excel sheet to server again, if gives me this wiered message "External table is not in the expected format". I have some idea why this is happening..Because my downloaded file is getting saved as an HTML file eventhough it will get opened in Excel and looks like an Excel file. If I open the downloaded file and do a
1
2941
by: monishkar | last post by:
Can two external table functions in DB2 LUW have the same name even though they have different specific_name? Thanks.
0
3079
by: aniendow | last post by:
Hi All, I am trying to upload a TAB delimited file into a database table. Considering the performance issue I thought EXTERNAL TABLE is my best option but with one problem, My table has CLOB columns but when I tried to create EXTERNAL TABLE with CLOB column Oracle is giving error saying "column type is not supported in external organised table." :confused: But I have to upload the flat file data along with the CLOB columns... how...
0
3179
by: Ujval Shah | last post by:
Hi, I am facing a peculiar problem. My Client Requirement is to Export and Import Excel from and To DataSet for web Application using OWC. Now Problem is When i Export file using OWC .. File's Extension is .xls but it's XML Spreadsheet .. so when i am trying to import Extended Property=EXCEL 8.0 is not supported. and it gives error "External table is not in the expected format."
5
7623
by: Patrick | last post by:
I have set the Navigation Pane so that it is not displayed on startup of my application. However, if I programmatically link to an external Access table, the navigation pane automatically reappears. Is there any way to avoid this? I am using the code below to link the external table. DoCmd.TransferDatabase A_ATTACH, "Microsoft Access", sourceDBName, A_TABLE, sourceTableName, destTableName
3
4047
by: tundal45 | last post by:
Hey Guys, I am trying to automate the process of loading data in our oracle server. As a part of that process, I am working on a perl script that loads external tables from data files. What I am seeing is that I get following error when I select from external table created using script. ORA-29913: error in executing ODCIEXTTABLEOPEN callout ORA-29400: data cartridge error KUP-00554: error encountered while parsing access parameters...
7
6779
by: gyanendar | last post by:
Hi All, I need to create an external table to extract data from a flat file which having only one field. Also from that field first two character should not come in the table. Please help me . Regards,
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.