云数据库 GAUSSDB-MOVE:示例

时间:2024-11-02 18:53:05

示例

--开始一个事务。
openGauss=# START TRANSACTION;

--定义一个名为cursor1的游标。
openGauss=# CURSOR cursor1 FOR SELECT * FROM tpcds.reason;

--忽略游标cursor1的前3行。
openGauss=# MOVE FORWARD 3 FROM cursor1;

--抓取游标cursor1的前4行。
openGauss=# FETCH 4 FROM cursor1;
 r_reason_sk |   r_reason_id    |                                            r_reason_desc                                             
-------------+------------------+------------------------------------------------------------------------------------------------------
           4 | AAAAAAAAEAAAAAAA | Not the product that was ordred                                                                     
           5 | AAAAAAAAFAAAAAAA | Parts missing                                                                                       
           6 | AAAAAAAAGAAAAAAA | Does not work with a product that I have                                                            
           7 | AAAAAAAAHAAAAAAA | Gift exchange                                                                                       
(4 rows)

--关闭游标。
openGauss=# CLOSE cursor1;

--结束一个事务。
openGauss=# END;
support.huaweicloud.com/centralized-devg-v2-gaussdb/devg_03_0644.html