Home » SQL & PL/SQL » Client Tools » SET ECHO OFF does not work (SQL Plus - Windows XP)
SET ECHO OFF does not work [message #359641] Mon, 17 November 2008 15:40 Go to next message
clocke
Messages: 2
Registered: November 2008
Junior Member
I have an SQL file called html.sql that contains the following code.

set markup HTML ON HEAD " -
<title>SQL*Plus Report</title>" -
BODY "" -
TABLE "border='1' align='center' summary='Script output'" -
SPOOL ON ENTMAP ON PREFORMAT OFF
SET ECHO OFF
SET TERM OFF
SET HEADING ON
spool C:\FolderName\FileName.html

/

spool off
set markup html off spool off
host start C:\FolderName\FileName.html
SET TERM ON

I run a query in SQL Plus, and then I enter @html, which creates an HTML page that contains the query results. However, the page shows the query text above the HTML output, which I thought would not happen if I included SET ECHO OFF as I have done above. This is my first time using SQL Plus, so I am probably missing something obvious. Could somebody please tell me what I need to alter in the above code to prevent the query text from being included on the HTML page?
Re: SET ECHO OFF does not work [message #359668 is a reply to message #359641] Mon, 17 November 2008 23:31 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I don't trust you, prove it:
C:\TEMP>type html.sql
set markup HTML ON HEAD " -
<title>SQL*Plus Report</title>" -
BODY "" -
TABLE "border='1' align='center' summary='Script output'" -
SPOOL ON ENTMAP ON PREFORMAT OFF
SET ECHO OFF
SET TERM OFF
SET HEADING ON
spool c:\temp\html.html
select * from dual;
spool off
set markup html off spool off
host type c:\temp\html.html
SET TERM ON

C:\TEMP>sqlplus michel/michel

SQL*Plus: Release 10.2.0.4.0 - Production on Mar. Nov. 18 06:29:52 2008

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining
and Real Application Testing options

SQL> @html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1252">
<meta name="generator" content="SQL*Plus 10.2.0">
  <title>SQL*Plus Report</title>
</head>
<body>
<p>
<table border='1' align='center' summary='Script output'>
<tr>
<th scope="col">
D
</th>
</tr>
<tr>
<td>
X
</td>
</tr>
</table>
<p>

1 row selected.<br>
<br>


</body>
</html>
SQL>

Regards
Michel
Re: SET ECHO OFF does not work [message #359706 is a reply to message #359668] Tue, 18 November 2008 01:02 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Ah, the main difference between your testcase and the testcase the original poster describes is that you include your query in the script.
The original poster enters the sql manually and has just slash in his script, in order to execute it.

Although, when I test it, it has the same effect as yours: the query is NOT included in the spoolfile

[Updated on: Tue, 18 November 2008 01:04]

Report message to a moderator

Re: SET ECHO OFF does not work [message #359719 is a reply to message #359706] Tue, 18 November 2008 01:20 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I assumed that "I enter @html, which creates an HTML page that contains the query results" means the query was inside "html.sql" script but maybe I was wrong.

Regards
Michel
Re: SET ECHO OFF does not work [message #359876 is a reply to message #359641] Tue, 18 November 2008 07:33 Go to previous messageGo to next message
clocke
Messages: 2
Registered: November 2008
Junior Member
Sorry, I knew that it was going to be due to me being an idiot. I had copied the HTML code from a website, in which there was a 1 on the line before the slash. As I copied the code onto this site I removed the 1 as I thought that it looked to be unnecessary, and when I eventually ran the code again the query text disappeared.

Thanks for your help. I apologise for having wasted everybody's time.
Re: SET ECHO OFF does not work [message #359987 is a reply to message #359876] Wed, 19 November 2008 02:34 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
No worries.
Thanks for the feedback.
Previous Topic: SQL Plus Encoding Problem
Next Topic: Importing sysdate and Sequence into table from .csv using SQL Developer
Goto Forum:
  


Current Time: Fri Dec 09 15:22:48 CST 2016

Total time taken to generate the page: 0.64630 seconds