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>
302 lines
15 KiB
HTML
302 lines
15 KiB
HTML
<a name="EN-US_TOPIC_0000001233800649"></a><a name="EN-US_TOPIC_0000001233800649"></a>
|
|
|
|
<h1 class="topictitle1">PROCEDURE with RETURNS</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p579093415455">PROCEDURE with RETURNS will be modified to FUNCTION with RETURN.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_table425875517593" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_row825845545917"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.1.3.1.1"><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p1492189101911"><strong id="EN-US_TOPIC_0000001233800649__en-us_topic_0237712282_b825811552594">Netezza Syntax</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.1.3.1.2"><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p1392209141912"><strong id="EN-US_TOPIC_0000001233800649__en-us_topic_0237712282_b81851635102616">Syntax After Migration</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_row122583559590"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_screen63642550">CREATE OR REPLACE PROCEDURE "DWDB"."EDW"."SP_O_HXYW_LNSACCTINFO_H"(CHARACTER VARYING(8))
|
|
RETURNS INTEGER
|
|
LANGUAGE NZPLSQL AS
|
|
BEGIN_PROC
|
|
DECLARE
|
|
V_PAR_DAY ALIAS for $1;
|
|
V_PRCNAME NVARCHAR(50):= 'SP_O_HXYW_LNSACCTINFO_H';
|
|
V_CNT INTEGER;
|
|
V_STEP_INFO NVARCHAR(500);
|
|
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
|
|
O_RETURN INTEGER;
|
|
BEGIN
|
|
O_RETURN := 0;
|
|
|
|
--Writes logs and starts the recording process.
|
|
CALL SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0,'The process running ',' ');
|
|
|
|
V_STEP_INFO := '1.Initialization';
|
|
BEGIN
|
|
--1.1
|
|
SELECT COUNT(*) INTO V_CNT FROM information_schema.columns WHERE TABLE_NAME='TMPO_HXYW_LNSACCTINFO_H1';
|
|
if V_CNT>0 then
|
|
EXECUTE IMMEDIATE 'DROP TABLE TMPO_HXYW_LNSACCTINFO_H1';
|
|
end if;
|
|
END;
|
|
|
|
RETURN O_RETURN;
|
|
|
|
END;
|
|
END_PROC;</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_screen44826169">CREATE OR REPLACE FUNCTION "EDW"."SP_O_HXYW_LNSACCTINFO_H"(CHARACTER VARYING(8))
|
|
RETURN INTEGER
|
|
AS
|
|
V_PAR_DAY ALIAS for $1;
|
|
V_PRCNAME NCHAR VARYING(50):= 'SP_O_HXYW_LNSACCTINFO_H';
|
|
V_CNT INTEGER;
|
|
V_STEP_INFO NCHAR VARYING(500);
|
|
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
|
|
O_RETURN INTEGER;
|
|
BEGIN
|
|
O_RETURN := 0;
|
|
|
|
/* Writes logs and starts the recording process. */
|
|
SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0,'The process running',' ');
|
|
|
|
V_STEP_INFO := '1.Initialization';
|
|
BEGIN
|
|
/* 1.1 */
|
|
SELECT COUNT(*) INTO V_CNT FROM information_schema.columns WHERE TABLE_NAME=lower('TMPO_HXYW_LNSACCTINFO_H1');
|
|
if V_CNT>0 then
|
|
EXECUTE IMMEDIATE 'DROP TABLE TMPO_HXYW_LNSACCTINFO_H1';
|
|
end if;
|
|
END;
|
|
|
|
RETURN O_RETURN;
|
|
|
|
END;
|
|
/</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_section1049710281559"><a name="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_section1049710281559"></a><a name="en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_section1049710281559"></a><h4 class="sectiontitle">Qualifying Language</h4><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p1249083952314">Migrate the nzplSQL language to the plpgSQL language or delete the language.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_table264520229515" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_row66453221356"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.3.3.1.3.1.1"><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p11731202272012"><strong id="EN-US_TOPIC_0000001233800649__en-us_topic_0237712282_b5645922855">Netezza Syntax</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.3.3.1.3.1.2"><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p5731142219208"><strong id="EN-US_TOPIC_0000001233800649__b1943618396217">Syntax After Migration</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_row13645132216515"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.3.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_screen20760727">CREATE OR REPLACE PROCEDURE "DWDB"."EDW"."SP_O_HXYW_LNSACCTINFO_H"(CHARACTER VARYING(8))
|
|
RETURNS INTEGER
|
|
LANGUAGE NZPLSQL AS
|
|
BEGIN_PROC
|
|
DECLARE
|
|
V_PAR_DAY ALIAS for $1;
|
|
V_PRCNAME NVARCHAR(50):= 'SP_O_HXYW_LNSACCTINFO_H';
|
|
V_CNT INTEGER;
|
|
V_STEP_INFO NVARCHAR(500);
|
|
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
|
|
O_RETURN INTEGER;
|
|
BEGIN
|
|
O_RETURN := 0;
|
|
|
|
--Writes logs and starts the recording process.
|
|
CALL SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0,'The process running ',' ');
|
|
|
|
V_STEP_INFO := '1.Initialization';
|
|
BEGIN
|
|
--1.1
|
|
SELECT COUNT(*) INTO V_CNT FROM information_schema.columns WHERE TABLE_NAME='TMPO_HXYW_LNSACCTINFO_H1';
|
|
if V_CNT>0 then
|
|
EXECUTE IMMEDIATE 'DROP TABLE TMPO_HXYW_LNSACCTINFO_H1';
|
|
end if;
|
|
END;
|
|
|
|
RETURN O_RETURN;
|
|
|
|
END;
|
|
END_PROC;</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.3.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_screen20306355">CREATE OR REPLACE FUNCTION "EDW"."SP_O_HXYW_LNSACCTINFO_H"(CHARACTER VARYING(8))
|
|
RETURN INTEGER
|
|
AS
|
|
V_PAR_DAY ALIAS for $1;
|
|
V_PRCNAME NCHAR VARYING(50):= 'SP_O_HXYW_LNSACCTINFO_H';
|
|
V_CNT INTEGER;
|
|
V_STEP_INFO NCHAR VARYING(500);
|
|
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
|
|
O_RETURN INTEGER;
|
|
BEGIN
|
|
O_RETURN := 0;
|
|
|
|
/* Writes logs and starts the recording process. */
|
|
SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0,'The process running',' ');
|
|
|
|
V_STEP_INFO := '1.Initialization';
|
|
BEGIN
|
|
/* 1.1 */
|
|
SELECT COUNT(*) INTO V_CNT FROM information_schema.columns WHERE TABLE_NAME=lower('TMPO_HXYW_LNSACCTINFO_H1');
|
|
if V_CNT>0 then
|
|
EXECUTE IMMEDIATE 'DROP TABLE TMPO_HXYW_LNSACCTINFO_H1';
|
|
end if;
|
|
END;
|
|
|
|
RETURN O_RETURN;
|
|
|
|
END;
|
|
/</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_section92805525715"><a name="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_section92805525715"></a><a name="en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_section92805525715"></a><h4 class="sectiontitle">Process Compilation Specification</h4><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p19769654123113">The process which is started with <strong id="EN-US_TOPIC_0000001233800649__en-us_topic_0237712282_b64395783">Begin_PROC</strong> and ended with <strong id="EN-US_TOPIC_0000001233800649__en-us_topic_0237712282_b42691141">END_PROC </strong>should be removed.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_table18320330617" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_row0315331361"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.3.1.3.1.1"><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p192831746162118"><strong id="EN-US_TOPIC_0000001233800649__en-us_topic_0237712282_b128514614">Netezza Syntax</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.3.1.3.1.2"><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p192831546192118"><strong id="EN-US_TOPIC_0000001233800649__en-us_topic_0237712282_b716691952911">Syntax After Migration</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_row23163318613"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_screen260244517610">CREATE OR REPLACE PROCEDURE "DWDB"."EDW"."SP_O_HXYW_LNSACCTINFO_H"(CHARACTER VARYING(8))
|
|
RETURNS INTEGER
|
|
LANGUAGE NZPLSQL AS
|
|
BEGIN_PROC
|
|
DECLARE
|
|
V_PAR_DAY ALIAS for $1;
|
|
V_PRCNAME NVARCHAR(50):= 'SP_O_HXYW_LNSACCTINFO_H';
|
|
V_CNT INTEGER;
|
|
V_STEP_INFO NVARCHAR(500);
|
|
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
|
|
O_RETURN INTEGER;
|
|
BEGIN
|
|
O_RETURN := 0;
|
|
|
|
--Writes logs and starts the recording process.
|
|
CALL SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0,'The process running ',' ');
|
|
|
|
V_STEP_INFO := '1.Initialization';
|
|
BEGIN
|
|
--1.1
|
|
SELECT COUNT(*) INTO V_CNT FROM information_schema.columns WHERE TABLE_NAME='TMPO_HXYW_LNSACCTINFO_H1';
|
|
if V_CNT>0 then
|
|
EXECUTE IMMEDIATE 'DROP TABLE TMPO_HXYW_LNSACCTINFO_H1';
|
|
end if;
|
|
END;
|
|
|
|
RETURN O_RETURN;
|
|
|
|
END;
|
|
END_PROC;</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_screen16674221">CREATE OR REPLACE FUNCTION "EDW"."SP_O_HXYW_LNSACCTINFO_H"(CHARACTER VARYING(8))
|
|
RETURN INTEGER
|
|
AS
|
|
V_PAR_DAY ALIAS for $1;
|
|
V_PRCNAME NCHAR VARYING(50):= 'SP_O_HXYW_LNSACCTINFO_H';
|
|
V_CNT INTEGER;
|
|
V_STEP_INFO NCHAR VARYING(500);
|
|
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
|
|
O_RETURN INTEGER;
|
|
BEGIN
|
|
O_RETURN := 0;
|
|
|
|
/* Writes logs and starts the recording process. */
|
|
SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0,'The process running',' ');
|
|
|
|
V_STEP_INFO := '1.Initialization';
|
|
BEGIN
|
|
/* 1.1 */
|
|
SELECT COUNT(*) INTO V_CNT FROM information_schema.columns WHERE TABLE_NAME=lower('TMPO_HXYW_LNSACCTINFO_H1');
|
|
if V_CNT>0 then
|
|
EXECUTE IMMEDIATE 'DROP TABLE TMPO_HXYW_LNSACCTINFO_H1';
|
|
end if;
|
|
END;
|
|
|
|
RETURN O_RETURN;
|
|
|
|
END;
|
|
/</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_section1272133175917"><a name="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_section1272133175917"></a><a name="en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_section1272133175917"></a><h4 class="sectiontitle">DECLARE Keyword to Declare the Local Variables</h4><p class="msonormal" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p11568342">DECLARE should be modified to AS.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_table793825419011" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_row39389549014"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.5.3.1.3.1.1"><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p35649317117"><strong id="EN-US_TOPIC_0000001233800649__en-us_topic_0237712282_b8312337614">Netezza Syntax</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.5.3.1.3.1.2"><p id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_p056463219"><strong id="EN-US_TOPIC_0000001233800649__b1492285514">Syntax After Migration</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_row10938654401"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.3.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_screen1393975413020">CREATE OR REPLACE PROCEDURE "DWDB"."EDW"."SP_O_HXYW_LNSACCTINFO_H"(CHARACTER VARYING(8))
|
|
RETURNS INTEGER
|
|
LANGUAGE NZPLSQL AS
|
|
BEGIN_PROC
|
|
DECLARE
|
|
V_PAR_DAY ALIAS for $1;
|
|
V_PRCNAME NVARCHAR(50):= 'SP_O_HXYW_LNSACCTINFO_H';
|
|
V_CNT INTEGER;
|
|
V_STEP_INFO NVARCHAR(500);
|
|
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
|
|
O_RETURN INTEGER;
|
|
BEGIN
|
|
O_RETURN := 0;
|
|
|
|
--Writes logs and starts the recording process.
|
|
CALL SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0,'The process running ',' ');
|
|
|
|
V_STEP_INFO := '1.Initialization';
|
|
BEGIN
|
|
--1.1
|
|
SELECT COUNT(*) INTO V_CNT FROM information_schema.columns WHERE TABLE_NAME='TMPO_HXYW_LNSACCTINFO_H1';
|
|
if V_CNT>0 then
|
|
EXECUTE IMMEDIATE 'DROP TABLE TMPO_HXYW_LNSACCTINFO_H1';
|
|
end if;
|
|
END;
|
|
|
|
RETURN O_RETURN;
|
|
|
|
END;
|
|
END_PROC;</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.3.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001233800649__en-us_topic_0238518432_en-us_topic_0237362167_en-us_topic_0202686277_screen4939354902">CREATE OR REPLACE FUNCTION "EDW"."SP_O_HXYW_LNSACCTINFO_H"(CHARACTER VARYING(8))
|
|
RETURN INTEGER
|
|
AS
|
|
V_PAR_DAY ALIAS for $1;
|
|
V_PRCNAME NCHAR VARYING(50):= 'SP_O_HXYW_LNSACCTINFO_H';
|
|
V_CNT INTEGER;
|
|
V_STEP_INFO NCHAR VARYING(500);
|
|
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
|
|
O_RETURN INTEGER;
|
|
BEGIN
|
|
O_RETURN := 0;
|
|
|
|
/* Writes logs and starts the recording process. */
|
|
SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0,'The process running',' ');
|
|
|
|
V_STEP_INFO := '1.Initialization';
|
|
BEGIN
|
|
/* 1.1 */
|
|
SELECT COUNT(*) INTO V_CNT FROM information_schema.columns WHERE TABLE_NAME=lower('TMPO_HXYW_LNSACCTINFO_H1');
|
|
if V_CNT>0 then
|
|
EXECUTE IMMEDIATE 'DROP TABLE TMPO_HXYW_LNSACCTINFO_H1';
|
|
end if;
|
|
END;
|
|
|
|
RETURN O_RETURN;
|
|
|
|
END;
|
|
/</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_07_0682.html">Netezza Syntax Migration</a></div>
|
|
</div>
|
|
</div>
|
|
|