shell script to find filename & line count of each file, now insert this record into Oracle table

前端 未结 4 1884
暗喜
暗喜 2021-01-23 12:59

I have to find the filename available in a folder with each file line count. And then, i will have kind of two column data.

Now i have to insert this record into a orac

4条回答
  •  醉话见心
    2021-01-23 13:22

    In version 9i Oracle gave us external tables. These objects allow us to query data in OS files through SELECT statements. This is pretty cool. Even cooler, in 11.0.1.7 we can associate a shell script with an external table to generate its OS file. Check out Adrian Billington's article on listing files with the external table preprocessor in 11g. Your shell script is an ideal candidate for the preprocessor functionality.

    If you need to know the contents of the directory now for whatever purpose you can simply SELECT from the external table. If you want to keep a permanent record of the file names you can issue an INSERT INTO ... SELECT * FROM external_table;. This statement could be run autonomically using a database job.

提交回复
热议问题