0
sqlplus/bash腳本的新手。我目前有一個簡單的腳本,基於某些ID值在表中獲取某個值。sqlplus在bash上輸入重定向
#do things. get login info. etc....
(cat<<HERE
set heading off;
select data_value from metadata where name='JOHN' and uniqueid in (1, 2, 3);
EOD
) | sqlplus -S $login
#do things.
如果,而不必手動輸入的ID(1,2,3,等...),我這樣做:
#calls a script that gets the IDs from somewhere and outputs it in the correct format
./getIDscript > IDs
#do things. get login info. etc....
(cat<<HERE
set heading off;
select data_value from metadata where name='JOHN' and uniqueid in ($IDs);
EOD
) | sqlplus -S $login
#do things.
將這項工作?我目前幾天將無法進入學校實驗室,所以我現在無法對此進行測試。 有沒有更好更有效的方法來做到這一點?
你可以用'$(./ getIDscript)'在SQL插入運行'結果/ getIDscript'。 –