If you consider SPOOL command causes SQL*Plus to write the results to a file.
In UNIX send the result (output) of ls to a file would be
But I wonder if you are not thinking of something else like script
do a man of script command and see if thats not your answer
This question maybe in the wrong category but I'm posting here due to urgency.
In DOS is there a command to perform a similar function to spool command in SQL or Script command in UNIX?
I want to print all command line output to a file but I don't want to use the echo command for each line.
... (2 Replies)
I have a sqlplus report and inside that report I have the following piece of code to mail the report output to the email id.
My requirement is, instead of emailing the output I want to FTP that script to a different unix server (say ip as 10.10.1.1). How to modify this code to FTP the spool file... (0 Replies)
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)
Hi All,
I am spooling the data some sql queries into a single file but wanted to know how to format the data of the file generated by spool.
#!/bin/sh
unset -f USAGE
USAGE () {
clear
echo "############################USAGE#######################\n"
echo "Incorrect number of... (2 Replies)
Hi All,
Please help me regarding this.
we have our SAP system with unix environment.
Spool setting in unix ,we are not able to cancel any unix spool from SIDADM because the spool user is nor SIDADM. for example :-
Any idea how to make the spool from OS level as SIDADM, Please suggest.... (3 Replies)
Hi
I need to delete more than 3 million files from /var/spool/clientmqueue. When I give the following command to delete the files, I get the error
# pwd
/var/spool/clientmqueue
# rm -f *
/usr/bin/rm: arg list too long
Please tell me how can I delete the files (5 Replies)
Hi,
Can you please help me how to spool the unix commands executed in my client and its output to a file in local machine.
Basically, I want to save all OS commands executed in my session and its output into a file from my client something like we do oracle with "SPOOL".
Thanks in advance.... (2 Replies)
I want to spool files from unix using a sql script that would
take values from another sql query within the KSH script..
unix loop
select order_date from date_tbl
for each order_Date i need to call this spool script with the value
sqlplus scott/tiger@order_db @/ordspool/order_date.sql... (2 Replies)
Hi Friends,
I am trying to spool the data from Teradata. The rpoblem which i am facing is , the coulmn data is appended with ".(dot)" for some coulmns. Please find the below data :
data i want in file :
1|BANG|KINR|3456
2|KIBNJ|UIE|6347
3|JEEM|Y34E|3874
data which is spooling... (6 Replies)
Hello All,
I'm trying to spool an oracle table data into a csv file on unix server but the complete record is not being extracted. The record is almost 1000 characters but only 100 characters are being extracted and rest of the data getting truncated.
I'm setting below options :
SET... (4 Replies)
Discussion started by: venkat_reddy
4 Replies
LEARN ABOUT CENTOS
ecpg
ECPG(1) PostgreSQL 9.2.7 Documentation ECPG(1)NAME
ecpg - embedded SQL C preprocessor
SYNOPSIS
ecpg [option...] file...
DESCRIPTION
ecpg is the embedded SQL preprocessor for C programs. It converts C programs with embedded SQL statements to normal C code by replacing the
SQL invocations with special function calls. The output files can then be processed with any C compiler tool chain.
ecpg will convert each input file given on the command line to the corresponding C output file. Input files preferably have the extension
.pgc, in which case the extension will be replaced by .c to determine the output file name. If the extension of the input file is not .pgc,
then the output file name is computed by appending .c to the full file name. The output file name can also be overridden using the -o
option.
This reference page does not describe the embedded SQL language. See Chapter 33, ECPG - Embedded SQL in C, in the documentation for more
information on that topic.
OPTIONS
ecpg accepts the following command-line arguments:
-c
Automatically generate certain C code from SQL code. Currently, this works for EXEC SQL TYPE.
-C mode
Set a compatibility mode. mode can be INFORMIX or INFORMIX_SE.
-D symbol
Define a C preprocessor symbol.
-h
Parse a header file, this option includes otion -c.
-i
Parse system include files as well.
-I directory
Specify an additional include path, used to find files included via EXEC SQL INCLUDE. Defaults are . (current directory),
/usr/local/include, the PostgreSQL include directory which is defined at compile time (default: /usr/local/pgsql/include), and
/usr/include, in that order.
-o filename
Specifies that ecpg should write all its output to the given filename.
-r option
Selects run-time behavior. Option can be one of the following:
no_indicator
Do not use indicators but instead use special values to represent null values. Historically there have been databases using this
approach.
prepare
Prepare all statements before using them. Libecpg will keep a cache of prepared statements and reuse a statement if it gets
executed again. If the cache runs full, libecpg will free the least used statement.
questionmarks
Allow question mark as placeholder for compatibility reasons. This used to be the default long ago.
--regression
Run in regression testing mode.
-t
Turn on autocommit of transactions. In this mode, each SQL command is automatically committed unless it is inside an explicit
transaction block. In the default mode, commands are committed only when EXEC SQL COMMIT is issued.
-v
Print additional information including the version and the "include" path.
--version
Print the ecpg version and exit.
-?, --help
Show help about ecpg command line arguments, and exit.
NOTES
When compiling the preprocessed C code files, the compiler needs to be able to find the ECPG header files in the PostgreSQL include
directory. Therefore, you might have to use the -I option when invoking the compiler (e.g., -I/usr/local/pgsql/include).
Programs using C code with embedded SQL have to be linked against the libecpg library, for example using the linker options
-L/usr/local/pgsql/lib -lecpg.
The value of either of these directories that is appropriate for the installation can be found out using pg_config(1).
EXAMPLES
If you have an embedded SQL C source file named prog1.pgc, you can create an executable program using the following sequence of commands:
ecpg prog1.pgc
cc -I/usr/local/pgsql/include -c prog1.c
cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg
PostgreSQL 9.2.7 2014-02-17 ECPG(1)