forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Reviewed-by: Jiang, Beibei <beibei.jiang@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
1075 lines
54 KiB
HTML
1075 lines
54 KiB
HTML
<a name="EN-US_TOPIC_0000001188202588"></a><a name="EN-US_TOPIC_0000001188202588"></a>
|
|
|
|
<h1 class="topictitle1">Package Variables</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p8060118">Package variables are available in Oracle packages that allow variables to retain all the functions and procedures in the package. DSC uses customized functions to help <span id="EN-US_TOPIC_0000001188202588__text1958020141713">GaussDB(DWS)</span> support package variables.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_note330793312611"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><div class="p" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_p154065116416">Prerequisites<ul id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_ul1777734193110"><li id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_li1277614113114">Create and use the <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b1412920985512">MIG_ORA_EXT</strong> schema.</li><li id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_li34372052173115">Copy the contents of the custom script and execute the script in all target databases for which migration is to be performed. For details, see <a href="dws_mt_0032.html">Migration Process</a>.</li></ul>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_p162961364116">If there is a space between a schema name and a package name, or either the package specification or body has quotes, the output may not be the same as expected.</p>
|
|
</div></div>
|
|
<div class="p" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1659625817341"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b165242214912">Input</strong> - <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b1230913312098">Package variables</strong><pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen4159121192616">CREATE
|
|
OR REPLACE PACKAGE scott.pkg_adm_util IS un_stand_value long := '`' ;
|
|
defaultdate date := sysdate ;
|
|
g_pkgname CONSTANT VARCHAR2 ( 255 ) DEFAULT 'pkg_adm_util' ;
|
|
procedure p1 ;
|
|
END pkg_adm_util ;
|
|
/
|
|
|
|
CREATE
|
|
OR REPLACE PACKAGE BODY scott.pkg_adm_util AS defaulttime timestamp := systimestamp ;
|
|
PROCEDURE P1 AS BEGIN
|
|
scott.pkg_adm_util.un_stand_value := 'A' ;
|
|
pkg_adm_util.un_stand_value := 'B' ;
|
|
un_stand_value := 'C' ;
|
|
DBMS_OUTPUT.PUT_LINE ( pkg_adm_util.defaultdate ) ;
|
|
DBMS_OUTPUT.PUT_LINE ( defaulttime ) ;
|
|
DBMS_OUTPUT.PUT_LINE ( scott.pkg_adm_util.un_stand_value ) ;
|
|
DBMS_OUTPUT.PUT_LINE ( pkg_adm_util.un_stand_value ) ;
|
|
DBMS_OUTPUT.PUT_LINE ( un_stand_value ) ;
|
|
END ;
|
|
END ;
|
|
/</pre>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p416531115264"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b451262233719">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen1615294183710">SCHEMA pkg_adm_util
|
|
;
|
|
BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES
|
|
( SCHEMA_NAME ,PACKAGE_NAME ,SPEC_OR_BODY ,VARIABLE_NAME
|
|
,VARIABLE_TYPE ,CONSTANT_
|
|
I ,DEFAULT_VALUE ,EXPRESSION_I )
|
|
VALUES
|
|
( UPPER( 'scott' ) ,UPPER( 'pkg_adm_util' ) ,'S' ,UPPER(
|
|
'un_stand_value' ) ,UPPE
|
|
R( 'TEXT' ) ,false ,'`' ,false ) ;
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES
|
|
( SCHEMA_NAME ,PACKAGE_NAME ,SPEC_OR_BODY ,VARIABLE_NAME
|
|
,VARIABLE_TYPE ,CONSTANT_
|
|
I ,DEFAULT_VALUE ,EXPRESSION_I )
|
|
VALUES
|
|
( UPPER( 'scott' ) ,UPPER( 'pkg_adm_util' ) ,'S' ,UPPER(
|
|
'defaultdate' ) ,UPPER( '
|
|
date' ) ,false ,$q$sysdate$q$ ,true ) ;
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES
|
|
( SCHEMA_NAME ,PACKAGE_NAME ,SPEC_OR_BODY ,VARIABLE_NAME
|
|
,VARIABLE_TYPE ,CONSTANT_
|
|
I ,DEFAULT_VALUE ,EXPRESSION_I )
|
|
VALUES
|
|
( UPPER( 'scott' ) ,UPPER( 'pkg_adm_util' ) ,'S' ,UPPER(
|
|
'g_pkgname' ) ,UPPER( 'VA
|
|
RCHAR2 ( 255 )' ) ,true ,'pkg_adm_util' ,false ) ;
|
|
END ;
|
|
/
|
|
BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES
|
|
( SCHEMA_NAME ,PACKAGE_NAME ,SPEC_OR_BODY ,VARIABLE_NAME
|
|
,VARIABLE_TYPE ,CONSTANT_
|
|
I ,DEFAULT_VALUE ,EXPRESSION_I )
|
|
VALUES
|
|
( UPPER( 'scott' ) ,UPPER( 'pkg_adm_util' ) ,'B' ,UPPER(
|
|
'defaulttime' ) ,UPPER( '
|
|
timestamp' ) ,false ,$q$CURRENT_TIMESTAMP$q$ ,true ) ;
|
|
END ;
|
|
/
|
|
CREATE
|
|
OR REPLACE PROCEDURE pkg_adm_util.P1 AS
|
|
BEGIN
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( current_schema ( )
|
|
,'pkg_adm_util' ,'un_stand_value' ,( 'A' ) ::TEXT ) ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( current_schema ( )
|
|
,'pkg_adm_util' ,'un_stand_value' ,( 'B' ) ::TEXT ) ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( current_schema ( )
|
|
,'pkg_adm_util' ,'un_stand_value' ,( 'C' ) ::TEXT ) ;
|
|
|
|
DBMS_OUTPUT.PUT_LINE ( MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE
|
|
( 'scott' ,'pkg_adm_util' ,'defaultdate' ) :: date ) ;
|
|
DBMS_OUTPUT.PUT_LINE ( MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE(
|
|
'scott' ,'pkg_adm_util' ,'defaulttime' ) :: timestamp ) ;
|
|
DBMS_OUTPUT.PUT_LINE ( MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE(
|
|
'scott' ,'pkg_adm_util' ,'un_stand_value' ) :: TEXT ) ;
|
|
DBMS_OUTPUT.PUT_LINE ( MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE(
|
|
'scott' ,'pkg_adm_util' ,'un_stand_value' ) :: TEXT ) ;
|
|
DBMS_OUTPUT.PUT_LINE ( MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE(
|
|
'scott' ,'pkg_adm_util' ,'un_stand_value' ) :: TEXT ) ;
|
|
END ;
|
|
/</pre>
|
|
<div class="note" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_note03742239236"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p537422312231">If <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b11874104524117">pkgSchemaNaming</strong> is <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b1380052174112">true</strong>.</p>
|
|
<ul id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_ul1037442362317"><li id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_li15374192316237">Oracle supports package variables for multiple schemas. If different schemas have the same package and variable names, such as:<ul id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_ul15374112317237"><li id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_li7374112382312">schema1.mypackage.myvariable</li><li id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_li63743231237">schema2.mypackage.myvariable</li></ul>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p83751423192319">After migration, the schema names will not be used to differentiate the two package variables. Because schema names are ignored, the last data type declaration or operation for [<em id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_i92641938162317">any_schema</em>]<strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b182641838122310">.mypackage.myvariable</strong> will overwrite the type and value for <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b1626423814237">schema1.mypackage.myvariable</strong> and <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b52641383239">schema2.mypackage.myvariable</strong>.</p>
|
|
</li></ul>
|
|
</div></div>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p11127051165014"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b14535130175115">Input-</strong><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b12378102155218">Package veriable with default vaue declared in one package by using CONSTANT keyword and used in another package</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p986644135210">The global veriable declared in the package specification is accessed in the same or another pacakge.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen116047372519">PACKAGE "SAD"."BAS_SUBTYPE_PKG" : (Declaring global variable)
|
|
-------------------------------------------------
|
|
g_header_waiting_split_status CONSTANT VARCHAR2(20) := 'Waiting_Distribute';
|
|
|
|
PACKAGE SAD.sad_lookup_stage_pkg: (Used global variable)
|
|
--------------------------------------------------
|
|
PROCEDURE calc_product_price(pi_contract_no IN VARCHAR2 DEFAULT NULL,
|
|
pi_stage_id IN NUMBER DEFAULT NULL,
|
|
pi_calc_category IN VARCHAR2 DEFAULT 'all',
|
|
pi_op_code IN NUMBER,
|
|
po_error_msg OUT VARCHAR2)
|
|
IS
|
|
|
|
CURSOR cur_contract IS
|
|
SELECT DISTINCT sdh.contract_number, sdh.stage_id
|
|
FROM sad_distribution_headers_t sdh
|
|
WHERE sdh.status = bas_subtype_pkg.g_header_waiting_split_status
|
|
AND sdh.contract_number = nvl(pi_contract_no, sdh.contract_number)
|
|
AND sdh.stage_id = nvl(pi_stage_id, sdh.stage_id);
|
|
|
|
v_ras_flag VARCHAR2 ( 1 ) ;
|
|
BEGIN
|
|
..
|
|
...
|
|
END calc_product_price;
|
|
/ </pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p198907511508"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b183622297534">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen78761824105312">PROCEDURE calc_product_price(pi_contract_no IN VARCHAR2 DEFAULT NULL,
|
|
pi_stage_id IN NUMBER DEFAULT NULL,
|
|
pi_calc_category IN VARCHAR2 DEFAULT 'all',
|
|
pi_op_code IN NUMBER,
|
|
po_error_msg OUT VARCHAR2)
|
|
IS
|
|
|
|
MIG_PV_VAL_DUMMY_G_HEADER_WAITING_SPLIT_STATUS VARCHAR2 ( 20 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_subtype_pkg' ,'g_header_waiting_split_status' ) ::VARCHAR2 ( 20 ) ;
|
|
|
|
CURSOR cur_contract IS
|
|
SELECT DISTINCT sdh.contract_number, sdh.stage_id
|
|
FROM sad_distribution_headers_t sdh
|
|
WHERE sdh.status = MIG_PV_VAL_DUMMY_G_HEADER_WAITING_SPLIT_STATUS
|
|
AND sdh.contract_number = nvl(pi_contract_no, sdh.contract_number)
|
|
AND sdh.stage_id = nvl(pi_stage_id, sdh.stage_id);
|
|
|
|
v_ras_flag VARCHAR2 ( 1 ) ;
|
|
|
|
BEGIN
|
|
..
|
|
...
|
|
END;
|
|
/</pre>
|
|
<div class="note" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_note0570125315312"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1611453365516">Package variables need to be declared before CURSOR declaration.</p>
|
|
</div></div>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p10142201512486"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b65142091861">Input-Variable of type EXCEPTION</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p101331117612">A package variable is a kind of global variable, which can be used in the entire package after being declared once.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen122906128717">CREATE OR REPLACE PACKAGE BODY SAD.sad_lookup_stage_pkg IS
|
|
|
|
ex_prog_error EXCEPTION;
|
|
|
|
PROCEDURE assert_null ( pi_value IN VARCHAR2 )
|
|
IS
|
|
BEGIN
|
|
IF pi_value IS NOT NULL THEN
|
|
RAISE ex_prog_error ;
|
|
|
|
END IF ;
|
|
|
|
END assert_null;
|
|
|
|
END SAD.sad_lookup_stage_pkg
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p139151316715"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b712782086">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen6841516819">CREATE
|
|
OR REPLACE PROCEDURE SAD.sad_lookup_stage_pkg#assert_null
|
|
( pi_value IN VARCHAR2 )
|
|
PACKAGE
|
|
IS
|
|
ex_prog_error EXCEPTION;
|
|
BEGIN
|
|
IF pi_value IS NOT NULL THEN
|
|
RAISE ex_prog_error ;
|
|
|
|
END IF ;
|
|
|
|
END ;
|
|
/</pre>
|
|
<div class="note" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_note1940517376819"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p540515375810">As GaussDB does not have the software package functions, the package variable needs to be declared in the procedure or function.</p>
|
|
</div></div>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p941654472"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b021920330433">Input - If the configuration parameter pkgSchemaNaming is set to false</strong></p>
|
|
<div class="p" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p189108178449">A package veriable is a kind of global variable, which can be used in the entire package after being declared once.<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen105561728124415">CREATE OR REPLACE PACKAGE BODY SAD.bas_lookup_misc_pkg IS
|
|
|
|
g_pkg_name CONSTANT VARCHAR2(30) := 'bas_lookup_misc_pkg';
|
|
g_func_name VARCHAR2(30);
|
|
|
|
FUNCTION func_name RETURN VARCHAR2 IS
|
|
l_func_name VARCHAR2(100);
|
|
BEGIN
|
|
l_func_name := g_pkg_name || '.' || g_func_name;
|
|
RETURN l_func_name;
|
|
END;
|
|
END SAD.bas_lookup_misc_pkg;
|
|
/ </pre>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1374110141449"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b379917453449">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen19910185013441">INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'bas_lookup_misc_pkg' )
|
|
,'B'
|
|
,UPPER( 'g_func_name' )
|
|
,UPPER( 'VARCHAR2(30)' )
|
|
,FALSE
|
|
,NULL
|
|
,FALSE ) ;
|
|
|
|
END ;
|
|
/
|
|
--********************************************************************
|
|
CREATE
|
|
OR REPLACE FUNCTION SAD.bas_lookup_misc_pkg#func_name
|
|
RETURN VARCHAR2
|
|
PACKAGE
|
|
IS
|
|
l_func_name VARCHAR2 ( 100 ) ;
|
|
MIG_PV_VAL_DUMMY_G_PKG_NAME VARCHAR2 ( 30 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_lookup_misc_pkg' ,'g_pkg_name' ) ::VARCHAR2 ( 30 ) ;
|
|
MIG_PV_VAL_DUMMY_G_FUNC_NAME VARCHAR2 ( 30 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_lookup_misc_pkg' ,'g_func_name' ) ::VARCHAR2 ( 30 ) ;
|
|
|
|
BEGIN
|
|
l_func_name := MIG_PV_VAL_DUMMY_G_PKG_NAME || '.' || MIG_PV_VAL_DUMMY_G_FUNC_NAME ;
|
|
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD','bas_lookup_misc_pkg','g_pkg_name',MIG_PV_VAL_DUMMY_G_PKG_NAME ) ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD','bas_lookup_misc_pkg','g_func_name',MIG_PV_VAL_DUMMY_G_FUNC_NAME ) ;
|
|
|
|
RETURN l_func_name ;
|
|
|
|
|
|
END ;
|
|
/</pre>
|
|
<div class="note" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_note3817002479"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p5200119125117">If the configuration parameter <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b3239273523">pkgSchemaNaming</strong> is set to <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b179023308529">false</strong>, package variable migration is not happening properly in some places ( for example, GET to fetch default value and SET to assign final value are not added ). This setting is not recommended by the kernel team. Please check with Kernel team.</p>
|
|
</div></div>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1723514817534"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b1312910278479">Input-Package variable declared with data type as table column %TYPE</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p4711134112470">If a data type is declared as table column %TYPE for a variable, the data type which is defined on table creation level is considered to be the corresponding column.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen1333431144816">CREATE OR REPLACE PACKAGE BODY SAD.bas_lookup_misc_pkg IS
|
|
|
|
v_emp_name emp.ename%TYPE;
|
|
|
|
PROCEDURE save_emp_dtls ( v_empno IN VARCHAR2 )
|
|
IS
|
|
BEGIN
|
|
|
|
IF v_emp_name IS NULL THEN
|
|
v_emp_name := 'test';
|
|
END IF ;
|
|
|
|
END save_emp_dtls;
|
|
|
|
END bas_lookup_misc_pkg
|
|
/ </pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p20776312543"><strong id="EN-US_TOPIC_0000001188202588__b19110142814418">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen1077153116544">BEGIN
|
|
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'bas_lookup_misc_pkg' )
|
|
,'B'
|
|
,UPPER( 'v_emp_name' )
|
|
,UPPER( 'VARCHAR2(30)' )
|
|
,FALSE
|
|
,NULL
|
|
,FALSE ) ;
|
|
|
|
END ;
|
|
/
|
|
--*********************************************************
|
|
CREATE
|
|
OR REPLACE PROCEDURE SAD.bas_lookup_misc_pkg#save_emp_dtls ( v_empno IN VARCHAR2 )
|
|
PACKAGE
|
|
IS
|
|
MIG_PV_VAL_DUMMY_EMP_NAME VARCHAR2 ( 30 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_lookup_misc_pkg' ,'v_emp_name' ) ::VARCHAR2 ( 30 ) ;
|
|
BEGIN
|
|
IF MIG_PV_VAL_DUMMY_EMP_NAME IS NULL THEN
|
|
MIG_PV_VAL_DUMMY_EMP_NAME := 'test';
|
|
END IF ;
|
|
|
|
END ;
|
|
/</pre>
|
|
<div class="note" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_note10791531155415"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p177916314540">While migrating a package variable with a data type as table column %TYPE, take the actual data type from a table and use it while declaring a variable, rather than using %TYPE.</p>
|
|
</div></div>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1446951513549"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b8158133615612">Input - If the configuration parameter "pkgSchemaNaming" is set to false</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p7622437065">If the PACKAGE name is specified along with the SCHEMA name, use the SCHEMA name on GET() to fetch the default value and SET() to assign the final value .</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen775490475">CREATE OR REPLACE PACKAGE BODY SAD.bas_lookup_misc_pkg IS
|
|
|
|
g_pkg_name CONSTANT VARCHAR2(30) := 'bas_lookup_misc_pkg';
|
|
g_func_name VARCHAR2(30);
|
|
|
|
FUNCTION func_name RETURN VARCHAR2 IS
|
|
l_func_name VARCHAR2(100);
|
|
BEGIN
|
|
l_func_name := g_pkg_name || '.' || g_func_name;
|
|
RETURN l_func_name;
|
|
END;
|
|
END SAD.bas_lookup_misc_pkg;
|
|
/ </pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p764041518542"><strong id="EN-US_TOPIC_0000001188202588__b27161335516">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen32376206716">BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'bas_lookup_misc_pkg' )
|
|
,'B'
|
|
,UPPER( 'g_pkg_name' )
|
|
,UPPER( 'VARCHAR2(30)' )
|
|
,TRUE
|
|
,'bas_lookup_misc_pkg'
|
|
,FALSE ) ;
|
|
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'bas_lookup_misc_pkg' )
|
|
,'B'
|
|
,UPPER( 'g_func_name' )
|
|
,UPPER( 'VARCHAR2(30)' )
|
|
,FALSE
|
|
,NULL
|
|
,FALSE ) ;
|
|
|
|
END ;
|
|
/
|
|
--********************************************************************
|
|
CREATE
|
|
OR REPLACE FUNCTION SAD.bas_lookup_misc_pkg#func_name
|
|
RETURN VARCHAR2
|
|
PACKAGE
|
|
IS
|
|
l_func_name VARCHAR2 ( 100 ) ;
|
|
MIG_PV_VAL_DUMMY_G_PKG_NAME VARCHAR2 ( 30 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_lookup_misc_pkg' ,'g_pkg_name' ) ::VARCHAR2 ( 30 ) ;
|
|
MIG_PV_VAL_DUMMY_G_FUNC_NAME VARCHAR2 ( 30 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_lookup_misc_pkg' ,'g_func_name' ) ::VARCHAR2 ( 30 ) ;
|
|
|
|
BEGIN
|
|
l_func_name := MIG_PV_VAL_DUMMY_G_PKG_NAME || '.' || MIG_PV_VAL_DUMMY_G_FUNC_NAME ;
|
|
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD','bas_lookup_misc_pkg','g_pkg_name',MIG_PV_VAL_DUMMY_G_PKG_NAME ) ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD','bas_lookup_misc_pkg','g_func_name',MIG_PV_VAL_DUMMY_G_FUNC_NAME ) ;
|
|
|
|
RETURN l_func_name ;
|
|
|
|
|
|
END ;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p188310501917"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b1513614731010">Input - If the configuration parameter pkgSchemaNaming is set to false</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p18372141685417">If the configuration parameter <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b14886592198">pkgSchemaNaming</strong> is set to <strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b162751287203">false</strong>.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen1251713267102">CREATE OR REPLACE PACKAGE BODY bas_lookup_misc_pkg IS
|
|
|
|
g_pkg_name CONSTANT VARCHAR2(30) := 'bas_lookup_misc_pkg';
|
|
g_func_name VARCHAR2(30);
|
|
|
|
FUNCTION func_name RETURN VARCHAR2 IS
|
|
l_func_name VARCHAR2(100);
|
|
BEGIN
|
|
l_func_name := g_pkg_name || '.' || g_func_name;
|
|
RETURN l_func_name;
|
|
END;
|
|
END SAD.bas_lookup_misc_pkg;
|
|
/ </pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p05204167544"><strong id="EN-US_TOPIC_0000001188202588__b13517121312516">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen3372052161012">BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'bas_lookup_misc_pkg' )
|
|
,'B'
|
|
,UPPER( 'g_pkg_name' )
|
|
,UPPER( 'VARCHAR2(30)' )
|
|
,TRUE
|
|
,'bas_lookup_misc_pkg'
|
|
,FALSE ) ;
|
|
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'bas_lookup_misc_pkg' )
|
|
,'B'
|
|
,UPPER( 'g_func_name' )
|
|
,UPPER( 'VARCHAR2(30)' )
|
|
,FALSE
|
|
,NULL
|
|
,FALSE ) ;
|
|
|
|
END ;
|
|
/
|
|
--********************************************************************
|
|
CREATE
|
|
OR REPLACE FUNCTION bas_lookup_misc_pkg#func_name
|
|
RETURN VARCHAR2
|
|
PACKAGE
|
|
IS
|
|
l_func_name VARCHAR2 ( 100 ) ;
|
|
MIG_PV_VAL_DUMMY_G_PKG_NAME VARCHAR2 ( 30 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( CURRENT_SCHEMA() ,'bas_lookup_misc_pkg' ,'g_pkg_name' ) ::VARCHAR2 ( 30 ) ;
|
|
MIG_PV_VAL_DUMMY_G_FUNC_NAME VARCHAR2 ( 30 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( CURRENT_SCHEMA() ,'bas_lookup_misc_pkg' ,'g_func_name' ) ::VARCHAR2 ( 30 ) ;
|
|
|
|
BEGIN
|
|
l_func_name := MIG_PV_VAL_DUMMY_G_PKG_NAME || '.' || MIG_PV_VAL_DUMMY_G_FUNC_NAME ;
|
|
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( CURRENT_SCHEMA(),'bas_lookup_misc_pkg','g_pkg_name',MIG_PV_VAL_DUMMY_G_PKG_NAME ) ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( CURRENT_SCHEMA(),'bas_lookup_misc_pkg','g_func_name',MIG_PV_VAL_DUMMY_G_FUNC_NAME ) ;
|
|
|
|
RETURN l_func_name ;
|
|
|
|
|
|
END ;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p595463731718"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b168271053121813">Input : if pkgSchemaNaming is set to false, package variable</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1299193919539">The global variable is not correctly converted during packege conversion, and an error is reported during compilation. If the configuration parameter <strong id="EN-US_TOPIC_0000001188202588__b7144103316513">pkgSchemaNaming</strong> is set to <strong id="EN-US_TOPIC_0000001188202588__b171441338519">false</strong>, package variable migration is not happening properly in some places. This setting is not recommended by Kernel team. Please check with Kernel team.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen2514185519192">CREATE OR REPLACE PACKAGE BODY SAD.bas_dml_lookup_pkg IS
|
|
g_pkg_name CONSTANT VARCHAR2(30) := 'bas_dml_ic_price_rule_pkg' ;
|
|
g_func_name VARCHAR2 (100);
|
|
|
|
FUNCTION func_name
|
|
RETURN VARCHAR2
|
|
IS
|
|
l_func_name VARCHAR2(100) ;
|
|
BEGIN
|
|
l_func_name := g_pkg_name || '.' || g_func_name ;
|
|
RETURN l_func_name ;
|
|
|
|
END ;
|
|
|
|
END bas_dml_lookup_pkg ;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p247555610201"><strong id="EN-US_TOPIC_0000001188202588__b1922855715510">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen18948316142112">BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
USER_NAME, PACKAGE_NAME, SPEC_OR_BODY
|
|
, VARIABLE_NAME, VARIABLE_TYPE
|
|
, CONSTANT_I, DEFAULT_VALUE, RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( 'SAD', UPPER( 'bas_dml_lookup_pkg' ), 'B'
|
|
, UPPER( 'g_pkg_name' ), UPPER( 'VARCHAR2 ( 30 )' )
|
|
, TRUE, 'bas_dml_ic_price_rule_pkg', FALSE ) ;
|
|
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
USER_NAME, PACKAGE_NAME, SPEC_OR_BODY
|
|
, VARIABLE_NAME, VARIABLE_TYPE
|
|
, CONSTANT_I, DEFAULT_VALUE, RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( 'SAD', UPPER( 'bas_dml_lookup_pkg' ), 'B'
|
|
, UPPER( 'g_func_name' ), UPPER( 'VARCHAR2(100)' )
|
|
, FALSE, NULL, FALSE ) ;
|
|
|
|
END ;
|
|
/
|
|
|
|
CREATE OR REPLACE FUNCTION SAD.bas_dml_lookup_pkg#func_name
|
|
RETURN VARCHAR2
|
|
IS
|
|
MIG_PV_VAL_DUMMY_G_PKG_NAME VARCHAR2(30) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD', 'BAS_DML_LOOKUP_PKG', 'G_PKG_NAME' )::VARCHAR2(30) ;
|
|
MIG_PV_VAL_DUMMY_G_FUNC_NAME VARCHAR2(100) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD', 'BAS_DML_LOOKUP_PKG', 'G_FUNC_NAME' )::VARCHAR2(100) ;
|
|
l_func_name VARCHAR2(100) ;
|
|
BEGIN
|
|
l_func_name := MIG_PV_VAL_DUMMY_G_PKG_NAME || '.' || MIG_PV_VAL_DUMMY_G_FUNC_NAME ;
|
|
RETURN l_func_name ;
|
|
|
|
END ;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p2288183644520"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b15388171394613">Input: table field type definition in the (%type) table</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1068681554617">During packege conversion, the schema definition is not added to the table field type definition in the (%type) table. An error is reported during compilation.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen2368205617496">CREATE TABLE CTP_BRANCH
|
|
( ID VARCHAR2(10)
|
|
, NAME VARCHAR2(100)
|
|
, DESCRIPTION VARCHAR2(500)
|
|
);
|
|
|
|
CREATE OR REPLACE PACKAGE BODY SAD.bas_dml_lookup_pkg IS
|
|
g_pkg_name CONSTANT VARCHAR2(30) := 'bas_dml_ic_price_rule_pkg' ;
|
|
g_func_name CTP_BRANCH.NAME%TYPE;
|
|
|
|
FUNCTION func_name
|
|
RETURN VARCHAR2
|
|
IS
|
|
l_func_name VARCHAR2(100) ;
|
|
BEGIN
|
|
l_func_name := g_pkg_name || '.' || g_func_name ;
|
|
RETURN l_func_name ;
|
|
|
|
END ;
|
|
|
|
END bas_dml_lookup_pkg ;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1449762017109"><strong id="EN-US_TOPIC_0000001188202588__b686413101619">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen1629216564536">BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
USER_NAME, PACKAGE_NAME, SPEC_OR_BODY
|
|
, VARIABLE_NAME, VARIABLE_TYPE
|
|
, CONSTANT_I, DEFAULT_VALUE, RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( 'SAD', UPPER( 'bas_dml_lookup_pkg' ), 'B'
|
|
, UPPER( 'g_pkg_name' ), UPPER( 'VARCHAR2 ( 30 )' )
|
|
, TRUE, 'bas_dml_ic_price_rule_pkg', FALSE ) ;
|
|
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
USER_NAME, PACKAGE_NAME, SPEC_OR_BODY
|
|
, VARIABLE_NAME, VARIABLE_TYPE
|
|
, CONSTANT_I, DEFAULT_VALUE, RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( 'SAD', UPPER( 'bas_dml_lookup_pkg' ), 'B'
|
|
, UPPER( 'g_func_name' ), UPPER( 'VARCHAR2(100)' )
|
|
, FALSE, NULL, FALSE ) ;
|
|
|
|
END ;
|
|
/
|
|
CREATE OR REPLACE FUNCTION SAD.bas_dml_lookup_pkg#func_name
|
|
RETURN VARCHAR2
|
|
IS
|
|
MIG_PV_VAL_DUMMY_G_PKG_NAME VARCHAR2(30) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD', 'BAS_DML_LOOKUP_PKG', 'G_PKG_NAME' )::VARCHAR2(30) ;
|
|
MIG_PV_VAL_DUMMY_G_FUNC_NAME VARCHAR2(100) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD', 'BAS_DML_LOOKUP_PKG', 'G_FUNC_NAME' )::VARCHAR2(100) ;
|
|
l_func_name VARCHAR2(100) ;
|
|
BEGIN
|
|
l_func_name := MIG_PV_VAL_DUMMY_G_PKG_NAME || '.' || MIG_PV_VAL_DUMMY_G_FUNC_NAME ;
|
|
RETURN l_func_name ;
|
|
|
|
END ;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p674582155018"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_b43292482619">EXCEPTION</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p662281655010">Package variables can be declared as EXCEPTION, which is not supported in GaussDB.</p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p6396132619467"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b13221833204614">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen93833911467">CREATE OR REPLACE PACKAGE BODY product_pkg IS
|
|
|
|
ex_prog_error EXCEPTION;
|
|
|
|
PROCEDURE assert_null(pi_value IN VARCHAR2) IS
|
|
BEGIN
|
|
IF pi_value IS NOT NULL
|
|
THEN
|
|
RAISE ex_prog_error;
|
|
END IF;
|
|
EXCEPTION
|
|
WHEN ex_prog_error THEN
|
|
RAISE ex_prog_error;
|
|
|
|
END assert_null;
|
|
END product_pkg;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p3616111019465"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b36441459114617">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen155320444710">CREATE OR replace PROCEDURE product_pkg.Assert_null (pi_value IN VARCHAR2)
|
|
IS
|
|
ex_prog_error EXCEPTION;
|
|
BEGIN
|
|
IF pi_value IS NOT NULL THEN
|
|
RAISE ex_prog_error;
|
|
END IF;
|
|
EXCEPTION
|
|
WHEN ex_prog_error THEN
|
|
RAISE ex_prog_error;
|
|
END;
|
|
|
|
/ </pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p14942131019466"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b26941752171117">Default Value</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p996318554119">function is specified as a default value for a package variable.</p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p769852581218"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b10713133114122">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen841652116123">BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'PKG_REVN_ARPU' )
|
|
,'B'
|
|
,UPPER( 'imodel' )
|
|
,UPPER( 'log_table.ds_exec%TYPE' )
|
|
,FALSE
|
|
,pkg_etl.proc_set_chain ( 'DAILY ARPU' )
|
|
,FALSE ) ;
|
|
|
|
END ;
|
|
/
|
|
gSQL:PKG_REVN_ARPU_04.SQL:23: ERROR: function pkg_etl.proc_set_chain(unknown) does not exist
|
|
LINE 15: ,pkg_etl.proc_set_chain ( 'DAILY ARPU' )
|
|
^
|
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
|
|
|
|
|
|
|
CREATE OR REPLACE PACKAGE BODY IC_STAGE.PKG_REVN_ARPU
|
|
AS
|
|
imodel log_table.ds_exec%TYPE := pkg_etl.proc_set_chain ('DAILY ARPU');
|
|
PROCEDURE AGGR_X_AGG00_REVN_DEALER (p_date PLS_INTEGER,
|
|
p_days PLS_INTEGER)
|
|
AS
|
|
v_start_date PLS_INTEGER;
|
|
v_curr_date PLS_INTEGER;
|
|
v_imodel VARCHAR2(100);
|
|
BEGIN
|
|
pkg_etl.proc_start (p_date, 'AGGR_X_AGG00_REVN_DEALER ');
|
|
|
|
v_start_date :=
|
|
TO_CHAR (TO_DATE (p_date, 'yyyymmdd') - (p_days - 1), 'yyyymmdd');
|
|
v_curr_date := p_date;
|
|
v_imodel := imodel;
|
|
|
|
END;
|
|
END PKG_REVN_ARPU;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p13241967479"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b652812530131">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen1238835715139">SET
|
|
package_name_list = 'PKG_REVN_ARPU' ;
|
|
|
|
BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'PKG_REVN_ARPU' )
|
|
,'B'
|
|
,UPPER( 'imodel' )
|
|
,UPPER( 'log_table.ds_exec%TYPE' )
|
|
,FALSE
|
|
,$q$pkg_etl.proc_set_chain ('DAILY ARPU')$q$
|
|
,TRUE ) ;
|
|
|
|
END ;
|
|
/
|
|
CREATE
|
|
OR REPLACE PROCEDURE PKG_REVN_ARPU.AGGR_X_AGG00_REVN_DEALER ( p_date INTEGER
|
|
,p_days INTEGER )
|
|
AS
|
|
MIG_PV_VAL_DUMMY_IMODEL log_table.ds_exec%TYPE := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( CURRENT_USER,'PKG_REVN_ARPU','imodel' ) ::log_table.ds_exec%TYPE ;
|
|
v_start_date INTEGER ;
|
|
v_curr_date INTEGER ;
|
|
v_imodel VARCHAR2 ( 100 ) ;
|
|
|
|
BEGIN
|
|
pkg_etl.proc_start ( p_date ,'AGGR_X_AGG00_REVN_DEALER ' ) ;
|
|
v_start_date := TO_CHAR( TO_DATE( p_date ,'yyyymmdd' ) - ( p_days - 1 ),'yyyymmdd' ) ;
|
|
v_curr_date := p_date ;
|
|
v_imodel := MIG_PV_VAL_DUMMY_IMODEL ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( CURRENT_USER,'PKG_REVN_ARPU','imodel',MIG_PV_VAL_DUMMY_IMODEL ) ;
|
|
|
|
END ;
|
|
/
|
|
reset package_name_list ;
|
|
</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p65751240181317"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_b1912424272820">PLS_INTEGER</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p416912285313">A PLS_INTEGER datatype is not converted into INTEGER for package variables but it is working fine for other local variables. Therefore, it should be converted to INTEGER, such as, varaible1 PLS_INTEGER ==> varaible1 INTEGER</p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p94641537122916">SCRIPTS: SAD_CALC_BPART_PRICE_PKG.sql, SAD_CALC_ITEM_PKG_TEST_OB.sql, SAD_CALC_ITEM_PRICE_TEST_OB.sql, SAD_CALC_ITEM_PRI_TEST_OB.sql, SAD_CALC_ITEM_TEST_OB.sql</p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p104641037172915">INPUT :</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen107884162519">CREATE OR REPLACE PACKAGE BODY "SAD"."SAD_CALC_BPART_PRICE_PKG" IS
|
|
g_max_number_of_entities PLS_INTEGER := 100;
|
|
FUNCTION split_warning(pi_contract_number IN VARCHAR2,
|
|
pi_stage_id IN NUMBER,
|
|
pi_quotation_id IN NUMBER,
|
|
pi_cfg_instance_id IN NUMBER) RETURN VARCHAR2 IS
|
|
BEGIN
|
|
---
|
|
l_item_list := items_no_cost(pi_contract_number => pi_contract_number,
|
|
pi_stage_id => pi_stage_id,
|
|
pi_quotation_id => pi_quotation_id,
|
|
pi_cfg_instance_id => pi_cfg_instance_id,
|
|
pi_max_number_of_entities => g_max_number_of_entities,
|
|
pi_sep_char => g_item_sep_char,
|
|
po_error_msg => po_error_msg);
|
|
---
|
|
END split_warning;
|
|
END SAD_CALC_BPART_PRICE_PKG;</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p3465123710297">OUTPUT :</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen8843193610254">BEGIN
|
|
---
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'SAD_CALC_BPART_PRICE_PKG' )
|
|
,'B'
|
|
,UPPER( 'g_max_number_of_entities' )
|
|
,UPPER( 'PLS_INTEGER' )
|
|
,FALSE
|
|
,100
|
|
,FALSE ) ;
|
|
---
|
|
END;
|
|
/
|
|
CREATE
|
|
OR REPLACE FUNCTION SAD.SAD_CALC_BPART_PRICE_PKG#split_warning ( pi_contract_number IN VARCHAR2
|
|
,pi_stage_id IN NUMBER
|
|
,pi_quotation_id IN NUMBER
|
|
,pi_cfg_instance_id IN NUMBER )
|
|
RETURN VARCHAR2 IS
|
|
---
|
|
MIG_PV_VAL_DUMMY_G_MAX_NUMBER_OF_ENTITIES PLS_INTEGER := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( current_schema ( )
|
|
,'SAD_CALC_BPART_PRICE_PKG'
|
|
,'g_max_number_of_entities' ) ::PLS_INTEGER ;
|
|
---
|
|
l_item_list := SAD.SAD_CALC_BPART_PRICE_PKG#items_no_cost ( pi_contract_number => pi_contract_number ,
|
|
pi_stage_id => pi_stage_id ,
|
|
pi_quotation_id => pi_quotation_id ,
|
|
pi_cfg_instance_id => pi_cfg_instance_id ,
|
|
pi_max_number_of_entities => MIG_PV_VAL_DUMMY_G_MAX_NUMBER_OF_ENTITIES ,
|
|
pi_sep_char => MIG_PV_VAL_DUMMY_G_ITEM_SEP_CHAR ,
|
|
po_error_msg => po_error_msg ) ;
|
|
---
|
|
END;</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p13121154814298"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b2531708301">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen836819512315">PLS_INTEGER datatype not converted into INTEGER for package variables but it's working fine for other local variables therefore for package variables also PLS_INTEGER should be converted to INTEGER datatype i.e varaible1 PLS_INTEGER ==> varaible1 INTEGER
|
|
|
|
SCRIPTS : SAD_CALC_BPART_PRICE_PKG.SQL, SAD_CALC_ITEM_PKG_TEST_OB.SQL, SAD_CALC_ITEM_PRICE_TEST_OB.SQL, SAD_CALC_ITEM_PRI_TEST_OB.SQL, SAD_CALC_ITEM_TEST_OB.SQL
|
|
|
|
INPUT :
|
|
|
|
CREATE OR REPLACE PACKAGE BODY "SAD"."SAD_CALC_BPART_PRICE_PKG" IS
|
|
|
|
g_max_number_of_entities PLS_INTEGER := 100;
|
|
|
|
FUNCTION split_warning(pi_contract_number IN VARCHAR2,
|
|
pi_stage_id IN NUMBER,
|
|
pi_quotation_id IN NUMBER,
|
|
pi_cfg_instance_id IN NUMBER) RETURN VARCHAR2 IS
|
|
|
|
BEGIN
|
|
---
|
|
|
|
l_item_list := items_no_cost(pi_contract_number => pi_contract_number,
|
|
pi_stage_id => pi_stage_id,
|
|
pi_quotation_id => pi_quotation_id,
|
|
pi_cfg_instance_id => pi_cfg_instance_id,
|
|
pi_max_number_of_entities => g_max_number_of_entities,
|
|
pi_sep_char => g_item_sep_char,
|
|
po_error_msg => po_error_msg);
|
|
|
|
---
|
|
|
|
END split_warning;
|
|
|
|
END SAD_CALC_BPART_PRICE_PKG;
|
|
|
|
|
|
OUTPUT :
|
|
|
|
BEGIN
|
|
|
|
---
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES (
|
|
PACKAGE_NAME
|
|
,SPEC_OR_BODY
|
|
,VARIABLE_NAME
|
|
,VARIABLE_TYPE
|
|
,CONSTANT_I
|
|
,DEFAULT_VALUE
|
|
,RUNTIME_EXEC_I
|
|
)
|
|
VALUES ( UPPER( 'SAD_CALC_BPART_PRICE_PKG' )
|
|
,'B'
|
|
,UPPER( 'g_max_number_of_entities' )
|
|
,UPPER( 'PLS_INTEGER' )
|
|
,FALSE
|
|
,100
|
|
,FALSE ) ;
|
|
---
|
|
|
|
END;
|
|
/
|
|
|
|
CREATE
|
|
OR REPLACE FUNCTION SAD.SAD_CALC_BPART_PRICE_PKG#split_warning ( pi_contract_number IN VARCHAR2
|
|
,pi_stage_id IN NUMBER
|
|
,pi_quotation_id IN NUMBER
|
|
,pi_cfg_instance_id IN NUMBER )
|
|
RETURN VARCHAR2 IS
|
|
|
|
---
|
|
|
|
MIG_PV_VAL_DUMMY_G_MAX_NUMBER_OF_ENTITIES PLS_INTEGER := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( current_schema ( )
|
|
,'SAD_CALC_BPART_PRICE_PKG'
|
|
,'g_max_number_of_entities' ) ::PLS_INTEGER ;
|
|
|
|
---
|
|
|
|
l_item_list := SAD.SAD_CALC_BPART_PRICE_PKG#items_no_cost ( pi_contract_number => pi_contract_number ,
|
|
pi_stage_id => pi_stage_id ,
|
|
pi_quotation_id => pi_quotation_id ,
|
|
pi_cfg_instance_id => pi_cfg_instance_id ,
|
|
pi_max_number_of_entities => MIG_PV_VAL_DUMMY_G_MAX_NUMBER_OF_ENTITIES ,
|
|
pi_sep_char => MIG_PV_VAL_DUMMY_G_ITEM_SEP_CHAR ,
|
|
po_error_msg => po_error_msg ) ;
|
|
---
|
|
|
|
END;</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p530113622816"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b523818918325">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen27701819153210">BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES
|
|
( PACKAGE_NAME, SPEC_OR_BODY, VARIABLE_NAME
|
|
, VARIABLE_TYPE, CONSTANT_I, DEFAULT_VALUE
|
|
, RUNTIME_EXEC_I )
|
|
VALUES ( UPPER('SAD_CALC_BPART_PRICE_PKG')
|
|
, 'B', UPPER( 'g_max_number_of_entities' )
|
|
, UPPER( 'INTEGER' ),FALSE,100
|
|
, FALSE ) ;
|
|
END ;
|
|
/
|
|
|
|
CREATE OR REPLACE FUNCTION SAD.SAD_CALC_BPART_PRICE_PKG#split_warning
|
|
( pi_contract_number IN VARCHAR2
|
|
, pi_stage_id IN NUMBER )
|
|
RETURN VARCHAR2
|
|
PACKAGE
|
|
IS
|
|
MIG_PV_VAL_DUMMY_G_MAX_NUMBER_OF_ENTITIES INTEGER := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE('SAD', 'SAD_CALC_BPART_PRICE_PKG', 'g_max_number_of_entities') ::INTEGER ;
|
|
po_error_msg sad_products_t.exception_description%TYPE ;
|
|
|
|
BEGIN
|
|
l_item_list := items_no_cost ( pi_contract_number => pi_contract_number ,pi_stage_id => pi_stage_id
|
|
, pi_max_number_of_entities => MIG_PV_VAL_DUMMY_G_MAX_NUMBER_OF_ENTITIES
|
|
, po_error_msg => po_error_msg ) ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ('SAD' ,'SAD_CALC_BPART_PRICE_PKG' ,'g_max_number_of_entities' ,MIG_PV_VAL_DUMMY_G_MAX_NUMBER_OF_ENTITIES);
|
|
|
|
RETURN po_error_msg ;
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
po_error_msg := 'Program Others abnormal, Fail to obtain the warning information.' || SQLERRM ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD' ,'SAD_CALC_BPART_PRICE_PKG' ,'g_max_number_of_entities' ,MIG_PV_VAL_DUMMY_G_MAX_NUMBER_OF_ENTITIES ) ;
|
|
|
|
RETURN po_error_msg ;
|
|
|
|
END ;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p17910848173113"><strong id="EN-US_TOPIC_0000001188202588__b813813145718">Cursor With Package Variable</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p2061222624914">The cursor declared in SAD.sad_calc_product_price_pkg#calc_product_price contains package variables and needs to be handled.</p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p074011597472"><strong id="EN-US_TOPIC_0000001188202588__b15683401778">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen83892974816">CREATE OR REPLACE PACKAGE SAD.bas_subtype_pkg IS
|
|
g_header_waiting_split_status CONSTANT VARCHAR2(20) := 'Waiting_Distribute';
|
|
SUBTYPE error_msg IS sad_products_t.exception_description%TYPE;
|
|
END bas_subtype_pkg;
|
|
/
|
|
|
|
CREATE OR REPLACE PACKAGE BODY SAD.sad_calc_product_price_pkg IS
|
|
PROCEDURE calc_product_price(pi_contract_no IN VARCHAR2 DEFAULT NULL,
|
|
pi_stage_id IN NUMBER DEFAULT NULL,
|
|
po_error_msg OUT VARCHAR2) IS
|
|
CURSOR cur_contract IS
|
|
SELECT DISTINCT sdh.contract_number, sdh.stage_id
|
|
FROM sad_distribution_headers_t sdh
|
|
WHERE sdh.status = bas_subtype_pkg.g_header_waiting_split_status
|
|
AND sdh.contract_number = nvl(pi_contract_no, sdh.contract_number)
|
|
AND sdh.stage_id = nvl(pi_stage_id, sdh.stage_id);
|
|
|
|
lv_error_msg bas_subtype_pkg.error_msg;
|
|
BEGIN
|
|
FOR rec_contract IN cur_contract
|
|
LOOP
|
|
|
|
validate_process_status(rec_contract.contract_number,
|
|
rec_contract.stage_id,
|
|
lv_error_msg);
|
|
END LOOP;
|
|
|
|
po_error_msg := lv_error_msg;
|
|
END calc_product_price;
|
|
|
|
END sad_calc_product_price_pkg;
|
|
/
|
|
</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p0990204943112"><strong id="EN-US_TOPIC_0000001188202588__b178811015597">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen12787202219506">BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES
|
|
( PACKAGE_NAME,SPEC_OR_BODY,VARIABLE_NAME
|
|
, VARIABLE_TYPE,CONSTANT_I,DEFAULT_VALUE
|
|
, RUNTIME_EXEC_I )
|
|
VALUES ( UPPER('bas_subtype_pkg'), 'S', UPPER('g_header_waiting_split_status')
|
|
, UPPER( 'VARCHAR2(20)' ), TRUE, 'Waiting_Distribute'
|
|
, FALSE ) ;
|
|
END ;
|
|
/
|
|
|
|
CREATE OR REPLACE PROCEDURE SAD.sad_calc_product_price_pkg#calc_product_price
|
|
( pi_contract_no IN VARCHAR2 DEFAULT NULL
|
|
, pi_stage_id IN NUMBER DEFAULT NULL
|
|
, po_error_msg OUT VARCHAR2 )
|
|
PACKAGE
|
|
IS
|
|
MIG_PV_VAL_DUMMY_G_HEADER_WAITING_SPLIT_STATUS VARCHAR2 ( 20 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_subtype_pkg'
|
|
,'g_header_waiting_split_status' ) ::VARCHAR2 ( 20 ) ;
|
|
|
|
CURSOR cur_contract IS
|
|
SELECT DISTINCT sdh.contract_number, sdh.stage_id
|
|
FROM sad_distribution_headers_t sdh
|
|
WHERE sdh.status = MIG_PV_VAL_DUMMY_G_HEADER_WAITING_SPLIT_STATUS
|
|
AND sdh.contract_number = nvl( pi_contract_no ,sdh.contract_number )
|
|
AND sdh.stage_id = nvl( pi_stage_id ,sdh.stage_id ) ;
|
|
|
|
lv_error_msg sad_products_t.exception_description%TYPE ;
|
|
BEGIN
|
|
FOR rec_contract IN cur_contract
|
|
LOOP
|
|
validate_process_status ( rec_contract.contract_number ,rec_contract.stage_id ,lv_error_msg ) ;
|
|
|
|
END LOOP ;
|
|
po_error_msg := lv_error_msg ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD' ,'bas_subtype_pkg' ,'g_header_waiting_split_status' ,MIG_PV_VAL_DUMMY_G_HEADER_WAITING_SPLIT_STATUS ) ;
|
|
|
|
END ;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p764818242312"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b41413445318">SET VARIABLE function after the RETURN</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1092154511310">SET VARIABLE function should be called before the RETURN statements in the procedure and function.</p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p84201564314"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b15182141115412">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen12102121543">CREATE OR REPLACE PACKAGE BODY SAD.bas_dml_lookup_pkg IS
|
|
g_pkg_name CONSTANT VARCHAR2(30) := 'bas_dml_lookup_pkg' ;
|
|
g_func_name VARCHAR2(100);
|
|
|
|
FUNCTION func_name
|
|
RETURN VARCHAR2
|
|
IS
|
|
l_func_name VARCHAR2(100) ;
|
|
BEGIN
|
|
g_func_name := 'func_name';
|
|
l_func_name := g_pkg_name || '.' || g_func_name ;
|
|
RETURN l_func_name ;
|
|
|
|
END;
|
|
|
|
PROCEDURE data_change_logs ( pi_table_name IN VARCHAR2
|
|
, pi_table_key_columns IN VARCHAR2
|
|
, po_error_msg OUT VARCHAR2
|
|
)
|
|
IS
|
|
BEGIN
|
|
g_func_name := 'data_change_logs';
|
|
|
|
IF pi_table_name IS NULL
|
|
THEN
|
|
RETURN;
|
|
END IF;
|
|
|
|
INSERT INTO fnd_data_change_logs_t
|
|
( logid, table_name, table_key_columns )
|
|
VALUES
|
|
( fnd_data_change_logs_t_s.NEXTVAL
|
|
, pi_table_name, pi_table_key_columns );
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
po_error_msg := 'Others Exception raise in ' || func_name || ',' || SQLERRM;
|
|
END data_change_logs;
|
|
|
|
END bas_dml_lookup_pkg;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p108871241333"><strong id="EN-US_TOPIC_0000001188202588__b1379241887">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen145897541542">BEGIN
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES
|
|
( PACKAGE_NAME,SPEC_OR_BODY,VARIABLE_NAME
|
|
, VARIABLE_TYPE,CONSTANT_I,DEFAULT_VALUE
|
|
, RUNTIME_EXEC_I )
|
|
VALUES ( UPPER('bas_dml_lookup_pkg'), 'B', UPPER('g_pkg_name')
|
|
, UPPER( 'VARCHAR2(30)' ), TRUE, 'bas_dml_lookup_pkg'
|
|
, FALSE ) ;
|
|
|
|
INSERT INTO MIG_ORA_EXT.MIG_PKG_VARIABLES
|
|
( PACKAGE_NAME,SPEC_OR_BODY,VARIABLE_NAME
|
|
, VARIABLE_TYPE,CONSTANT_I,DEFAULT_VALUE
|
|
, RUNTIME_EXEC_I )
|
|
VALUES ( UPPER('bas_dml_lookup_pkg'), 'B', UPPER('g_func_name')
|
|
, UPPER( 'VARCHAR2(100)' ), FALSE, NULL, FALSE ) ;
|
|
|
|
END ;
|
|
/
|
|
CREATE OR REPLACE FUNCTION SAD.bas_dml_lookup_pkg#func_name
|
|
RETURN VARCHAR2
|
|
PACKAGE
|
|
IS
|
|
MIG_PV_VAL_DUMMY_G_PKG_NAME VARCHAR2 ( 30 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_dml_lookup_pkg' ,'g_pkg_name' ) ::VARCHAR2 ( 30 ) ;
|
|
MIG_PV_VAL_DUMMY_G_FUNC_NAME VARCHAR2 ( 100 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_dml_lookup_pkg' ,'g_func_name' ) ::VARCHAR2 ( 100 ) ;
|
|
l_func_name VARCHAR2 ( 100 ) ;
|
|
|
|
BEGIN
|
|
MIG_PV_VAL_DUMMY_G_FUNC_NAME := 'func_name' ;
|
|
l_func_name := MIG_PV_VAL_DUMMY_G_PKG_NAME || '.' || MIG_PV_VAL_DUMMY_G_FUNC_NAME ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD' ,'bas_dml_lookup_pkg' ,'g_func_name' ,MIG_PV_VAL_DUMMY_G_FUNC_NAME ) ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD' ,'bas_dml_lookup_pkg' ,'g_pkg_name' ,MIG_PV_VAL_DUMMY_G_PKG_NAME ) ;
|
|
|
|
RETURN l_func_name ;
|
|
END ;
|
|
/
|
|
|
|
CREATE OR REPLACE PROCEDURE SAD.bas_dml_lookup_pkg#data_change_logs
|
|
( pi_table_name IN VARCHAR2
|
|
, pi_table_key_columns IN VARCHAR2
|
|
, po_error_msg OUT VARCHAR2 )
|
|
PACKAGE
|
|
IS
|
|
MIG_PV_VAL_DUMMY_G_FUNC_NAME VARCHAR2 ( 100 ) := MIG_ORA_EXT.MIG_FN_GET_PKG_VARIABLE ( 'SAD' ,'bas_dml_lookup_pkg' ,'g_func_name' ) ::VARCHAR2 ( 100 ) ;
|
|
BEGIN
|
|
MIG_PV_VAL_DUMMY_G_FUNC_NAME := 'data_change_logs' ;
|
|
|
|
IF pi_table_name IS NULL THEN
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD' ,'bas_dml_lookup_pkg' ,'g_func_name' ,MIG_PV_VAL_DUMMY_G_FUNC_NAME ) ;
|
|
RETURN ;
|
|
END IF ;
|
|
|
|
INSERT INTO fnd_data_change_logs_t ( logid, table_name, table_key_columns )
|
|
VALUES ( NEXTVAL ( 'fnd_data_change_logs_t_s' ), pi_table_name, pi_table_key_columns ) ;
|
|
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD' ,'bas_dml_lookup_pkg' ,'g_func_name' ,MIG_PV_VAL_DUMMY_G_FUNC_NAME ) ;
|
|
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
po_error_msg := 'Others Exception raise in ' || SAD.bas_dml_lookup_pkg#func_name ( ) || ',' || SQLERRM ;
|
|
MIG_ORA_EXT.MIG_FN_SET_PKG_VARIABLE ( 'SAD' ,'bas_dml_lookup_pkg' ,'g_func_name' ,MIG_PV_VAL_DUMMY_G_FUNC_NAME ) ;
|
|
END ;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1560918501443"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b1277915811715">Empty Package</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1353110277">Empty package bodies do not need to be migrated.</p>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p1217162916714"><strong id="EN-US_TOPIC_0000001188202588__en-us_topic_0237712554_b041613351171">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_screen112991445777">CREATE OR REPLACE PACKAGE BODY SAD.bas_subtype_pkg IS
|
|
BEGIN
|
|
NULL;
|
|
END bas_subtype_pkg;
|
|
/</pre>
|
|
<p id="EN-US_TOPIC_0000001188202588__en-us_topic_0238518406_en-us_topic_0237362216_en-us_topic_0202727159_p732673717716">Output will be an empty file.</p>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_mt_0156.html">PL/SQL Packages</a></div>
|
|
</div>
|
|
</div>
|
|
|