On Oct 17, 2:44 pm, skaizun <[EMAIL PROTECTED]> wrote:
> In the following csh script,
> I'd rather set a variable
> than output to a file that I have to delete:
>
> ====================================
> #! /bin/csh
>
> sqlplus -s my_logon > my_result <<!
>
> set heading off feedback off verify off
>
> select to_char(sysdate, 'YYYYMMDD_SSSSS') from dual;
>
> !
>
> echo "time stamp is: " `cat my_result`
>
> 'rm' -f my_result
> ====================================
>
> So, how do I set a csh variable to the result of the "select"?
>
> Any help would be appreciated
> (except for comments concerning style and "do it in ksh"). ;)
>
> Thanks!
Since your SQL script isn't changing I suggest you take that out and
write a my_script.sql file, then call that from sqlplus in your
script:
my_script.sql
set heading off feedback off verify off
select to_char(sysdate, 'YYYYMMDD_SSSSS') from dual;
exit
shell script:
#! /bin/csh
set my_logon=#######/&&&&&&&@************************
set my_result=`sqlplus -s $my_logon @my_script`
echo "time stamp is: "$my_result
script output:
$ csh_test.sh
time stamp is: 20081020_30347
David Fitzjarrell
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---