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!

Loop through CSV file

User_F2C23Oct 9 2017 — edited Oct 11 2017

Greetings,

Hoping you can help.

I need to use pl/sql rather than java or python to read an external csv file and loop through the records.

The csv/text file will change, so don't want to read an Oracle table. I need to read and loop through the csv file.

Using the r value.

Any assistance appreciated!!

A sample code reads thus:

DECLARE

BEGIN

    for r in

       (select *

        from table (sys.get_dir_list ('C:\Data2016\SourceWorkspace\List-NTF.txt')))

     loop

        (

        -- run prodecure using r

        );

    END LOOP;

   END;

  /

GET ERROR:

ORA-06550: line 9, column 9:

PLS-00103: Encountered the symbol ")" when expecting one of the following:

   ( - + case mod new not null <an identifier>

   <a double-quoted delimited-identifier> <a bind variable>

   continue avg count current exists max min prior sql stddev

   sum variance execute forall merge time timestamp interval

   date <a string literal with character set specification>

   <a number> <a single-quoted SQL string> pipe

   <an alternatively-quoted string literal with character set specification>

   <an alternatively

06550. 00000 -  "line %s, column %s:\n%s"

This post has been answered by EdStevens on Oct 10 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 8 2017
Added on Oct 9 2017
25 comments
4,211 views