Select to view content in your preferred language

Prevent deletes in versioned feature classes

1159
1
08-22-2020 04:46 PM
Status: Open
Labels (1)
Bud
by
Esteemed Contributor

In unversioned feature classes, we can control privileges through Catalog for SELECT, INSERT, UPDATE, DELETE (using any combination).

 

However, with versioned feature classes, we can only control INSERT, UPDATE, and DELETE as a group (all-or-nothing).

 

We can't allow INSERTS and UPDATES, yet prevent DELETES.

 

It would be great if we could prevent just DELETES in versioned feature classes.

 

Thanks!

1 Comment
Bud
by

CREATE OR REPLACE TRIGGER D202574_custom
BEFORE INSERT ON D202574
FOR EACH ROW
DECLARE
    v_upd_row NUMBER;
BEGIN
    SELECT COUNT(1) INTO v_upd_row
    FROM A202574
    WHERE objectid = :new.sde_deletes_row_id
    AND sde_state_id = :new.deleted_at;

    IF v_upd_row = 0 THEN
        raise_application_error(-20001, 'Deleting has been disabled via a custom trigger.');
    END IF;
END ;