Shell Script!

Soldato
Joined
8 Oct 2003
Posts
2,897
Location
Glasgow
Hi guys

Been asked to make a shell script at work and this is part of it!

Code:
 Connection stuff :)!


VALUE=$( sqlplus -s userdetailshere<<EOF
set feedback off;
set linesize 60;
set serveroutput on;
[B]select to_char(sysdate, 'DDMMYYYYHHMM') from dual;[/B]
EXIT;
EOF)
echo $VALUE

The problem is the sql statement marked in bold, when i add formatting to the date i get a 'ORA-000904' error stating that 'DDMMYYY' is not a column ?:(
It works if i take the formatting out but i need it in though for the task i am trying!

Thanks Kevin
 
Code:
 Connection stuff :)!


VALUE=$`sqlplus -s userdetailshere<<EOF
set feedback off;
set linesize 60;
set serveroutput on;
[B]select to_char(sysdate, 'DDMMYYYYHHMM') from dual;[/B]
EXIT;
EOF`
echo $VALUE

Fixed :)
 
Hi,

Thanks for the reply the SQL statement was just for testing i was getting any output from the oracle box :)

I am still working on the proper version at work the problem is that I have sysdate - another date I am trying to get the resulting output in minutes, however i am getting 1400 - 1335 = 65 and not 25 :(
 
Hi there,

Just got around to trying this still not working correctly also tried it in excel but the results are the same

#! /bin/sh

DateVal1='201220081000'
DateVal2='201220080945'
sum=$(($DateVal1-$DateVal2))

echo $DateVal1
echo $DateVal2
echo $sum

sum returns 55 when i do sum * 1440 the result is 79200 I have been googling and they seem to suggest multiplying but 1440 also am I missing something silly ?:)

Thanks Kevin.
 
Back
Top Bottom