Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Spooling File to My Desktop From Back-end using shell script Post 303036503 by bmaksoud on Saturday 29th of June 2019 08:28:32 AM
Old 06-29-2019
Spooling File to My Desktop From Back-end using shell script

Hello all,
I am trying to spool a SQL query output file from back-end to desktop in a certain path but it didn't work,the query writes the output in a file in the same directory at the back-end.
note : i use the same query in sql developper and file was created in the desired path fine

code :
-------
Code:
sqlplus -s schemaname/pass@dbname <<SQL
spool C:\pathtofile\testtest.csv;
select count(*),sum(amount) from (databaseschem).(tablename)

some conditions here;

spool off;
SQL

---------------------
so can anyone figure out the reason for this ?

Last edited by rbatte1; 07-08-2019 at 07:12 AM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

end of file problem with shell script

My shell script was working ok with K shell. But all of sudden, it started acting crazy. it keeps saying this: syntax error at line 70 : `"' unmatched I don't even have 70 lines in my file or this : syntax error at line 69: `end of file' unexpected Can this file got... (5 Replies)
Discussion started by: whatisthis
5 Replies

2. Shell Programming and Scripting

Laptop/Desktop... Back up/Mirror script.

Hello all, I have a script I am trying to put together, what I am trying to do is mirror my home dir (excluding my music dir) between my desktop and laptop. My intention is to create a cron job to run two scripts, one to push the data to the laptop at the end of the day, and one to pull the data... (5 Replies)
Discussion started by: komputersman
5 Replies

3. Shell Programming and Scripting

Help on shell script : syntax error at line 62: `end of file' unexpected

Hi All, I have written a korn script (code pasted below). It is giving the error while debugging "new.sh: syntax error at line 62: `end of file' unexpected". I have re-written the whole code in VI and explored all help related to this error on this Unix forum and tried it. Somehow, I could... (7 Replies)
Discussion started by: schandrakar1
7 Replies

4. Shell Programming and Scripting

spooling through shell script

Hi, I want to spool the output from a .sql file to a .txt file through shell script. the contents of .sql are: spool /arboru02/scripts/customer_profile_def.txt select profile_id ||','|| account_no from customer_profile_def; spool off exit and shell scrip is like: #!/bin/sh... (9 Replies)
Discussion started by: ss_ss
9 Replies

5. UNIX for Dummies Questions & Answers

Shell scripting+connect to oracle database+spooling

Hi! Everyone I am new to the shell scripting basically.I have been asked to create a shell script that connect to a oracle database to read data from a particular schema then spool it into a csv file then email to customer. Can anybody let me know how to go about that. I have create... (14 Replies)
Discussion started by: Mr Mo
14 Replies

6. UNIX for Dummies Questions & Answers

Option in sql script to include column headers when spooling file to .csv format

Can anyone help me how to include COLUMN HEADER when spooling file to .CSV format through SQL statement. Thanks, Akbar (4 Replies)
Discussion started by: s1a2m3
4 Replies

7. Shell Programming and Scripting

help needed with shell script to append to the end of a specific line in a file on multiple servers

Hi Folks, I was given a task to append three IP's at the end of a specific (and unique) line within a file on multiple servers. I was not able to do that with the help of a script. All I could was: for i in server1 server2 server3 server4 do ssh $i done I know 'sed' could be used to... (5 Replies)
Discussion started by: momin
5 Replies

8. Shell Programming and Scripting

Script not spooling in result file

Hi everyone and nice to meet you :) I'm having some issues with a script I'm writing. It's probably most chaotic, I'm no ksh guru, but the idea is to extract an ID with that query, spool it into a file, and read that file making the ID a variable. This has to be done for every row extracted by... (10 Replies)
Discussion started by: Arkadia
10 Replies

9. UNIX for Beginners Questions & Answers

Script not spooling in the designated file.

Hi, I need to write a script that will run a simple select count(*) query and sends the result of that query to me via email. Here's what I already have. #!/bin/ksh ###################################################################### # File Name : counts.sh # Created : 2019/27/19... (1 Reply)
Discussion started by: clef
1 Replies
SELECTALL_XML(1p)					User Contributed Perl Documentation					 SELECTALL_XML(1p)

NAME
stag-selectall_xml - Query all elements from database with an XML output SYNOPSIS
stag-selectall_xml [-d <dbi>] [-f file of sql] [-nesting|n <nesting>] SQL DESCRIPTION
This script will query a database using either SQL provided by the script user, or using an SQL templates; the query results will be turned into XML using the DBIx::DBStag module. The nesting of the XML can be controlled by the DBStag SQL extension "USE NESTING..." EXAMPLES stag-selectall_xml -d "dbi:Pg:dbname=mydb;host=localhost" "SELECT * FROM a NATURAL JOIN b" TEMPLATES A parameterized SQL template (canned query) can be used instead of specifying the full SQL For example: stag-selectall_xml -d genedb /genedb-gene gene_symbol=Adh Or: stag-selectall_xml -d genedb /genedb-gene Adh Or: stag-selectall_xml -d genedb /genedb-gene gene_symbol@=Adh,dpp,bam,indy A template is indicated by the syntactic shorthand of using a slash to precede the template name; in this case the template is called genedb-gene. the -t option can also be used. All the remaining arguments are passed in as SQL template parameters. They can be passed in as either name=value pairs, or as a simple list of arguments which get passed into the template in order To use templates, you should have the environment variable DBSTAG_TEMPLATE_DIRS set. See DBIx::DBStag for details. LISTING AVAILABLE TEMPLATES FOR A DB stag-selectall_xml -d mydb -h LISTING VARIABLES FOR A TEMPLATE stag-selectall_xml /genedb-gene -h ENVIRONMENT VARIABLES
DBSTAG_DBIMAP_FILE A file containing configuration details for local databases DBSTAG_TEMPLATE_DIRS list of directories (separated by :s) to be searched when templates are requested COMMAND LINE ARGUMENTS
-h|help shows this page if no other arguments are given if a template is specified, gives template details if a db is specified, lists templates for that db use in conjunction with -v for full descriptions -d|dbname DBNAME this is either a full DBI locator string (eg dbi:Pg:dbname=mydb;host=localhost) or it can also be a shortened "nickname", which is then looked up in the file pointed at by the environment variable DBSTAG_DBIMAP_FILE -u|user USER database user identity -p|password PASS database password -f|file SQLFILE this is a path to a file containing SQL that will be executed, as an alternative to writing the SQL on the command line -n|nesting NESTING-EXPRESSIONS a bracketed expression indicating how to the resulting objects/XML should be nested. See DBIx::DBStag for details. -t|template TEMPLATE-NAME the name of a template; see above -wh|where WHERE-CLAUSE used to override the WHERE clause of the query; useful for combining with templates You can append to an existing where clause by using the prefix + -s|select SELECT-COLS used to override the SELECT clause of the query; useful for combining with templates -rows sometimes it is preferable to return the results as a table rather than xml or a similar nested structure. specifying -rows will fetch a table, one line per row, and columns separated by tabs -pre SQL a piece of SQL is that is executed immediately before the main query; e.g.: -pre "SET search_path=myschema,public" -o|out FILE a file to output the results to -w|writer WRITER writer class; can be any perl class, or one of these xml [default] sxpr lisp S-Expressions itext indented text -color shows results in color (sxpr and itext only) -show will show the parse of the SQL statement perl v5.12.4 2011-10-14 SELECTALL_XML(1p)
All times are GMT -4. The time now is 05:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy