Sponsored Content
Top Forums Shell Programming and Scripting Spool file, only if data exists. Post 302545938 by cero on Wednesday 10th of August 2011 04:03:30 AM
Old 08-10-2011
@pludi: controlling SQL*Plus commands like spool with PL/SQL is hard, but SQL*Plus can be tricked to act conditional.
Code:
column spool_destination noprint new_value spooldestination
SELECT DECODE(COUNT(*),0,'/dev/null','spoolfilename')  AS spool_destination
  FROM temporary_table_containing_resultset;
spool &spooldestination
SELECT * 
  FROM temporary_table_containing_resultset;
spool off

These 2 Users Gave Thanks to cero For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to spool a unix file

hi, can anyone help me by saying how can i spool a unix file.. do we need to specify the pathname as such to spool the file .. right now, i tried giving like spool filename in the sql prompt.. but its not giving me the required output even if i can see that the command is being executed.. ... (2 Replies)
Discussion started by: kripssmart
2 Replies

2. UNIX for Dummies Questions & Answers

SQLPlus spool file

HI Have some problem with spooling out some relatively large number of records (~2-3 mil) Small table - OK though. Getting error: SP2 0308: cannot close spool file. Any thoughts? sqlplus -s user/pwd << EOF set term off set head off set trims on set pages 0 set... (1 Reply)
Discussion started by: Leo_NN
1 Replies

3. AIX

Spool data file

Dear Gurus, Tried searching for some clues in this forum but dont seem to be able to find my answer. :confused: Anyway i have a quick question: Today I have produced a messages generated from a application and placed them on the print queue. Before this I had stopped the printer queue, so... (2 Replies)
Discussion started by: lweegp
2 Replies

4. Shell Programming and Scripting

Problem in spool file

Hi, Iam a newbie. When I give the below query at SQL prompt. SQL> select col1||'`ß`'||col2 from tablename where rownum<2; 1-J7WGX`ß`1-7OKC-23 Iam getting ß within appostropies...... If I remove appostropies and give the query it is throwing an error. If I give the same query in spool as... (1 Reply)
Discussion started by: kknayak
1 Replies

5. Shell Programming and Scripting

spool to file in ksh

hi all, am trying to write a ksh script which will take a username, password, db instance as input arguments and login to the database using sqlplus and select some data via sql and spool to a file. problem is that i am using "sqlplus -s" in order to hide the username/password and it doesnt... (8 Replies)
Discussion started by: cesarNZ
8 Replies

6. Shell Programming and Scripting

File exists, but cannot be opened.How to check- whether it could be opened to read when it exists

Hi #Testing for file existence if ; then echo 'SCHOOL data is available for processing' else echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING' : i wrote a script, where it begins by checking if file exists or not. If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies

7. Shell Programming and Scripting

Spool Data in a file

Hello, I am trying to spool data from database into a file on solaris through ksh. Data is getting fetched but the problem is record is getting split in to multiple lines. excerpt from sql is whenever sqlerror exit 1; set define on set echo off set feed off set head off set... (1 Reply)
Discussion started by: abhi1988sri
1 Replies

8. UNIX for Dummies Questions & Answers

Column Header in the Spool file

Hi All, I have a problem with the column heading while spooling the data from the database. Since i want the column header, therefore i am not using SET HEADING OFF, and i am getting the header, but for the longer column name, some of the character from the column name is missing. for... (7 Replies)
Discussion started by: Pramod_009
7 Replies

9. Shell Programming and Scripting

Spool file requirement

Hi, I have a requirement of Connecting to sqlplus from unix Execute the package. The output of package is stored in a table Need to query the table and move to txt file. The problem iam facing is, when I try to spool the file. I get the sql query also along with the output.... (6 Replies)
Discussion started by: Shanmugapriya D
6 Replies

10. Shell Programming and Scripting

Order of data in Spool File

Hello, I have a shell script through which I am executing .sql file and spooling the result of Query from .sql . I want to spool the result in ascending order. Is there any parameter to be set to print result in ascending or descending order. Thanks in advance. (4 Replies)
Discussion started by: Aparna.N
4 Replies
snget,v0.3.8(8) 					      System Manager's Manual						   snget,v0.3.8(8)

NAME
snget,sngetd - fetch news from upstream sites and store them locally. SYNOPSIS
snget [options] [news.group...] sngetd [options] options: [-d] [-h Bps] [-p nparallel] [-c depth] [-m max] DESCRIPTION
snget fetches articles for the news.groups on the command line (or all non-local newsgroups if none are specified) from their respective upstream feeds, and stores them in the news spool /var/spool/sn. If a newsgroup could not be fetched for, it may be attempted again. sngetd does the same, except it reads newsgroup names from /var/spool/sn/.fifo and does not exit. sngetd does not fork into the back- ground. snget does not guarantee to fetch the groups in the order specified on the command line. snget and sngetd will write errors and status messages to descriptor 2. snget and sngetd are both scheduling wrappers that call /usr/sbin/SNHELLO, snfetch, and snstore. You must own /var/spool/sn or be root in order to run snget and sngetd. OPTIONS
-d Enable verbosity, may be specified multiple times. This option is also propagated to snfetch and snstore. -p nparallel Attempt to fetch for nparallel newsgroups at once. Default is 4, maximum is 8. -h Bps Throttle the sum of bandwidth used by all snfetches to Bps bytes per second. This option is used to prevent snget or sngetd from hogging the network. By default there is no throttling. -c depth depth is passed to snfetch as the depth of the command pipeline. -m max The very first time contacting the news server, retrieve no more than max articles per newsgroup, default is 200. This option is useful only if there are unprimed newsgroups and has no effect otherwise. The .max file in each newsgroup directory still applies (see snfetch(8)). -t timeout This option is not documented because it is ignored and will disappear in a future release. See .timeout in FILES next. FILES
Server Directories These are the directories /var/spool/sn/.outgoing/server.name:port, which are symlinked from /var/spool/sn/news.group/.outgoing. If the latter isn't a (symlink to a) directory, snget won't fetch for news.group. /var/spool/sn/.outgoing/server.name:port/.timeout If this file exists and contains a number, this is taken to be the timeout in seconds in all dealings with server.name:port. Default is 120 seconds. /var/spool/sn/.outgoing/server.name:port/.SNHELLO If this program file exists, it is invoked instead of the default (usually /usr/sbin/SNHELLO) when an NNTP connection is first made to server.name:port in order to read the greeting and upload posted articles. If server.name:port requires a username and password, you would copy the default here and edit that information in. /var/spool/sn/news.group/{.serial,.max} snget and sngetd read these files on behalf of snfetch. SIGNALS
Other signals have default behaviour. SIGUSR1 If -h Bps was specified, Bps is halved, else is ignored. SIGUSR2 If -h Bps was specified, Bps is doubled, else is ignored. ENVIRONMENT VARIABLES
See also /usr/sbin/SNHELLO for the list of environment variables exported by snget/sngetd. SNROOT If this is set and is not empty, the value is used in place of /var/spool/sn, the default news spool directory. PATH To find SNHELLO (if this server does not have a .SNHELLO), snfetch, and snstore. If PATH does not contain /usr/sbin as one of it's components, /usr/sbin is appended to it. SEE ALSO
snfetch(8), snstore(8), /usr/sbin/SNHELLO N.B. Harold Tay snget,v0.3.8(8)
All times are GMT -4. The time now is 05:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy