Exemples d’utilisation d’un curseur nommé
CREATE OR ALTER TRIGGER TBU_STOCK
BEFORE UPDATE ON STOCK
AS
-- Annonce d'un curseur nommé
DECLARE C_COUNTRY CURSOR FOR (
SELECT
COUNTRY,
CAPITAL
FROM COUNTRY
);
BEGIN
/* Instructions PSQL */
END
EXECUTE BLOCK
RETURNS (
N INT,
RNAME CHAR(63))
AS
-- Annonce d'un curseur défilant
DECLARE C SCROLL CURSOR FOR (
SELECT
ROW_NUMBER() OVER(ORDER BY RDB$RELATION_NAME) AS N,
RDB$RELATION_NAME
FROM RDB$RELATIONS
ORDER BY RDB$RELATION_NAME);
BEGIN
/* Instructions PSQL */
END