473,549 Members | 2,678 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 8830

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

Similar topics

4
9338
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
11168
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...
0
6571
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...
1
2926
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
3048
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...
0
3174
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 ...
5
7603
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",...
3
4025
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...
7
6771
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
7532
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...
0
7462
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...
0
7975
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...
1
7492
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5101
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1957
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
1
1069
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.