forked from laiweijian4/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>
307 lines
25 KiB
HTML
307 lines
25 KiB
HTML
<a name="EN-US_TOPIC_0000001234042085"></a><a name="EN-US_TOPIC_0000001234042085"></a>
|
||
|
||
<h1 class="topictitle1">PL/SQL Collections (Using User-Defined Types)</h1>
|
||
<div id="body8662426"><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p9667843201916">This section descripes the migration syntax of Oracle PL/SQL Collections. The migration syntax decides how the keywords/features are migrated.</p>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p12168114014437">A user-defined type (UDT) is a data type that is derived from a supported data type.</p>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p159998391430">UDT uses built-in datatypes and other user-defined datatypes as the building blocks for datatypes that model the structure and behavior of data in applications. UDT makes it easier to work with PL/SQL collections.</p>
|
||
<div class="section" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_section3228184284319"><h4 class="sectiontitle">UDT Table</h4><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p247619523163">The table type is created to track the structure of the UDT. No data will be stored in the table.</p>
|
||
</div>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p6137193510573"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b59292012135414">Input - CREATE TABLE TYPE</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen313816353577">CREATE <OR REPLACE> TYPE <schema.>inst_no_type IS TABLE OF VARCHAR2 (32767);</pre>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p15151335105717"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b2388141705416">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen915373512573">CREATE TABLE<schema.>mig_inst_no_type
|
||
( typ_col VARCHAR2 (32767) );</pre>
|
||
<div class="section" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_section7892439174418"><h4 class="sectiontitle">UDT VArray</h4><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p13221855111613"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b7969182119542">Input - CREATE VArray</strong></p>
|
||
</div>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen136057169197">CREATE TYPE phone_list_typ_demo AS VARRAY(n) OF VARCHAR2(25);</pre>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1660519161199"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b2997123185418">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen460617166199">CREATE TABLE mig_pone_list_typ_demo
|
||
( typ_col VARCHAR2 (25) );</pre>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1330371592110"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b12393102632111">Declare UDT</strong></p>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1430451572119"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b1492112813545">Input - Declare UDT</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen2030417154215">DECLARE
|
||
v_SQL_txt_array
|
||
inst_no_type <:=
|
||
inst_no_type()>;
|
||
BEGIN
|
||
…</pre>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p19305171572112"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b1475552917545">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen1130510156219">DECLARE
|
||
/* v_SQL_txt_array inst_no_type <:= inst_no_type()>; */
|
||
BEGIN
|
||
EXECUTE IMMEDIATE 'DROP TABLE IF EXISTS
|
||
v_SQL_txt_array;
|
||
CREATE LOCAL TEMPORARY TABLE
|
||
v_SQL_txt_array
|
||
ON COMMIT PRESERVE ROWS
|
||
AS SELECT *, CAST(NULL AS INT) AS
|
||
typ_idx_col
|
||
FROM mig_inst_no_type
|
||
WHERE FALSE';
|
||
…</pre>
|
||
<div class="section" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_section188574615452"><h4 class="sectiontitle">UDT Count</h4><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p971291191714"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b17630193519545">Input - UDT - COUNT in FOR LOOP</strong></p>
|
||
</div>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen13506135814221">BEGIN
|
||
...
|
||
FOR i IN 1..v_jobnum_list.COUNT
|
||
LOOP
|
||
SELECT COUNT(*) INTO v_abc
|
||
FROM ...
|
||
WHERE ...
|
||
AND nvl(t.batch_num,
|
||
c_batchnum_null_num) =
|
||
v_jobnum_list(i);
|
||
...
|
||
END LOOP;
|
||
... </pre>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p950855813225"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b14895441185412">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen3509205813222">BEGIN
|
||
...
|
||
FOR i IN 1..(SELECT COUNT(*) from v_jobnum_list)
|
||
LOOP
|
||
SELECT COUNT(*) INTO v_abc
|
||
FROM ...
|
||
WHERE ...
|
||
AND nvl(t.batch_num, c_batchnum_null_num) =
|
||
(SELECT typ_col FROM v_jobnum_list
|
||
WHERE typ_idx_col = i);
|
||
...
|
||
END LOOP;
|
||
... </pre>
|
||
<div class="section" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_section1942452104615"><h4 class="sectiontitle">UDT Record</h4><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p557586111710">A Record type is used to create records and can be defined in the declarative part of any PL/SQL block, subprogram, or package.</p>
|
||
</div>
|
||
<div class="p" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1455914110383"><strong id="EN-US_TOPIC_0000001234042085__b19869143935316">Input - RECORD Type</strong><pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen19994115633116">Create
|
||
or Replace Procedure test_proc AS TYPE t_log IS RECORD ( col1 int ,col2 emp.ename % type ) ;
|
||
fr_wh_SQL t_log ;
|
||
BEGIN
|
||
fr_wh_SQL.col1 := 101 ;
|
||
fr_wh_SQL.col2 := 'abcd' ;
|
||
DBMS_OUTPUT.PUT_LINE ( fr_wh_SQL.col1 || ',' || fr_wh_SQL.col2 ) ;
|
||
END test_proc;
|
||
/</pre>
|
||
</div>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1599765611310"><strong id="EN-US_TOPIC_0000001234042085__b315882551">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen89994565317">Create
|
||
or Replace Procedure test_proc AS /*TYPE t_log IS RECORD ( col1 int,col2 emp.ename%type );*/
|
||
fr_wh_SQL RECORD ;
|
||
MIG_t_log_col1 int ;
|
||
MIG_t_log_col2 emp.ename % type ;
|
||
BEGIN
|
||
select
|
||
MIG_t_log_col1 as col1 ,MIG_t_log_col2 as col2 INTO FR_WH_SQL ;
|
||
fr_wh_SQL.col1 := 101 ;
|
||
fr_wh_SQL.col2 := 'abcd' ;
|
||
DBMS_OUTPUT.PUT_LINE ( fr_wh_SQL.col1 || ',' || fr_wh_SQL.col2 ) ;
|
||
END ;
|
||
/</pre>
|
||
<div class="section" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_section622916453467"><h4 class="sectiontitle">Enhancement of User-defined types</h4><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1895995172">The tool supports the enhancement of PL/SQL type of TABLE used in Oracle for specific data types and for any table column.</p>
|
||
</div>
|
||
<div class="p" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p162471567386"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b12676134905416">Input - PL/SQL type of TABLE of a specific data-type</strong><pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen16846018154711">DECLARE
|
||
type fr_wh_SQL_info_type is table of VARCHAR(10);
|
||
fr_wh_SQL fr_wh_SQL_info_type [:= fr_wh_SQL_info_type()];
|
||
BEGIN
|
||
…</pre>
|
||
</div>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p20852018104718"><strong id="EN-US_TOPIC_0000001234042085__b795847966">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen9853191818472">DECLARE
|
||
/* type fr_wh_SQL_info_type is table of varchar(10); */
|
||
/* fr_wh_SQL fr_wh_SQL_info_type [:= fr_wh_SQL_info_type()]; */
|
||
BEGIN
|
||
EXECUTE IMMEDIATE 'DROP TABLE IF EXISTS mig_fr_wh_SQL_info_type;
|
||
CREATE LOCAL TEMPORARY TABLE mig_fr_wh_SQL_info_type
|
||
( typ_col VARCHAR (10) )
|
||
ON COMMIT PRESERVE ROWS' ;
|
||
|
||
EXECUTE IMMEDIATE 'DROP TABLE IF EXISTS fr_wh_SQL;
|
||
CREATE LOCAL TEMPORARY TABLE fr_wh_SQL
|
||
ON COMMIT PRESERVE ROWS AS
|
||
AS SELECT *, CAST(NULL AS INT) AS typ_idx_col
|
||
FROM mig_fr_wh_SQL_info_type
|
||
WHERE FALSE';
|
||
…
|
||
</pre>
|
||
<div class="p" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1586319584389"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b6273125620541">Input - PL/SQL type of TABLE of any table's column</strong><pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen553419509496">DECLARE
|
||
type fr_wh_SQL_info_type is table of fr_wh_SQL_info.col1%type;
|
||
fr_wh_SQL fr_wh_SQL_info_type [:= fr_wh_SQL_info_type()];
|
||
BEGIN
|
||
…</pre>
|
||
</div>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p17539145014910"><strong id="EN-US_TOPIC_0000001234042085__b482987806">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen145401450204917">DECLARE
|
||
/* type fr_wh_SQL_info_type is table of fr_wh_SQL_info.col1%type; */
|
||
/* fr_wh_SQL fr_wh_SQL_info_type [:= fr_wh_SQL_info_type()]; */
|
||
BEGIN
|
||
EXECUTE IMMEDIATE 'DROP TABLE IF EXISTS mig_fr_wh_SQL_info_type;
|
||
CREATE LOCAL TEMPORARY TABLE mig_fr_wh_SQL_info_type
|
||
ON COMMIT PRESERVE ROWS
|
||
AS SELECT col1 AS typ_col
|
||
FROM fr_wh_SQL_info
|
||
WHERE FALSE' ;
|
||
|
||
EXECUTE IMMEDIATE 'DROP TABLE IF EXISTS fr_wh_SQL;
|
||
CREATE LOCAL TEMPORARY TABLE fr_wh_SQL
|
||
ON COMMIT PRESERVE ROWS AS
|
||
AS SELECT *, CAST(NULL AS INT) AS typ_idx_col
|
||
FROM mig_fr_wh_SQL_info_type
|
||
WHERE FALSE';
|
||
…</pre>
|
||
<div class="section" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_section1355312910158"><h4 class="sectiontitle">EXTEND</h4><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p18571134471512">GaussDB supports keyword EXTEND.</p>
|
||
<div class="p" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p0345353398"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b563127111410">Input - Extend</strong><pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen748995918169">FUNCTION FUNC_EXTEND ( in_str IN VARCHAR2)
|
||
RETURN ARRYTYPE
|
||
AS
|
||
v_count2 INTEGER;
|
||
v_strlist arrytype;
|
||
v_node VARCHAR2 (2000);
|
||
BEGIN
|
||
v_count2 := 0;
|
||
v_strlist := arrytype ();
|
||
FOR v_i IN 1 .. LENGTH (in_str)
|
||
LOOP
|
||
IF v_node IS NULL
|
||
THEN
|
||
v_node := '';
|
||
END IF;
|
||
|
||
IF (v_count2 = 0) OR (v_count2 IS NULL)
|
||
THEN
|
||
EXIT;
|
||
ELSE
|
||
v_strlist.EXTEND ();
|
||
v_strlist (v_i) := v_node;
|
||
v_node := '';
|
||
END IF;
|
||
END LOOP;
|
||
|
||
RETURN v_strlist;
|
||
END;
|
||
/</pre>
|
||
</div>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p7573174441515"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b1163277101413">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen134331417191711">FUNCTION FUNC_EXTEND ( in_str IN VARCHAR2 )
|
||
RETURN ARRYTYPE AS v_count2 INTEGER ;
|
||
v_strlist arrytype ;
|
||
v_node VARCHAR2 ( 2000 ) ;
|
||
BEGIN
|
||
v_count2 := 0 ;
|
||
v_strlist := arrytype ( ) ;
|
||
FOR v_i IN 1.. LENGTH( in_str ) LOOP
|
||
IF
|
||
v_node IS NULL
|
||
THEN
|
||
v_node := '' ;
|
||
END IF ;
|
||
IF
|
||
( v_count2 = 0 )
|
||
OR( v_count2 IS NULL )
|
||
THEN
|
||
EXIT ;
|
||
ELSE
|
||
v_strlist.EXTEND ( 1 ) ;
|
||
v_strlist ( v_i ) := v_node ;
|
||
v_node := '' ;
|
||
END IF ;
|
||
END LOOP ;
|
||
RETURN v_strlist ;
|
||
END ;
|
||
/</pre>
|
||
</div>
|
||
<div class="section" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_section19755641143617"><h4 class="sectiontitle">RECORD</h4><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p27687220111">The Record type declared in the package specification is actually used in the corresponding package body.</p>
|
||
</div>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p7941144114368">After <strong id="EN-US_TOPIC_0000001234042085__b41181546145416">plsqlCollection </strong>is set to varray, UDT will be migrated as VARRY.</p>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p14941341123617"><strong id="EN-US_TOPIC_0000001234042085__b15605860551">Input – RECORD</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen8942441183614">CREATE OR REPLACE FUNCTION func1 (i1 INT)
|
||
RETURN INT
|
||
As
|
||
TYPE r_rthpagat_list IS RECORD (--Record information about cross-border RMB business parameters (rthpagat)
|
||
rthpagat_REQUESTID RMTS_REMITTANCE_PARAM.REQUESTID%TYPE ,rthpagat_PARAMTNAME RMTS_REMITTANCE_PARAM.PARAMTNAME%TYPE ,rthpagat_PARAMNUM RMTS_REMITTANCE_PARAM.PARAMNUM%TYPE ,rthpagat_PARAMSTAT RMTS_REMITTANCE_PARAM.PARAMSTAT%TYPE ,rthpagat_REQTELLERNO RMTS_REMITTANCE_PARAM.REQTELLERNO%TYPE ,rthpagat_REQUESTTIME RMTS_REMITTANCE_PARAM.REQUESTTIME%TYPE ,rthpagat_HOSTERRNO RMTS_REMITTANCE_PARAM.HOSTERRNO%TYPE ,rthpagat_HOSTERRMSG RMTS_REMITTANCE_PARAM.HOSTERRMSG%TYPE ,rthpagat_GATBANK RMTS_REMITTANCE_PARAM.VALUE1%TYPE ,rthpagat_GATEEBANK RMTS_REMITTANCE_PARAM.VALUE2%TYPE ,rthpagat_TELLER RMTS_REMITTANCE_PARAM.VALUE3%TYPE ,rthpagat_DATE RMTS_REMITTANCE_PARAM.VALUE4%TYPE ,rthpagat_BM_GATBANK RMTS_REMITTANCE_PARAM.VALUE5%TYPE ,rthpagat_BM_GATEEBANK RMTS_REMITTANCE_PARAM.VALUE6%TYPE ,rthpagat_BM_LMTEL RMTS_REMITTANCE_PARAM.VALUE7%TYPE ,rthpagat_BM_LMDAT RMTS_REMITTANCE_PARAM.VALUE8%TYPE ) ;
|
||
|
||
v1 r_rthpagat_list;
|
||
BEGIN
|
||
|
||
END;
|
||
/</pre>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p2942541193612"><strong id="EN-US_TOPIC_0000001234042085__b1699942573">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen15943184153611">CREATE
|
||
TYPE rmts_remitparammgmt_rthpagat.r_rthpagat_list AS (/* O_ERRMSG error description */
|
||
Rthpagat_REQUESTID
|
||
rthpagat_REQUESTID RMTS_REMITTANCE_PARAM.REQUESTID%TYPE ,rthpagat_PARAMTNAME RMTS_REMITTANCE_PARAM.PARAMTNAME%TYPE ,rthpagat_PARAMNUM RMTS_REMITTANCE_PARAM.PARAMNUM%TYPE ,rthpagat_PARAMSTAT RMTS_REMITTANCE_PARAM.PARAMSTAT%TYPE ,rthpagat_REQTELLERNO RMTS_REMITTANCE_PARAM.REQTELLERNO%TYPE ,rthpagat_REQUESTTIME RMTS_REMITTANCE_PARAM.REQUESTTIME%TYPE ,rthpagat_HOSTERRNO RMTS_REMITTANCE_PARAM.HOSTERRNO%TYPE ,rthpagat_HOSTERRMSG RMTS_REMITTANCE_PARAM.HOSTERRMSG%TYPE ,rthpagat_GATBANK RMTS_REMITTANCE_PARAM.VALUE1%TYPE ,rthpagat_GATEEBANK RMTS_REMITTANCE_PARAM.VALUE2%TYPE ,rthpagat_TELLER RMTS_REMITTANCE_PARAM.VALUE3%TYPE ,rthpagat_DATE RMTS_REMITTANCE_PARAM.VALUE4%TYPE ,rthpagat_BM_GATBANK RMTS_REMITTANCE_PARAM.VALUE5%TYPE ,rthpagat_BM_GATEEBANK RMTS_REMITTANCE_PARAM.VALUE6%TYPE ,rthpagat_BM_LMTEL RMTS_REMITTANCE_PARAM.VALUE7%TYPE ,rthpagat_BM_LMDAT RMTS_REMITTANCE_PARAM.VALUE8%TYPE ) ;
|
||
|
||
CREATE OR REPLACE FUNCTION func1 (i1 INT)
|
||
RETURN INT
|
||
AS
|
||
v1 r_rthpagat_list;
|
||
BEGIN
|
||
|
||
END;
|
||
/</pre>
|
||
<div class="section" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_section317601214204"><h4 class="sectiontitle">Naming Convention of Type Name</h4><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p13363845182012">User-defined types allow for the definition of data types that model the structure and behavior of the data in an application.</p>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1157218433215"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b599510033311">Input</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen1988016963310">CREATE
|
||
TYPE t_line AS ( product_line VARCHAR2 ( 30 )
|
||
,product_amount NUMBER ) ;
|
||
;</pre>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p181439593214"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b1395535783419">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen18804194013510">CREATE
|
||
TYPE sad_dml_product_pkg.t_line AS ( product_line VARCHAR2 ( 30 )
|
||
,product_amount NUMBER ) ;</pre>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1068100143517"></p>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p02612347222"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b337714012228">Input</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen18851112112219">CREATE
|
||
TYPE t_line AS ( product_line VARCHAR2 ( 30 )
|
||
,product_amount NUMBER ) ;</pre>
|
||
</div>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1520851272016"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b1987944236">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen616661002310">CREATE
|
||
TYPE SAD.sad_dml_product_pkg#t_line AS ( product_line VARCHAR2 ( 30 )
|
||
,product_amount NUMBER ) ;</pre>
|
||
<div class="note" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_note929623062316"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_ul639979134714"><li id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_li165295334471">For the first output(pkg.t),if <strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b54364217229">pkgSchemaNaming</strong> is set to <strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b112053337222">true</strong> in the configuration, PL RECORD migration should have package name as a schema name along with a type name.</li><li id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_li439916954718">For the second output (pkg#t), assume that TYPE belongs to sad_dml_product_pkg package.</li></ul>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p371014217132">If <strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b57227212241">pkgSchemaNaming</strong> is set to<strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b1271995110231"> false</strong> in the configuration, PL RECORD migration should have schema name as a schema name along with a package name + a type name separated by # as a type name.</p>
|
||
</div></div>
|
||
<div class="section" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_section4981341461"><h4 class="sectiontitle">SUBTYPE</h4><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p660775416466">With the SUBTYPE statement, PL/SQL allows you to define your own subtypes or aliases of predefined datatypes, sometimes referred to as abstract datatypes.</p>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p1427444215475"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b10463184754719">Input</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen12581632104710">CREATE OR REPLACE PACKAGE "SAD"."BAS_SUBTYPE_PKG" IS
|
||
SUBTYPE CURRENCY IS BAS_PRICE_LIST_T.CURRENCY%TYPE;
|
||
END bas_subtype_pkg;
|
||
/
|
||
CREATE OR REPLACE PACKAGE BODY "SAD"."BAS_SUBTYPE_PKG" IS
|
||
BEGIN
|
||
NULL;
|
||
END bas_subtype_pkg;
|
||
/
|
||
--********************************************************************
|
||
CREATE OR REPLACE PACKAGE BODY SAD.bas_lookup_misc_pkg IS
|
||
FUNCTION get_currency(pi_price_type IN NUMBER) RETURN VARCHAR2 IS
|
||
v_currency bas_subtype_pkg.currency;
|
||
BEGIN
|
||
g_func_name := 'get_currency';
|
||
FOR rec_currency IN (SELECT currency FROM sad_price_type_v WHERE price_type_code = pi_price_type)
|
||
LOOP
|
||
v_currency := rec_currency.currency;
|
||
END LOOP;
|
||
RETURN v_currency;
|
||
END get_currency;
|
||
END SAD.bas_lookup_misc_pkg;
|
||
/</pre>
|
||
</div>
|
||
<p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p9208181242012"><strong id="EN-US_TOPIC_0000001234042085__en-us_topic_0237712372_b1891165624711">Output</strong></p>
|
||
<pre class="screen" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_screen8858117523"> CREATE OR REPLACE FUNCTION SAD.bas_lookup_misc_pk#get_currency(pi_price_type IN NUMBER) RETURN VARCHAR2 IS
|
||
v_currency BAS_PRICE_LIST_T.CURRENCY%TYPE;
|
||
BEGIN
|
||
g_func_name := 'get_currency';
|
||
FOR rec_currency IN (SELECT currency FROM sad_price_type_v WHERE price_type_code = pi_price_type)
|
||
LOOP
|
||
v_currency := rec_currency.currency;
|
||
END LOOP;
|
||
RETURN v_currency;
|
||
END ;
|
||
/</pre>
|
||
<div class="note" id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_note1455752112526"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001234042085__en-us_topic_0238518403_en-us_topic_0237362508_en-us_topic_0202727309_p115581621165215">As SUBTYPE is not supported in GaussDB, the SUBTYPE variable needs to be replaced with the actual type.</p>
|
||
</div></div>
|
||
</div>
|
||
<div>
|
||
<div class="familylinks">
|
||
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_mt_0104.html">Oracle Syntax Migration</a></div>
|
||
</div>
|
||
</div>
|
||
|