Write to Oracle concurrent request output / log from a SQLPlus program

First of all, your SQL*Plus script does not even run without your attempts at logging.

  1. dbms_output enable(...) is missing a dot ('.').
  2. Your anonymous PL/SQL block has no end; statement
  3. @"path/file.SQL` is a SQL*Plus command -- it cannot be embedded in an anonymous PL/SQL block.

Aside from those basic problems, FND_FILE.PUT_LINE is only for PL/SQL concurrent programs. That is, concurrent programs whose executable points to a PL/SQL package procedure and not a .sql file under $APPL_TOP.

For SQL*Plus concurrent programs, i.e., running a .sql file under $APPL_TOP, FND_FILE.PUT_LINE does not work. Instead, your SQL*Plus output is automatically written to the request output. There is no standard way to write to the request log.

If you really need to write to the request log, you could maybe call FND_FILE.PUT_NAMES to cause FND_FILE.PUT_LINE to write to temporary files that you name. Then, knowing the concurrent request ID and the logic Oracle EBS uses to local output and log files, do a FND_FILE.CLOSE and host command to move the custom-named files you specified to the actual locations. That might work.

It'd be much better to redo your concurrent program as a PL/SQL package. Then FND_FILE works just fine. If you know how to call Java from the database, there is very little you can do in a .sql script that you cannot do in a PL/SQL package.

I have not written a .sql concurrent program in years, and I write concurrent programs all the time.