SAP Hana 数据库游标使用方法示例
游标使用示例:将zhangsan用户的创建时间更新成当前时间。
DO
BEGIN
DECLARE CURSOR M_CURR FOR
SELECT ID FROM USER WHERE NAME = 'zhangsan';
DECLARE CUR_TIME TIMESTAMP;
SELECT CURRENT_TIMESTAMP INTO CUR_TIME FROM dummy;
FOR M_CURR_ROW AS M_CURR DO
UPDATE USER SET CREATE_TIME = CUR_TIME
WHERE ID = M_CURR_ROW.ID;
END FOR;
END