set serveroutput on size 1000000
set verify off
set feedback off
set pagesize 0
spool filename
VARIABLE vi_err NUMBER
SELECT empno||','||ename||','||job||','||mgr||hiredate||','||sal||','||comm||','||deptno FROM emp;
spool off
EXIT:vi_err
EOF
hi satnam.. is there a way not to mention the user name and pasword in the script. i have a requirement like this. i have to run a sql query using shell scripts. once the query is run, the results have to be stored in a data file. if any values are returned by the query, it should display an error msg to the user or else it has to exit. pls help me with this as i am totally new to shell scripting and i just started to learn..
basically collects all of the "echo" command's output as a group and they are piped through to Oracle's sqlplus command processor. So it behaves just like running sqlplus interactively and you typing in those commands.
>> $root_dir/$csv_file1
directs the output from the SQL commands to a file on the UNIX server. The path and filename are in variables $root_dir and $csv_file.
Ultimately, the SQL is building a csv (comma delimited) file that will be used for, presumably, as an input to another system.
hi, I am new to unix I have executed the following script :-
X=`sqlplus service/service@psmf.world <<eof
set serveroutput on;
set feedback off;
set linesize 1000;
select count(*) from table ;
EXIT;
eof`
echo $X>testing1.txt
.... and got the following output
vi testing1.txt
SQL*Plus: Release 9.2.0.5.0 - Production on Mon Mar 17 07:57:45 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.5.0 - Production
SQL>
COUNT(*)
----------
270
SQL> Disconnected from Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.5.0 - Production
I only want output 270 in the file. How can i get this output? Please give your inputs
If you have questions do not hesitate to ask but start your own thread and don't hijack old threads.
Having said that, with awk you can get the value as follow:
Sorry for posting some Oracle related question in this forum as I don't know if any other place that I can post the question. I am sure there are many of you familiar with Oracle database and can answer my question.
My DBA recently written a analytic script to perform a table space analyse as well as reform of indexes in order to have a better performance on some application processes. The scripts that written by him is as follow :
Analyze table GNMM_INTEREST_RATE_MASTER estimate statistics for table for all indexes for all indexed columns;
Analyze table PS_INTEREST_TRANSACTION_TEMP estimate statistics for table for all indexes for all indexed columns;
Analyze table PSDT_APL_TRANSACTION_BREAKUP estimate statistics for table for all indexes for all indexed columns;
Analyze table PSMT_CLEARANCE_MASTER estimate statistics for table for all indexes for all indexed columns;
Analyze table PSDT_CLEARANCE_DETAILS estimate statistics for table for all indexes for all indexed columns;
I can run the script on AIX platform with Oracle priviledge. And the application process run after the script will have a very much improve performance.
I have also found another scripts written by some other DBA from other company who claimed that is the same as the one I stated above. The scripts are as below :
create or replace
procedure BFN_ANALYZE_INT_ACCTABLES is