云数据库 GaussDB-隐式游标

时间:2025-01-26 10:39:38
 1 2 3 4 5 6 7 8 910111213141516171819202122
CREATE TABLE hr.staffs_t1 AS TABLE hr.staffs;CREATE TABLE hr.sections_t1 AS TABLE hr.sections;--删除员工表hr.staffs中某部门的所有员工,如果该部门中已没有员工,则在部门表hr.sections中删除该部门。CREATE OR REPLACE PROCEDURE proc_cursor3() AS     DECLARE    V_DEPTNO NUMBER(4) := 100;    BEGIN        DELETE FROM hr.staffs WHERE section_ID = V_DEPTNO;        --根据游标状态做进一步处理        IF SQL%NOTFOUND THEN        DELETE FROM hr.sections_t1 WHERE section_ID = V_DEPTNO;        END IF;    END;/CALL proc_cursor3();--删除存储过程和临时表DROP PROCEDURE proc_cursor3;DROP TABLE hr.staffs_t1;DROP TABLE hr.sections_t1;
support.huaweicloud.com/centralized-devg-v2-gaussdb/gaussdb_42_0592.html