1
0

More than 3 years have passed since last update.

Sqlplusで複数SQLスクリプトを実行

Posted at
sqlplus userid/pwd @test.sql

sqlplusコマンドで指定できるスクリプト数が、どうやら1つしかできないようです。
一括まとめのsqlスクリプトを作っておけば複数SQLスクリプトを実行することが可能になります。

test.sql

--Grobal変数
define yyyymm = 201510
@file1.sql
@file2.sql
@file3.sql

各file1.sql

set echo on
set time on
set timi on
set pages 0
set head off
set colsep ','
set lin 1000
set trimspool on
set termout off
spool ./log/log名&yyyymm..txt
/
spool off
--exit

注意点

・SQLの最後には必ず「;」(セミコロン)が必要です。(/(スラッシュ)も可)
・SQLスクリプトにexitを書かないこと

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0