Unix and Oracle scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unix and Oracle scripting
# 1  
Old 08-17-2005
Unix and Oracle scripting

Hello all,
I have a script that is fully functional and satisfactory in oracle. I recently started spooling it's output into unix for processing and manipulation. I do have a few problems however: The output of some columns are altered in the unix output:

1) On oracle, the date comes with a timestamp (ie dd-mmm-yyyy hh:mm:ss) while on unix, all I lose the timestamp (just dd-mmm-yy).

Also, in a column that has a value section, the value 0.00 gets rounded up to just 0.

Is there anyway I can preserve the original values? Please assist.

Khoom
# 2  
Old 08-17-2005
I've worked with Oracle for a long time and never seen this. Could you give a short example of what you get in sqlplus and then what is in the spooled file? (you are using spool?)
# 3  
Old 08-17-2005
can you give a sample lines from the script so we can visualize the problem Smilie
# 4  
Old 08-18-2005
MySQL

before beginning of spooling give the desired format to column.
set column columnName Format formatSpecifier
# 5  
Old 08-18-2005
Hello all.

these are the first few lines

sqlplus -s / <<- eof
set lines 200 (Tried removing that, but it didn't help)
spool <fpath/filename>

I have tried a number of oracle formatting options, but all to no effect. I am using KSH and hp-ux. Thanks y'all for all your help
# 6  
Old 08-18-2005
Try changing your query to use the TO_CHAR function on the date column.
# 7  
Old 08-19-2005
Finally sorted it out. I had put in one VITAL formatting line before the <sqlplus /> command.

I however am still having one slight problem:
I keep getting double outputs.

These are the params I am using before my spool statement:


set lines 1000
set verify off
set feedback off
set echo off
set pages 20
set num 25.

cheers
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Export Oracle multiple tables to multiple csv files using UNIX shell scripting

Hello All, just wanted to export multiple tables from oracle sql using unix shell script to csv file and the below code is exporting only the first table. Can you please suggest why? or any better idea? export FILE="/abc/autom/file/geo_JOB.csv" Export= `sqlplus -s dev01/password@dEV3... (16 Replies)
Discussion started by: Hope
16 Replies

2. Forum Support Area for Unregistered Users & Account Problems

Creation of Oracle table through shell scripting

Hi, I am trying to create a table through shell scripting . I used a command sqlplus -s to connect to sqlplus and user as sysdba. but there is a problem in it. can anyone please solve this . #!/bin/bash $(`sqlplus -s / as sysdba <<eof create table sample (id,int); insert into sample... (1 Reply)
Discussion started by: Unregistered
1 Replies

3. UNIX for Dummies Questions & Answers

Oracle cursors in UNIX shell scripting

Hello, I need to get all the members information from an oracle table whose flag value is enabled. Later on i need to perform several computation based upon the flag value and other columns. For example, Member ID Flag Frequency date 1 ... (2 Replies)
Discussion started by: Krishraj
2 Replies

4. Shell Programming and Scripting

How to update a Oracle table through shell scripting?

My Code is get_week_date() { `sqlplus -s ${DQM_SQL_LOGON}@${DQM_SID} << EOF SET ECHO OFF SET FEEDBACK OFF SET PAGES 0 SET SERVEROUTPUT ON SET VERIFY OFF SET TRIMSPOOL ON (update file_level_qc fq set FQ.DATA_FILE_NAME='Hyvee_Pharmacy_Solutions_201304_v1.txt'... (2 Replies)
Discussion started by: karthick.cho
2 Replies

5. Shell Programming and Scripting

Error in Scripting to monitor tablespace in Oracle DB

Buddies, I am writing the below script 'tab.sh' to monitor the tablespaces in Database:- ------------------------------- export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2 export PATH=$PATH:$ORACLE_HOME/bin export ORACLE_SID=orcl sqlplus system/oracle as sysdba <<EOF spool... (5 Replies)
Discussion started by: sandip250382
5 Replies

6. Shell Programming and Scripting

scope of oracle plsql development /unix shell scripting

I am working in production support in an leading bank and more of my job is more in oracle/plsql. I am learning unix shell scripting and have started development in the same.I would like to know regarding the scope of these two in the industry.Also would like to know about other scripting... (2 Replies)
Discussion started by: jesthomas
2 Replies

7. Shell Programming and Scripting

Help please! Oracle scripting

Hi All, I'm completely new to shell scripting and i've found some old code (10 years), which would be suitable for me to facilitate database shutdowns throughout our systems. I'm on AIX 6 and i'm using 11gr2 Oracle. The problems seems to be with while read portion of this code: FLAG_SET=0... (2 Replies)
Discussion started by: Bluegenes
2 Replies

8. Shell Programming and Scripting

Help needed for shell scripting for oracle.

Hi, Please see contains both files created for automating the data from oracle through shell. 1)a_p.ksh #!/bin/ksh LOG=/home/A_P.log MESSAGE=/home/MESSAGE_A_P.txt mail_list=/home/AP_MAIL_LIST.txt data=/home/spooled_A_P.log echo "`date` Starting execution for A_P COUNT" > $LOG ... (2 Replies)
Discussion started by: fidelis
2 Replies

9. Shell Programming and Scripting

UNIX shell scripting for retrieving from oracle

Hello folks, Please find the below code:(sample5.sh -> filename) echo "Selecting dat afrom Cause code" echo "set appinfo Causecode $preamble set serveroutput on size 10000 select * from RMI003_CAUSE_CODE /" | sqlplus -S $username@$hoststring/$password >> test2.dat When i tried executing... (5 Replies)
Discussion started by: sundar_ravi4
5 Replies

10. Shell Programming and Scripting

Shell Scripting with Oracle...

Hi guys, I have searched all the forums and searched the net as much as possible, but I carn't find any tutorials about shell scripting with Oracle. Has anyone come across any? Thanks for reading and in advance of posts, B14... (2 Replies)
Discussion started by: B14speedfreak
2 Replies
Login or Register to Ask a Question