Executing sql statement and storing value in variable

后端 未结 1 700
死守一世寂寞
死守一世寂寞 2021-01-26 03:24

I have a shell script which is trying to execute a simple sql statement and intend to store the result in single variable. But i am unable to do it.I am using Cygwin and intende

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

    You are missing a $.

    Try:

    var=$(sqlplus cimnewuser/cimnewuser@cimnew
    select ID from catalog where tablename='MCT_35618';
    exit)
    

    Alternatively, you can use backticks:

    var=`sqlplus ...`
    
    0 讨论(0)
提交回复
热议问题