Skip to content

Instantly share code, notes, and snippets.

@finsterthecat
Created November 17, 2010 15:53
Show Gist options
  • Save finsterthecat/703543 to your computer and use it in GitHub Desktop.
Save finsterthecat/703543 to your computer and use it in GitHub Desktop.
Driver script to run a series of scripts (sql, sqlldr or otherwise) within oracle sqlplus
-- cross platform! Works on unix and windows. Notice ability to run host programs?!
accept _usr prompt 'UserName: (app) ' default 'app'
accept _pwd prompt 'Password: (&_usr) ' default &_usr hide
accept _tns prompt 'TNSalias: (SUE2DEV) ' default 'SUE2DEV'
whenever sqlerror exit
connect &_usr/&_pwd@&_tns
whenever sqlerror continue
-- your SQL and OS scripts here
@@script1.sql
@@script2.sql
host sqlldr &_usr/&_pwd@&_tns control=script3.ctl
undefine _usr _pwd _tns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment