How to pass variables in sqlplus in bash command
Here is may problem : I have inline sqlplus call in my bash file and I would like to pass it a parameter
this code is what I'm trying
c_id=`sqlplus -S $login/$password  $id << EOF
    set pagesize 0
    set verify off
    set head off
    set feedback off
    SELECT id from bdd.table where ID not in (select id from bdd.TMP_table) and i开发者_运维知识库d > &1 and ROWNUM <= 1000 order by id;
    exit;
    EOF`
how can I use my $id parameter in my where statement (&1)?
Just change &1 to $id. For example:
id=101
c_id=`sqlplus -S $login/$password  << EOF
    set pagesize 0
    set verify off
    set head off
    set feedback off
    SELECT id from bdd.table where ID not in (select id from bdd.TMP_table) and id > $id and ROWNUM <= 1000 order by id;
    exit;
    EOF`
Bash will perform parameter substitution. $id will be substituted with the actual value of the parameter i.e. 101 in this case, before sqlplus runs.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论