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!

how to pass dynamic file name in external table.

sanyOct 22 2018 — edited Oct 22 2018

Dear experts,

i have  one  requirement   i want  to create  external  table  for csv  file now  the  problem is  i don't  know  the  file  name  because it  can change  every  time

is there  any  functionality where  we can   have  dynamic file name  in  table  script like if  i have  one  folder  inside  folder  all file data  should come  in table

like  below  example  

CREATE TABLE countries_ext (

  country_code VARCHAR2(5),

  country_name VARCHAR2(50),

  country_language VARCHAR2(50)

)

ORGANIZATION EXTERNAL (

  TYPE ORACLE_LOADER

  DEFAULT DIRECTORY ext_tab_data

  ACCESS PARAMETERS (

  RECORDS DELIMITED BY NEWLINE

   PREPROCESSOR exec_dir:'zcat'

  FIELDS TERMINATED BY ','

  MISSING FIELD VALUES ARE NULL

  (

  country_code CHAR(5),

  country_name CHAR(50),

  country_language CHAR(50)

  )

  )

  LOCATION ('Countries1.txt.gz','Countries2.txt.gz')

)

PARALLEL 5

REJECT LIMIT UNLIMITED;

i have  to do the same  but  i  want  to put  only  folder  name  but  table must  show  all file data,

Comments
Post Details
Added on Oct 22 2018
9 comments
3,434 views