SET SUBSCRIPTION

From InterBase
Jump to: navigation, search

Go Up to Statement and Function Reference (Language Reference Guide)


A user is then granted SUBSCRIBE privilege to subscribe to the subscription in order to track changes on the listed tables:

SET SUBSCRIPTION [<subscription_name> [, <subscription_name> ...]] [AT <destination>] {ACTIVE | INACTIVE};
Argument Description

<subscription_name>

Implied by the user identity of the database

<user_name>

User identify of the database connection

Description: The following example activates two subscriptions and returns changed data sets from the subscribed tables.

  • The COMMIT updates all subscriptions for schema objects referenced during the transaction to set the last observed timestamp and transaction context.
  • The COMMIT RETAIN does not change the last observed state and maintains the current snapshot as always.
  • The subscription is deactivated for the connection, which makes any subsequent queries against the subscribed schema objects return normal data sets, without regard to the changed data status.
  • Any number of subscriptions can be activated simultaneously during a database connection.

Example:

SET SUBSCRIPTION "Employee_Changes", "Customer_Deletes" AT 'smartphone_123'

ACTIVE;

SELECT NAME, DEPARTMENT, SALARY FROM "Employees";

SELECT * FROM "Customers";

COMMIT or COMMIT RETAIN;

SET SUBSCRIPTION "Employee_Changes", "Customer_Deletes" AT 'smartphone_123'

INACTIVE;

See Also

Advance To: