WHENEVER SQLERROR EXIT SQL.SQLCODE

CREATE OR REPLACE DATA GRANT seller_own_orders
  AS SELECT (order_id, customer_name, region, seller, amount)
  ON dds_orders
  WHERE UPPER(seller) = ORA_END_USER_CONTEXT.username
  TO seller_role;

CREATE OR REPLACE DATA GRANT latam_manager_orders
  AS SELECT
  ON dds_orders
  WHERE region = 'LATAM'
  TO latam_manager_role;

BEGIN
  EXECUTE IMMEDIATE 'SET USE DATA GRANTS ONLY ON dds_orders ENABLED';
END;
/
