熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

oracle中怎樣從sql*plus向shell傳遞變量?

2022-06-13   來源: Oracle 
很多人在實際的工作和學習中都遇到了無法通過sqlplus向shell傳遞變量下面我們來介紹一個實例腳本來進行折中處理

  

  [oracle@jumper oracle]$ cat ash sqlplus S / as sysdba << ! set heading off col today noprint column today new_val dat select to_char( sysdate yyyymmdd) today from dual; host echo today is &dat exit; exit; ! [oracle@jumper oracle]$ /ash today is [oracle@jumper oracle]$

  下面我們再來介紹另一個實例方法

  

  [oracle@jumper oracle]$ more ash #!/bin/ksh VALUE=`sqlplus silent / as sysdba < < END set pagesize feedback off verify off heading off echo off select max(sequence#) from v\\\$log_history; exit; END` if [ z $VALUE ]; then echo No rows returned from database exit else echo Max Sequence Number: $VALUE fi [oracle@jumper oracle]$ /ash Max Sequence Number:

 
 

From:http://tw.wingwit.com/Article/program/Oracle/201311/17318.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.