doc-exports/docs/dws/tool/dws_07_6824.html
Lu, Huayi 346ac31da9 DWS TG 8.1.3.200 VERSION
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>
2023-08-28 09:20:17 +00:00

174 lines
13 KiB
HTML

<a name="EN-US_TOPIC_0000001188521160"></a><a name="EN-US_TOPIC_0000001188521160"></a>
<h1 class="topictitle1">System Functions</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_section1684364002620"><h4 class="sectiontitle">ISNULL()</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_table1584518401260" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row1696584010264"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.1.2.1.3.1.1"><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p12965540162614"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b159261822194914">Netezza Syntax</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.1.2.1.3.1.2"><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p49657402269"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b81851635102616">Syntax After Migration</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row1396510407263"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.1.2.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen1396516409262">SELECT A.ETL_DATE, A.BRANCH_CODE, A.CUST_NO
, ISNULL ( B.RES_STOCK,0) AS RES_STOCK
, ISNULL ( B.ZY_VOL ,0 ) AS ZY_VOL
, ISNULL ( B.ZJ_VOL,0 ) AS ZJ_VOL
FROM tab123;</pre>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.1.2.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen1296517407261">SELECT A.ETL_DATE, A.BRANCH_CODE, A.CUST_NO
, NVL ( B.RES_STOCK,0) AS RES_STOCK
, NVL ( B.ZY_VOL ,0 ) AS ZY_VOL
, NVL ( B.ZJ_VOL,0 ) AS ZJ_VOL
FROM tab123;</pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_section20859124022615"><h4 class="sectiontitle">NVL</h4><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p7965134018269">Second parameter is missing.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_table88605404266" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row1696784042614"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.3.1.3.1.1"><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p29671740112618"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b1880083111526">Netezza Syntax</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.3.1.3.1.2"><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p496764013269"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b799784882920">Syntax After Migration</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row1896711400262"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen696874032611">SELECT NVL( SUM(A3.DA_CPTL_BAL_YEAR) / NULLIF(V_YEAR_DAYS, 0) ) AS CPTL_BAL_AVE_YR
, NVL( NVL(SUM (CASE WHEN A3.OPENACT_DT &gt;= V_YEAR_START THEN A3.DA_CPTL_BAL_YEAR
END) / NULLIF(V_YEAR_DAYS, 0) ), 0) AS CPTL_BAL_AVE_YR_OP
, NVL( SUM(A3.DA_CPTL_BAL) / NULLIF(V_YEAR_DAYS, 0) ) AS CPTL_BAL_AVE
FROM tab1 A3;</pre>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.3.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen49681440182612">ELECT NVL( SUM(A3.DA_CPTL_BAL_YEAR) / NULLIF(V_YEAR_DAYS, 0), NULL ) AS CPTL_BAL_AVE_YR
, NVL( NVL(SUM (CASE WHEN A3.OPENACT_DT &gt;= V_YEAR_START THEN A3.DA_CPTL_BAL_YEAR
END) / NULLIF(V_YEAR_DAYS, 0), NULL), 0) AS CPTL_BAL_AVE_YR_OP
, NVL( SUM(A3.DA_CPTL_BAL) / NULLIF(V_YEAR_DAYS, 0), NULL ) AS CPTL_BAL_AVE
FROM tab1 A3;</pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_section19865154022614"><h4 class="sectiontitle">DATE</h4><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p1396814052615">Casting the data type.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_table18661740142617" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row7968184010269"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.3.3.1.3.1.1"><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p11968194022620"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b48781530536">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_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p8968940182611"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b1961720504296">Syntax After Migration</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row2968154032618"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.3.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen1896814010265">SELECT A1.ETL_DATE, A1.MARKET_CODE
, A1.DECLARATION_DT
, ROW_NUMBER() OVER(PARTITION BY A1.MARKET_CODE, A1.STOCK_CODE, DATE_PART('YEAR', DATE(A1.DECLARATION_DT)) ORDER BY A1.DECLARATION_DT DESC) AS RN
FROM tb_date_type_casting A1;
SELECT A1.ETL_DATE, A1.MARKET_CODE
, A1.DECLARATION_DT
, ROW_NUMBER() OVER(PARTITION BY A1.MARKET_CODE, A1.STOCK_CODE, DATE_PART('YEAR', DATE(A1.DECLARATION_DT)) ORDER BY A1.DECLARATION_DT DESC) AS RN
FROM tb_date_type_casting A1;</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_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen1096844019261">SELECT A1.ETL_DATE, A1.MARKET_CODE
, A1.DECLARATION_DT
, ROW_NUMBER() OVER(PARTITION BY A1.MARKET_CODE, A1.STOCK_CODE, DATE_PART('YEAR', CAST(A1.DECLARATION_DT AS DATE)) ORDER BY A1.DECLARATION_DT DESC) AS RN
FROM tb_date_type_casting A1;</pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_section1087364013261"><h4 class="sectiontitle">analytic_function</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_table138736404263" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row596844017262"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.2.1.3.1.1"><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p169681440152618"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b8141133265319">Netezza Syntax</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.2.1.3.1.2"><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p19968340142613"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b42632052132915">Syntax After Migration</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row16968134042617"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen59685408266">SELECT COALESCE(NULLIF(GROUP_CONCAT(a.column_name),''),'*')
FROM (SELECT a.column_name
FROM tb_ntz_group_concat a
WHERE UPPER(a.table_name) = 'EMP'
ORDER BY a.column_pos) a;
-------------
SELECT admin.group_concat('"top'||lpad(a.table_name,2,'0')||'":{'||a.column_name||'}') topofund_data
FROM (SELECT a.table_name, a.column_name
FROM tb_ntz_group_concat a
WHERE UPPER(a.table_name) = 'EMP'
ORDER BY a.column_pos) a;</pre>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen19968124002610">SELECT COALESCE(NULLIF(STRING_AGG(a.column_name, ','),''),'*')
FROM (SELECT a.column_name
FROM tb_ntz_group_concat a
WHERE UPPER(a.table_name) = 'EMP'
ORDER BY a.column_pos) a;
-------------
SELECT STRING_AGG('"top'||lpad(a.table_name,3,'0')||'":{'||a.column_name||'}', ',') topofund_data
FROM (SELECT a.table_name, a.column_name
FROM tb_ntz_group_concat a
WHERE UPPER(a.table_name) = 'EMP'
ORDER BY a.column_pos) a;</pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_section178817409264"><h4 class="sectiontitle">Stored Procedure</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_table98841640182612" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row696914082618"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.5.2.1.3.1.1"><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p69691040192619"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b1436054175415">Netezza Syntax</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.5.2.1.3.1.2"><p id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_p696984042613"><strong id="EN-US_TOPIC_0000001188521160__en-us_topic_0237712403_b13824105382911">Syntax After Migration</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_row696924017264"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen89691640182618">CREATE OR REPLACE PROCEDURE sp_ntz_proc_call
( 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';
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
O_RETURN INTEGER;
BEGIN
O_RETURN := 0;
CALL SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0);
RETURN O_RETURN;
END;
END_PROC;</pre>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001188521160__en-us_topic_0238518434_en-us_topic_0237362308_en-us_topic_0213479754_screen9970164012614">CREATE OR REPLACE FUNCTION sp_ntz_proc_call
( CHARACTER VARYING(8) )
RETURN INTEGER
AS
V_PAR_DAY ALIAS for $1;
V_PRCNAME NCHAR VARYING(50):= 'SP_O_HXYW_LNSACCTINFO_H';
D_TIME_START TIMESTAMP:= CURRENT_TIMESTAMP;
O_RETURN INTEGER;
BEGIN
O_RETURN := 0;
SP_LOG_EXEC(V_PRCNAME,V_PAR_DAY,D_TIME_START,0,0);
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>