设置和使用一个游标:
BEGIN WORK; DECLARE liahona CURSOR FOR SELECT * FROM films; -- 忽略开头 5 行: MOVE FORWARD 5 IN liahona; MOVE -- 抓取游标 liahona 里的第六行: FETCH 1 IN liahona; FETCH code | title | did | date_prod | kind | len -------+--------+-----+-----------+--------+------- P_303 | 48 Hrs | 103 | 1982-10-22| Action | 01:37 (1 row) -- 关闭游标 liahona 并提交工作: CLOSE liahona; COMMIT WORK;