Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9bb79ab

Browse files
author
Peter Ocelka
committed
In situation when user uninstalls older version of utPLSQL table is not dropped. Then when new version is installed manually without user creation, this script failed as table already exists in the schema.
1 parent bd78b6f commit 9bb79ab

1 file changed

Lines changed: 38 additions & 23 deletions

File tree

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
1-
create global temporary table ut_dbms_output_cache(
2-
/*
3-
utPLSQL - Version 3
4-
Copyright 2016 - 2017 utPLSQL Project
5-
Licensed under the Apache License, Version 2.0 (the "License"):
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
Unless required by applicable law or agreed to in writing, software
10-
distributed under the License is distributed on an "AS IS" BASIS,
11-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
See the License for the specific language governing permissions and
13-
limitations under the License.
14-
*/
15-
/*
16-
* This table is not a global temporary table as it needs to allow cross-session data exchange
17-
* It is used however as a temporary table with multiple writers.
18-
* This is why it has very high initrans and has nologging
19-
*/
20-
seq_no number(20,0) not null,
21-
text varchar2(4000),
22-
constraint ut_dbms_output_cache_pk primary key(seq_no)
23-
) on commit preserve rows;
1+
/*
2+
utPLSQL - Version 3
3+
Copyright 2016 - 2017 utPLSQL Project
4+
Licensed under the Apache License, Version 2.0 (the "License"):
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+
*/
14+
/*
15+
* This table is not a global temporary table as it needs to allow cross-session data exchange
16+
* It is used however as a temporary table with multiple writers.
17+
* This is why it has very high initrans and has nologging
18+
*/
19+
declare
20+
l_tab_exist number;
21+
begin
22+
select count(*) into l_tab_exist from
23+
(select table_name from all_tables where table_name = 'UT_DBMS_OUTPUT_CACHE' and owner = sys_context('USERENV','CURRENT_SCHEMA')
24+
union all
25+
select synonym_name from all_synonyms where synonym_name = 'UT_DBMS_OUTPUT_CACHE' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
26+
if l_tab_exist = 0 then
27+
28+
execute immediate q'[create global temporary table ut_dbms_output_cache
29+
(
30+
seq_no number(20,0) not null,
31+
text varchar2(4000),
32+
constraint ut_dbms_output_cache_pk primary key(seq_no)
33+
) on commit preserve rows
34+
]';
35+
36+
end if;
37+
end;
38+
/

0 commit comments

Comments
 (0)