我已經編寫了一個小型bash腳本來從表中刪除一些行並使用sqlplus刪除一些用戶。當我將代碼放入函數時,它會給出「語法錯誤:文件意外結束」錯誤消息。以下是代碼。請讓我知道如何解決它。使用sqlplus編寫bash函數刪除用戶
function reset_db
{
sqlplus user1/[email protected]${input} << eof
set timing off
set serveroutput on size 10000
set feedback off
spool logfile_$input.out
delete from table1 where component = 'XYZ';
delete from table2 where component = 'XYZ';
commit;
exit
eof
sqlplus dba_usr/[email protected]${input} << eof
set timing off
set serveroutput on size 10000
set feedback off
spool logfile_$input.out
drop user ABC cascade;
drop user DEF cascade;
drop user HIG cascade;
commit;
exit;
}
好像'$ input'應該是函數的參數。 – 2013-02-21 22:31:22