This content has been marked as final. Show 8 replies
If you save your code
as a script, say C:\testscript.sql, then run it from a worksheet like
SET ECHO OFF; SET FEEDBACK OFF; SET SERVEROUTPUT ON; SET VERIFY OFF; SET PAGES 0; SET HEAD OFF; SPOOL c:\testscript.log SELECT 1, 2, 3 FROM DUAL; SPOOL OFF;
@\testscript.sqlthe output in C:\testscript.log will be
1 2 3Regards,
SQL Developer Team
are there any other commands/settings that have such different behavior when run from "anonymous" worksheet (not saved, no file) compared to be run from a saved script file? A document/webpage or something? Would be interesting to know as I always do my test in "anonymous" worksheet and there were quite some occasions when things didn't work as expected based on sqlplus documentation and I had to find workarounds, which I did, until this particular issue.
I cannot provide any insight into the issue beyond what's posted in the following thread:
Re: Clear command didn't work in 3.1
And Jim's comment seems correct. SQL Developer and SQL*Plus behave similarly; it's Toad that's different.
Hi Gary, you seem to have some extensive knowledge. I'd like to follow-up on this thread and try to understand why SQL Developer won't hide the code even though I'm already running the code as a Worksheet (I assume you mean Run Script F5 button in SQL Developer).
I generally develop in SQL Developer that does a lot of dbms_output to echo data using a Spool command. When I'm in SQL Developer I can't get the code NOT to spool, it typically is echoed directly in the spool file at the top followed by the dbms_output data. If I save the sql file and run in in sqlplus it only outputs the data (good). If I use @C:\xyz_script.sql and hit F5 in SQL Developer it only outputs the data (per your previous answer) -- good.
So why can't I hit F5 in SQL Developer in the script file and have it only output the data? It just doesn't work no matter how many "SETs" you turn-off.
Looks like Echo, Term, Feed are supported in SQL Developer, maybe supported means something other than work.
Jim is absolutely correct. If I cut & paste all the lines of the script into a SQL*Plus session, the spool file contains:
whereas running the same lines from a SQL file produces:
scott@ORA112> SELECT 1, 2, 3 FROM DUAL; 1 2 3 scott@ORA112> SPOOL OFF;
This is not my area so I could be wrong but, examining the Set Spool code, it looks like SQL Developer intentionally writes any top level commands to the spool file, even if ECHO is off -- probably in an attempt to match SQL*Plus behavior.
1 2 3
That would make any enhancement (SQL Developer Exchange feature request) or bug logged for this matter unlikely to be approved -- the product is just meeting one of its (loosely) professed goals: conform to SQL*Plus behavoir.