Oracle external tables -
i'm struggling oracle external table, although researched oracle forums. still, no success.
let's suppose have simple table
describe products name null type ------------------------------ -------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- id not null number name varchar2(30) value number(5,2) dep varchar2(30) count number(3)
then, created oracle folder:
create or replace directory ext_prod_dir 'c:\';
i save content of table in .lst file
spool c:\products.lst select p.id || ';' || p.name || ';' || p.value || ';' || p.dep || ';' || p.count products p; spool off; p.id||';'||p.name||';'||p.value||';'||p.dep||';'||p.count ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1;settlers of catan;29,95;toys;3 2;dvd player;82,97;electronics;2 3;red shirt;12,49;clothes;3 4;black leather couch;399,99;furniture;5 5;oak cofee table;223,99;furniture;5 6;technodrome;27,99;toys;4 7;oh cereal;3,95;foods;1 8;game console;299,95;toys;2 9;video game;29,95;toys;3 10;lawn chair;34,99;furniture;11 11;dog toy bone;34,99;toys;9 12;heated blanket;27,95;toys;8 13;flux capacitor;27,95;toys;7 14;chocolate pie;3,14;foods;7
then tried create external table:
create table products_ext (id number, name varchar2(30), value number(5,2), dep varchar2(30), count number(3)) organization external (type oracle_loader default directory ext_prod_dir access parameters (records delimited newline fields terminated ';' missing field values null badfile ext_prod_dir:'products.bad_xt' logfile ext_prod_dir:'products.log_xt' (id char(6), name char(30), value char(8), dep char(30), count char(3))) location ('products.lst') ) reject limit unlimited
so far good. when select data external table, got:
ora-29913: error in executing odciexttableopen callout ora-29400: data cartridge error kup-00554: error encontered while parsing access parameters kup-01005: syntax error: found "badfile": expecting 1 of: "column, (, reject" kup-01007: @ line 4 column 7
i tried huge amount of things, got variations on error. best thing accomplished got rid of error, table empty. if experience can point me in right direction, indebted.
thanks
badfile , logfile not part of fields clause. so, move them above fields terminated.
create table products_ext (id number, name varchar2(30), value number(5,2), dep varchar2(30), count number(3)) organization external (type oracle_loader default directory ext_prod_dir access parameters (records delimited newline badfile ext_prod_dir:'products.bad_xt' logfile ext_prod_dir:'products.log_xt' fields terminated ';' missing field values null (id char(6), name char(30), value char(8), dep char(30), count char(3))) location ('products.lst') ) reject limit unlimited
also, said when got rid of error, table empty. did check logfile? if error value column, check nls_numeric_characters parameter in view v$nls_parameters.
select * v$nls_parameters;
check if decimal marker indeed comma. if not either update parameter or change in data file.
Comments
Post a Comment