[Oracle] SQL script with SPOOL command

Arch -  
 Arch -
Hello,

I am currently creating an SQL script using the command 'SPOOL <file name="">', my SQL, and then 'SPOOL OFF'.
I should mention that my query works (tested separately).
But now I'm getting an error [Err] ORA-00922: missing or invalid option and I think it's a syntax issue (I get this error when it encounters a ';', should I not include it at all?).

Thank you for your help!</file>

1 answer

  1. DROE Posted messages 148 Registration date   Status Member Last intervention   48
     
    Hello,

    copy/paste your script here and you will get a quick response.

    otherwise it's:

    SPOOL F:\my_log.txt
    or
    SPOOL my_log.txt

    SELECT ....
    FROM
    WHERE.... ;

    SPOOL OFF

    http://www.dba-ora.fr/
    --
    Experience is what everyone calls their mistakes.
    2
    1. Arch
       
      In fact, executing the commands one by one in the SQL Plus console works, but running the script in Navicat gives me this error... Is that normal?
      0
    2. DROE Posted messages 148 Registration date   Status Member Last intervention   48
       
      Commands one by one and by script file work under SQL*PLUS because SPOOL filename and SPOOL OFF are SQL*PLUS commands.
      Under TOAD it works, now with Navicat I don't know if it handles the output (SPOOL).
      0
    3. Arch
       
      Indeed, I don't have that impression. Thank you for your answers!
      Now, do you know why there are always SQL statements in the output file (the query and commands), even after setting echo to off?
      0
    4. DROE Posted messages 148 Registration date   Status Member Last intervention   48
       
      SET ECHO OFF
      works only in scripts, not in interactive mode.

      You need to call the script instead of executing it in interactive mode

      SQLPLUS login/password@tns @YOUR_SCRIPT.SQL

      http://www.dba-ora.fr
      0
    5. Arch
       
      Well, listen, it's perfect, thank you very much.
      0