Select columns into local variable from sql script using shell script

后端 未结 1 1647
刺人心
刺人心 2021-01-26 06:08

How do I stores columns values retrieved from a table into a variable in my shell script.

I have the following code:

#!/usr/bin/ksh

echo \"This script w         


        
相关标签:
1条回答
  • 2021-01-26 06:55

    This worked for me.

        #!/usr/bin/ksh
    
    clear
    
    echo "This will print the Date"
    
    VALUE=`sqlplus -silent apps/Z4vRD3me <<END
    set pagesize 0 feedback off verify off heading off echo off
    select sysdate from dual 
    exit;
    END`
    
    
    # xx=$(echo 'select sysdate from dual' | sqlplus -silent apps/Z4vRD3me)
    
    echo $VALUE
    
    echo "End of SQL"
    
    0 讨论(0)
提交回复
热议问题