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>
75 lines
9.1 KiB
HTML
75 lines
9.1 KiB
HTML
<a name="EN-US_TOPIC_0000001188521076"></a><a name="EN-US_TOPIC_0000001188521076"></a>
|
|
|
|
<h1 class="topictitle1">Pseudo Columns</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727099_p153001227758">This section contains the migration syntax of Oracle Pseudo Columns. The migration syntax decides how the keywords/features are migrated.</p>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727099_p64332156202014">A <strong id="EN-US_TOPIC_0000001188521076__en-us_topic_0237712381_b3275486714264">pseudo column</strong> is similar to a table column, but is not actually stored in the table. User can select values from pseudo columns, but cannot insert, update, or delete values in the pseudo columns.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_section1751695411617"><h4 class="sectiontitle">ROWID</h4><p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727395_p1324615625114">The <strong id="EN-US_TOPIC_0000001188521076__en-us_topic_0237712381_b17544227145115">ROWID</strong> pseudo column returns the address of a specific row.</p>
|
|
<div class="fignone" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727395_fig9424869202132"><span class="figcap"><b>Figure 1 </b>Input - ROWID</span><br><span><img id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727395_image25216959202132" src="figure/en-us_image_0000001234042239.png"></span></div>
|
|
<div class="fignone" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727395_fig29307826202132"><span class="figcap"><b>Figure 2 </b>Output - ROWID</span><br><span><img id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727395_image25123685202132" src="figure/en-us_image_0000001233800799.png"></span></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_section4417229314"><h4 class="sectiontitle">ROWNUM</h4><p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p193031943528">For each row of data returned by the query, the <strong id="EN-US_TOPIC_0000001188521076__b48291431162">ROWNUM</strong> pseudo column returns a number, indicating the order with which the Oracle database selects rows from a table or a group of joined rows. The value of <strong id="EN-US_TOPIC_0000001188521076__b240051919715">ROWNUM</strong> in the first row is <strong id="EN-US_TOPIC_0000001188521076__b940771915713">1</strong>, the value of <strong id="EN-US_TOPIC_0000001188521076__b240717198712">ROWNUM</strong> in the second row is <strong id="EN-US_TOPIC_0000001188521076__b340881915711">2</strong>, and so on.</p>
|
|
<div class="fignone" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_fig33924211202219"><span class="figcap"><b>Figure 3 </b>Input - ROWNUM</span><br><span><img id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_image63506572202219" src="figure/en-us_image_0000001234042241.png"></span></div>
|
|
<div class="fignone" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_fig43758742202219"><span class="figcap"><b>Figure 4 </b>Output - ROWNUM</span><br><span><img id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_image54797241202219" src="figure/en-us_image_0000001234200727.png"></span></div>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p1791383819514"><strong id="EN-US_TOPIC_0000001188521076__b390635042310">Input</strong><strong id="EN-US_TOPIC_0000001188521076__b390655020236">-ROWNUM with UPDATE</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p18297431131117">When executing <strong id="EN-US_TOPIC_0000001188521076__b0904182414247">UPDATE</strong>, if ROWNUM with some value (integer) is used, the system will UPDATE records using the operator near ROWNUM accordingly.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_screen711410205123">UPDATE SCMS_MSGPOOL_LST
|
|
SET MSG_STD = '11'
|
|
WHERE UNISEQNO = IN_OUNISEQNO
|
|
AND MSG_TYP1 IN ('MT103', 'MT199')
|
|
AND ROWNUM = 1;</pre>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p11951949111113"><strong id="EN-US_TOPIC_0000001188521076__en-us_topic_0237712381_b3842404127">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_screen17942113191211"> UPDATE SCMS_MSGPOOL_LST
|
|
SET MSG_STD = '11'
|
|
WHERE (xc_node_id,ctid) in (select xc_node_id, ctid
|
|
from SCMS_MSGPOOL_LST
|
|
where UNISEQNO = IN_OUNISEQNO
|
|
AND MSG_TYP1 IN ('MT103', 'MT199')
|
|
LIMIT 1)</pre>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p383133314116"><strong id="EN-US_TOPIC_0000001188521076__en-us_topic_0237712381_b10966154615167">Input</strong><strong id="EN-US_TOPIC_0000001188521076__en-us_topic_0237712381_b096616460163">-ROWNUM with DELETE</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p851554462614">When exectuing DELETED, if ROWNUM with some value (integer) is used, system will DELETE records using the operator near ROWNUM accordingly.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_screen1329464211172">delete from test1
|
|
where c1='abc' and rownum = 1;</pre>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p168702114189"><strong id="EN-US_TOPIC_0000001188521076__en-us_topic_0237712381_b28701612188">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_screen1687081131811">delete from test1 where (xc_node_id,ctid) in (select xc_node_id, ctid from test1 where c1='abc' limit 1);</pre>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p1534128113912"><strong id="EN-US_TOPIC_0000001188521076__en-us_topic_0237712381_b2845217124015">Input - UPDATE with ROWNUM</strong></p>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p656381115289">Scripts of UPDATE and DELETE that are migrated through ROWNUM contains LIMIT, which is not supported by Gauss.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_screen456954174013">UPDATE SCMS_MSGPOOL_LST
|
|
SET MSG_STD = '11'
|
|
WHERE UNISEQNO = IN_OUNISEQNO
|
|
AND MSG_TYP1 IN ('MT103', 'MT199')
|
|
AND ROWNUM = 1;
|
|
</pre>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p1918616126405"><strong id="EN-US_TOPIC_0000001188521076__b976449243">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_screen10572834154118">UPDATE SCMS_MSGPOOL_LST
|
|
SET MSG_STD = '11'
|
|
WHERE (xc_node_id, ctid) = ( SELECT xc_node_id, ctid
|
|
FROM SCMS_MSGPOOL_LST
|
|
WHERE UNISEQNO = IN_OUNISEQNO
|
|
AND MSG_TYP1 IN ('MT103', 'MT199')
|
|
LIMIT 1
|
|
);
|
|
</pre>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p314021317402"><strong id="EN-US_TOPIC_0000001188521076__en-us_topic_0237712381_b1484501721217">Input - DELETE with ROWNUM</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_screen2186841151218">DELETE FROM SPMS_APP_PUBLISH
|
|
WHERE NOVA_NO = IN_NOVA_NO
|
|
AND DELIVERY_TYPE = '1'
|
|
AND PUBLISH_DATE = IN_PUBLISH_DATE
|
|
AND ROWNUM = 1;</pre>
|
|
<p id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_p151635401317"><strong id="EN-US_TOPIC_0000001188521076__en-us_topic_0237712381_b1916318419131">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001188521076__en-us_topic_0238518391_en-us_topic_0237362232_en-us_topic_0202727079_screen1116313421315">DELETE FROM SPMS_APP_PUBLISH
|
|
WHERE (xc_node_id, ctid) IN (SELECT xc_node_id, ctid
|
|
FROM SPMS_APP_PUBLISH
|
|
WHERE NOVA_NO = IN_NOVA_NO
|
|
AND DELIVERY_TYPE = '1'
|
|
AND PUBLISH_DATE = IN_PUBLISH_DATE
|
|
LIMIT 1
|
|
);</pre>
|
|
</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>
|
|
|