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 find the file names present in the directory.

Satyam ReddyNov 20 2021

Team,
The directory name LENDEREXTRACTS has files with with extension .csv
Below are the directory name and directory path.

The Directory_name WHERE OUR .csv file resides is : LENDEREXTRACTS
The Directory path is : /u02/LENDEREXTRACTS/

The directory : LENDEREXTRACTS has file names which have extensions with _YYYYMMDDHHMISS
I would like to know the file names present in LENDEREXTRACTS directory .
Me trying with below code , but ending in errors :

select *
from external(
 (filename varchar2(1000 char))
     type oracle_loader
     default directory LENDEREXTRACTS
     access parameters (
       records delimited by newline
       nobadfile nologfile nodiscardfile
       preprocessor LENDEREXTRACTS:'ls' -- /usr/bin/ls
       fields (filename char(1000))
  )
  location ('.')
  reject limit unlimited
)
where filename like to_char(sysdate,'YYYYMMDD"______.csv"');

Below is the error message I get .

ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "minussign": expecting one of: "badfile, byteordermark, characterset, column, compression, credential, data, delimited, discardfile, dnfs_enable, dnfs_disable, disable_directory_link_check, escape, field, fields, fixed, io_options, ignore_blank_lines, ignore_header, load, logfile, language, nodiscardfile, nobadfile, nologfile, date_cache, dnfs_readbuffers, preprocessor, readsize, string, skip, territory, variable, validate_table_data, xmltag"
KUP-01007: at line 3 column 36
29913. 00000 - "error in executing %s callout"
*Cause:  The execution of the specified callout caused an error.
*Action:  Examine the error messages take appropriate action.

Any suggestions most welcome and really appreciated !!

Regards,
Satyam Reddy.

This post has been answered by Solomon Yakobson on Nov 21 2021
Jump to Answer
Comments
Post Details
Added on Nov 20 2021
14 comments
5,113 views