Skip to content

Commit 16a42e6

Browse files
committed
Update of install script.
1 parent cf20c2d commit 16a42e6

File tree

2 files changed

+90
-9
lines changed

2 files changed

+90
-9
lines changed

source/install.sql

Lines changed: 83 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,89 @@
11
prompt Installing utplsql v2-v3 migration utility
22

3-
set serveroutput on size unlimited
43
set timing off
54
set feedback off
65
set verify off
6+
set heading off
7+
set linesize 1000
8+
set pagesize 0
9+
set feedback off
10+
set echo off
11+
set termout off
12+
set serveroutput on size unlimited format truncated
13+
14+
column 1 new_value 1 noprint
15+
column 2 new_value 2 noprint
16+
select null as "1", null as "2" from dual where 1=0;
17+
column sep new_value sep noprint
18+
select '--------------------------------------------------------------' as sep from dual;
19+
20+
spool params.sql.tmp
21+
22+
select
23+
case
24+
when '&&1' is null then q'[ACCEPT utplsql_v2_owner CHAR DEFAULT 'UTP' PROMPT 'Provide schema owning the utPLSQL v2 (UTP)']'
25+
else 'define utplsql_v2_owner=&&1'
26+
end
27+
from dual;
28+
select
29+
case
30+
when '&&2' is null then q'[ACCEPT utplsql_v3_owner CHAR DEFAULT 'UT3' PROMPT 'Provide schema owning the utPLSQL v3 (UT3)']'
31+
else 'define utplsql_v3_owner=&&2'
32+
end
33+
from dual;
34+
35+
spool off
36+
37+
set termout on
38+
@params.sql.tmp
739

840
whenever sqlerror exit failure rollback
941
whenever oserror exit failure rollback
1042

11-
define utplsql_v2_owner=&1
12-
define utplsql_v3_owner=&2
43+
prompt &&sep
44+
begin
45+
execute immediate q'[begin dbms_output.put_line('User &&utplsql_v2_owner owns utPLSQL - version '||&&utplsql_v2_owner..utplsql.version()); end;]';
46+
exception
47+
when others then
48+
raise_application_error(-20000, 'User &&utplsql_v2_owner does not own utPLSQL v2 or current user('||user||') does not have privileges to access it.');
49+
end;
50+
/
51+
52+
prompt &&sep
53+
begin
54+
execute immediate q'[begin dbms_output.put_line('User &&utplsql_v3_owner owns '||&&utplsql_v3_owner..ut.version()); end;]';
55+
exception
56+
when others then
57+
raise_application_error(-20000, 'User &&utplsql_v3_owner does not own utPLSQL v3 or current user('||user||') does not have privileges to access it.');
58+
end;
59+
/
60+
61+
prompt &&sep
62+
prompt Using schema (&&utplsql_v2_owner) as owner of utPLSQL v2
63+
prompt Using schema (&&utplsql_v3_owner) as owner of utPLSQL v3
1364

1465
alter session set current_schema = &&utplsql_v3_owner;
1566

67+
prompt &&sep
68+
PROMPT Installing into schema &&utplsql_v3_owner
69+
prompt &&sep
70+
set feedback on
71+
set echo on
1672
grant execute on sys.utl_file to &&utplsql_v3_owner;
1773

1874
drop public synonym utassert2;
1975
drop public synonym utassert;
2076

21-
@@migration/utassert2.pks
22-
@@migration/utassert.pks
23-
@@migration/utassert2.pkb
24-
@@migration/utassert.pkb
25-
@@migration/ut_v2_migration.pks
26-
@@migration/ut_v2_migration.pkb
77+
set echo off
78+
@@install_component.sql 'migration/utassert2.pks'
79+
@@install_component.sql 'migration/utassert.pks'
80+
@@install_component.sql 'migration/ut_v2_migration.pks'
81+
82+
@@install_component.sql 'migration/utassert2.pkb'
83+
@@install_component.sql 'migration/utassert.pkb'
84+
@@install_component.sql 'migration/ut_v2_migration.pkb'
2785

86+
set echo on
2887
create or replace public synonym utassert for &&utplsql_v2_owner..utassert;
2988
create or replace public synonym utassert2 for &&utplsql_v2_owner..utassert2;
3089
create or replace public synonym ut_v2_migration for ut_v2_migration;
@@ -33,4 +92,19 @@ grant execute on utassert to public;
3392
grant execute on utassert2 to public;
3493
grant execute on ut_v2_migration to public;
3594

95+
set echo off
96+
prompt &&sep
97+
PROMPT Installation completed successfully
98+
prompt &&sep
99+
100+
set termout off
101+
102+
/*
103+
* cleanup temporary sql files
104+
*/
105+
--try running on windows
106+
$ del *.sql.tmp
107+
--try running on linux/unix
108+
! rm *.sql.tmp
109+
36110
exit success

source/install_component.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set heading off
2+
set feedback off
3+
exec dbms_output.put_line('Installing component '||upper(regexp_substr('&&1','\/(\w*)\.',1,1,'i',1)));
4+
@@&&1
5+
show errors
6+
exec dbms_output.put_line('--------------------------------------------------------------');
7+

0 commit comments

Comments
 (0)