-- $Header: whdev/2.0/owb/shiphome/owb/reposasst/upg/bug_6728479.sql /main/1 2010/03/17 01:09:12 dawsun Exp $ -- Update synonyms for some datatypes. -- -- Note: PLEASE connect as OWBSYS before execute the file. -- -- Bug 6728479 - SOME DATATYPES NOT SEEDED FOR DB2 PLATFORM -- SET SERVEROUTPUT ON SET LINESIZE 500 -- ########################################################################## DECLARE -- Outer block for utility functions/variables BUGBUG: Should these be packagized (uprop_util) -- ########################################################################## SCRIPTID CONSTANT VARCHAR2(40) := 'bug 6728479'; -- For output logging EOL CONSTANT VARCHAR2(01) := CHR(10); -- new line TRACEON CONSTANT BOOLEAN := TRUE; -- Provide function level trace output OUTINITED BOOLEAN := FALSE; -- Flag indicating output has been enabled -- ************************************************************************** -- ************************************************************************** -- Useful functions/procedures -- ************************************************************************** -- ************************************************************************** -- ========================================================================== -- put message to output (uses DBMS_OUTPUT) PROCEDURE put(msg VARCHAR2) IS -- ========================================================================== BEGIN IF NOT OUTINITED THEN OUTINITED := TRUE; DBMS_OUTPUT.ENABLE(200000); put('DBMS_OUTPUT Enabled.'); END IF; IF (LENGTH(msg) + LENGTH(SCRIPTID) + 2) > 255 THEN -- 10.1 database can't handle messages with length > 255 --DBMS_OUTPUT.put_line('Message length > 255'); --DBMS_OUTPUT.put_line(SUBSTR(msg, 0, 255)); -- Break the string up into lines or 255-byte chunks DECLARE l_msg_line VARCHAR2(255); l_eol_index NUMBER; l_curr_index NUMBER; l_msg_len NUMBER := LENGTH(msg); l_loop_index NUMBER := 0; BEGIN DBMS_OUTPUT.PUT_LINE(SCRIPTID || ':'); l_eol_index := 1; l_curr_index := 1; l_loop_index := 0; WHILE (l_curr_index < l_msg_len AND l_loop_index < 10) LOOP l_eol_index := INSTR(msg, EOL, l_curr_index); --DBMS_OUTPUT.put_line('l_eol_index = ' || TO_CHAR(l_eol_index)); IF (l_eol_index <= 0) OR (l_eol_index - l_curr_index) > 255 THEN l_msg_line := SUBSTR(msg, l_curr_index, 255); l_curr_index := l_curr_index + 255; ELSE l_msg_line := SUBSTR(msg, l_curr_index, l_eol_index - l_curr_index); l_curr_index := l_eol_index + 1; END IF; DBMS_OUTPUT.PUT_LINE(l_msg_line); l_loop_index := l_loop_index + 1; END LOOP; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(SQLERRM); END; ELSE DBMS_OUTPUT.put_line(SCRIPTID || ': ' || msg); END IF; END; -- ========================================================================== -- put message to output controlled by TRACEON variable (uses put) PROCEDURE putTrace(msg VARCHAR2) IS -- ========================================================================== BEGIN IF TRACEON THEN put(msg); END IF; END; -- ########################################################################## -- ########################################################################## BEGIN -- Outer block - utility functions/variables now defined -- ########################################################################## -- ########################################################################## -- ======================================================= DECLARE -- Inner block for utility function/variable usage -- aka 'user' declarations -- ======================================================= -- ======================================================= BEGIN -- -- ======================================================= put('Add synonym CHAR'); UPDATE CMPDatatype_r SET SYNONYMS = 'CHAR' WHERE UOID = '2F5ADD1D0D2EF083E040578CA30A068A'; put('Add synonym INT'); UPDATE CMPDatatype_r SET SYNONYMS = 'INT' WHERE UOID = '2F5ADD1D0D36F083E040578CA30A068A'; put('Add synonym NUM'); UPDATE CMPDatatype_r SET SYNONYMS = 'NUM' WHERE UOID = '2F5ADD1D0D38F083E040578CA30A068A'; put('Add synonym DEC'); UPDATE CMPDatatype_r SET SYNONYMS = 'DEC' WHERE UOID = '38529678808D7445E040578CA30A2D34'; put('Add synonym BINARY LARGE OBJECT'); UPDATE CMPDatatype_r SET SYNONYMS = 'BINARY LARGE OBJECT' WHERE UOID = '2F5ADD1D0D3EF083E040578CA30A068A'; put('Add synonym CHAR LARGE OBJECT,CHARACTER LARGE OBJECT'); UPDATE CMPDatatype_r SET SYNONYMS = 'CHAR LARGE OBJECT,CHARACTER LARGE OBJECT' WHERE UOID = '2F5ADD1D0D3FF083E040578CA30A068A'; -- ======================================================= END; -- Inner block for utility function/variable usage -- ======================================================= -- ########################################################################## END; -- Outer block for utility functions/variables -- ########################################################################## /