SQL Language (MOSC)

MOSC Banner

for ...loop in sql via text files

edited Nov 11, 2013 4:18AM in SQL Language (MOSC) 12 commentsAnswered
hi guys,
i need a kick start, how to i go about doing a for ...loop over a text files?

basically , i need to loop through a lost of db name then get the alert log of it. Doing this in .bat.
the .bat will ( echo exit | sqlplus -S xxxxxxxxxx/xxxxxxxx@%%A @test.sql)

-- test.sql look as below ... .

for  (text files {

BEGIN
  vInHandle := utl_file.fopen('Q_ALERT_LOG_<DB_NAME>_LOC', 'alert_<DB_NAME>.log', 'R');
  LOOP
    BEGIN
      utl_file.get_line(vInHandle, vNewLine);
      dbms_output.put_line(vNewLine);
    EXCEPTION
      WHEN OTHERS THEN
        EXIT;
    END;
  END LOOP;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center