Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

External Table on tab delimited data not returning any rows

17020Nov 9 2007 — edited Nov 12 2007
Hi
Am working on a Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
running on Windows XP v2002 SP2

Have been trying to create an External table based on a tab delimited file.
The table does get created but try as I may, the subsequent query on the file-based external table just doesn't return any records. the logs are not showing any errors as well.

Here's all the information that I have for this problem.

1. Directory creation
CREATE OR REPLACE DIRECTORY extfiles AS 'D:\Profiles\piyush'

2. Put the file with the below sample content in the above directory on my filesystem
Commerce Id Company Cd Core Directory Id First Name Middle Initial Name Last Name Full Name Lvl4 Mgr Emp Id Rpt To Comm Id Rpt To First Name Rpt To Last Name Emp Status Cd Emp Status Desc Lvl1 Org Unit Cd Lvl2 Org Unit Cd Lvl3 Org Unit Cd Lvl4 Org Unit Cd Corp Func Cd Dept Id Separation Desc Locn Cd Mail Drop Cd Tel Num Fax Phone Num Res Stat Desc Pers Id Auth Name Pager Skytel Num Pager In House Num Add Line 1 Txt Add Line 2 Txt City Name State Province Cd Postal Cd Country Cd Country Desc City State Zip Country Personal Id Nationality Cd Nationality2 Cd Nationality3 Cd
12345678 CN02 xxxxxx DAVID LEAN LEAN DAVID 12345678 A Active CONDORAM OPS MD LOCALE GTM VW XY605 01 ABC07 ABC07 12345678 (00) (00) 12345678 N 123 ANYWHERE ST 123 2nd ADDRESS ANYCITY HK Hong Kong BEIJING 123456 IN
09876543 CN02 xxxxxx JOHN LANG LANG JOHN 98765432 01234567 DOE DAVID DOE A Active CONDORAM OPS MD LOCALE GTM VW XY605 01 ABC07 +00-0123456789 00-12-34567890 123 ANYWHERE ST 123 2nd ADDRESS ANYCITY 010 123456 CN China BEIJING 123456 CN

2. created the external table with the below definition
CREATE TABLE sample_ext
(commerce_id VARCHAR2(8)
,company_cd VARCHAR2(4)
,core_directory_id VARCHAR2(20)
,first_nam VARCHAR2(12)
,middle_initial_nam VARCHAR2(10)
,last_nam VARCHAR2(8)
,full_nam VARCHAR2(40)
,lvl_4_mgr_emp_id VARCHAR2(8)
,rpt_to_comm_id VARCHAR2(40)
,rpt_to_first_nam VARCHAR2(40)
,rpt_to_last_nam VARCHAR2(40)
,emp_status_cd VARCHAR2(1)
,emp_status_desc VARCHAR2(25)
,lvl1_org_unit_cd VARCHAR2(12)
,lvl2_org_unit_cd VARCHAR2(12)
,lvl3_org_unit_cd VARCHAR2(12)
,lvl4_org_unit_cd VARCHAR2(12)
,corp_func_cd VARCHAR2(4)
,dept_id VARCHAR2(12)
,separation_desc VARCHAR2(30)
,locn_cd VARCHAR2(30)
,mail_drop_cd VARCHAR2(30)
,tel_num VARCHAR2(20)
,fax_phone_num VARCHAR2(30)
,res_stat_desc VARCHAR2(30)
,pers_id_auth_nam VARCHAR2(60)
,pager_skytel_num VARCHAR2(30)
,pager_in_house_num VARCHAR2(30)
,add_line_1_txt VARCHAR2(60)
,add_line_2_txt VARCHAR2(40)
,city_nam VARCHAR2(40)
,state_province_cd VARCHAR2(20)
,postal_cd VARCHAR2(10)
,country_cd VARCHAR2(20)
,country_desc VARCHAR2(50)
,city VARCHAR2(50)
,state VARCHAR2(50)
,zip VARCHAR2(20)
,country VARCHAR2(50)
,personal_id VARCHAR2(20)
,nationality_cd VARCHAR2(3)
,nationality2_cd VARCHAR2(3)
,nationality3_cd VARCHAR2(3)
)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY EXTFILES
ACCESS PARAMETERS
(records delimited BY newline
skip 1
fields terminated BY 0x'09'
missing field VALUES are NULL
(commerce_id VARCHAR(8)
,company_cd VARCHAR(4)
,core_directory_id VARCHAR(20)
,first_nam VARCHAR(12)
,middle_initial_nam VARCHAR(10)
,last_nam VARCHAR(8)
,full_nam VARCHAR(40)
,lvl_4_mgr_emp_id VARCHAR(8)
,rpt_to_comm_id VARCHAR(40)
,rpt_to_first_nam VARCHAR(40)
,rpt_to_last_nam VARCHAR(40)
,emp_status_cd VARCHAR(1)
,emp_status_desc VARCHAR(25)
,lvl1_org_unit_cd VARCHAR(12)
,lvl2_org_unit_cd VARCHAR(12)
,lvl3_org_unit_cd VARCHAR(12)
,lvl4_org_unit_cd VARCHAR(12)
,corp_func_cd VARCHAR(4)
,dept_id VARCHAR(12)
,separation_desc VARCHAR(30)
,locn_cd VARCHAR(30)
,mail_drop_cd VARCHAR(30)
,tel_num VARCHAR(20)
,fax_phone_num VARCHAR(30)
,res_stat_desc VARCHAR(30)
,pers_id_auth_nam VARCHAR(60)
,pager_skytel_num VARCHAR(30)
,pager_in_house_num VARCHAR(30)
,add_line_1_txt VARCHAR(60)
,add_line_2_txt VARCHAR(40)
,city_nam VARCHAR(40)
,state_province_cd VARCHAR(20)
,postal_cd VARCHAR(10)
,country_cd VARCHAR(20)
,country_desc VARCHAR(50)
,city VARCHAR(50)
,state VARCHAR(50)
,zip VARCHAR(20)
,country VARCHAR(50)
,personal_id VARCHAR(20)
,nationality_cd VARCHAR(3)
,nationality2_cd VARCHAR(3)
,nationality3_cd VARCHAR(3)
)
)
location ('sample_id.txt')
)
REJECT LIMIT UNLIMITED

4. the log has the output as shown below with all fields listed but query on the External table keeps saying no rows selected.
Field Definitions for table SAMPLE_EXT
Record format DELIMITED BY NEWLINE
Data in file has same endianness as the platform
Rows with all null fields are accepted

Fields in Data Source:

COMMERCE_ID VARCHAR (2, 8)
Terminated by " "
Trim whitespace same as SQL Loader
.
.
.
NATIONALITY3_CD VARCHAR (2, 3)
Terminated by " "
Trim whitespace same as SQL Loader

Tried to switch the field termination to tab in single quotes, ' ' as well as '\t'
Please don't ask me to switch the delimiter to comma as the data itself has comma.
Any help will be much appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 10 2007
Added on Nov 9 2007
2 comments
5,378 views