Now Im not an expert or anything with SQL so bear with me...
I have 3 seperate queries that each use the spool command to write to a file on the server.
e.g. i use the following construct in each of the three sql files:
set blah
set blah
spool /blah/blah.rpt
script
spool off
I wish to put these three queries into one script. Can I use the spool command three times in the one file? i.e. have spool then spool off, three times in one *.sql file?
I have read a couple of posts on pl/sql spooling and people mention utl_file, but I have no idea what this is and even if i have it...
Any help would be great. Thanks.Yes, you can. For example,
spool a1.txt
select count(*) from tab;
spool off;
spool a2.txt
select sysdate from dual;
spool off;
spool a3.txt
select 'x' dummy from dual;
spool off;
will generate 3 .txt files. However, I can't figure out why didn't you try it yourself ...|||I did try it and it didnt work the way I expected...
I have the three spools and also I have a title for each of the three files:
e.g.
ttitle 'Thanet ** Items made MISSING between 7 and 14 days ago' skip 2
I have one of these fore each script [different txt of course]. I have found that if the query returns no results it will not print the title to the file and so i have an emty file. If there are some results from on of the queries then the title does display.
I was wanting to make sure that I was using the spool correctly so thats why i asked.|||Perhaps this helps ... if you include a "dummy" query into every "spool block", you won't get an empty file even though your "real" query returns no records.
SPOOL a1.txt
TTITLE 'First top title' skip 2
BTITLE 'First bottom title'
COLUMN dummy noprint;
SELECT 'x' dummy FROM DUAL;
SELECT COUNT (*) FROM tab;
SPOOL off;
SPOOL a2.txt
TTITLE 'Second top title' skip 2
BTITLE 'Second bottom title'
COLUMN dummy noprint;
SELECT 'x' dummy FROM DUAL;
-- this query returns no rows
SELECT 'x' FROM dual WHERE sysdate = sysdate + 1;
SPOOL off;|||thanks for the help, ill give that a try.
Showing posts with label bear. Show all posts
Showing posts with label bear. Show all posts
Friday, March 9, 2012
Monday, February 20, 2012
Oracle Application and laptops
I need advice of a powerfull laptop can bear the future extensions of
Oracle editions and implementing installations of all Oracle products
on it ?Lots of memory, AMD-64 X2 processor, as much harddisk as you can get.
I think, 2GB is the maximum on most, if not all laptops - a laptop is
not a server, most manufacturers think.|||<ehabaziz2001@.gmail.com> wrote in message
news:1141975526.522713.195560@.z34g2000cwc.googlegr oups.com...
> I need advice of a powerfull laptop can bear the future extensions of
> Oracle editions and implementing installations of all Oracle products
> on it ?
Oracle editions and implementing installations of all Oracle products
on it ?Lots of memory, AMD-64 X2 processor, as much harddisk as you can get.
I think, 2GB is the maximum on most, if not all laptops - a laptop is
not a server, most manufacturers think.|||<ehabaziz2001@.gmail.com> wrote in message
news:1141975526.522713.195560@.z34g2000cwc.googlegr oups.com...
> I need advice of a powerfull laptop can bear the future extensions of
> Oracle editions and implementing installations of all Oracle products
> on it ?
Oracle for Sun Sparc Solaris or AIX 5L will not run there, so I wonder if
you really want to do what you are asking about. I would not.|||ehabaziz2001@.gmail.com wrote:
> I need advice of a powerfull laptop can bear the future extensions of
> Oracle editions and implementing installations of all Oracle products
> on it ?
What it is appearing you wish to do is impossible. There is no laptop
capable of running these products and, in fact, I would expect that to
do so would take somewhere between 10 and 12 laptops.
--
Daniel A. Morgan
http://www.psoug.org
damorgan@.x.washington.edu
(replace x with u to respond)
Labels:
advice,
application,
bear,
database,
editions,
extensions,
future,
implementing,
installations,
laptop,
laptops,
microsoft,
mysql,
oforacle,
oracle,
powerfull,
productson,
server,
sql
Subscribe to:
Posts (Atom)