set heading off
set scan on
set define on
whenever sqlerror exit
prompt
prompt Logging on as Oracle Portal owner
prompt
accept connstr prompt 'Enter connection string (e.g. portal30/portal30@orcl) : '
prompt
connect &connstr
whenever sqlerror continue
var l_verstr varchar2(10);
var l_ver    number;
execute :l_verstr := wwctx_api.get_product_version;
execute :l_verstr := wwv_standard_util.get_version;
execute :l_ver := substr(:l_verstr, 1, instr(:l_verstr, '.') - 1);
whenever sqlerror exit
set define off
spool rwwwvtmp.sql
select decode(:l_ver, 2, '@2.2/rwwwvdei.sql',
                      3, '@3.0/rwdeinst30.sql') from dual;
spool off
set define on
@rwwwvtmp.sql
quit
