?
Solved

Print line in Spool file...

Posted on 2011-09-15
2
Medium Priority
?
547 Views
Last Modified: 2012-05-12
I'm trying to write a batch file to execute some sql in sqlplus that will generate a flat file. I would like to be able to insert a couple of lines of text at the beginning of the file but am having a problem finding the correct way to do it, can someone help?

I'm trying to use dbms_output.put_line but fear I'm using it incorrectly...

 My sql script...

set feedback off
set verify off
set head off
set echo off
set linesize 30
set pages 0
set serveroutput on

spool W:\scripts\Wk1.csv

dbms_output.put_line('test');

SELECT * from table 1;

spool off
quit
0
Comment
Question by:nike_golf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 total points
ID: 36546924
Dbms_output is a pl/sql command.

In sqlplus what you want is PROMPT:

Spool W:\scripts\Wk1.csv

Prompt test

SELECT * from table 1;

spool off
0
 
LVL 13

Author Closing Comment

by:nike_golf
ID: 36547018
Exactly what I needed.

Thanks for the quick reply.

NG,
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question