Example: Replicating to a Non-Oracle Database

Replicate a stored procedure with BOOLEAN arguments to a non-Oracle replicate database.

To replicate a stored procedure defined by these PL/SQL statements:

CREATE PROCEDURE boolproc (a IN BOOLEAN, b INT) AS
                BEGIN
                   IF (a = true) THEN
                      DBMS_OUTPUT.PUT_LINE('True');
                   ELSE
                      DBMS_OUTPUT.PUT_LINE('False or NULL');
                   ENDIF;
                END;
  1. Manually create a replication definition on Replication Server using this RCL command:
    create function replication definition ra$xxx_boolproc
                            with primary at myprimary.pdb
                            with all functions named boolproc (
                            @"a" rs_oracle_decimal
                            @"b" rs_oracle_decimal )
                            searchable parameters(@"a", @"b")
                            send standby all parameters
    Note: If the Replication Agent pdb_auto_create_repdefs configuration parameter is set to true, a replication definition will be created automatically.
  2. Mark the stored procedure for replication:
    pdb_setrepproc boolproc, mark
  3. Adaptive Server Enterprise does not support BOOLEAN stored procedure arguments, so you must map the Oracle stored procedure BOOLEAN argument to an integer argument for the corresponding stored procedure at the replicate database.
  4. Create a stored procedure, defined by this Transact-SQL® statement, at the replicate database:
    create proc boolproc (@a int, @b int) as
                            if @a = 1
                               print 'True'
                            else
                               print 'False or NULL'
                            go
  5. Create a subscription on Replication Server for the replication definition:
    create subscription sub_intproc
                            for ra$xxx_boolproc
                            with replicate at myreplicate.rdb
                            go

The stored procedure is replicated when it is executed at the primary database:

EXECUTE boolproc(true,1);

However, the boolproc procedure at the replicate Adaptive Server Enterprise will be invoked with an integer value instead of a BOOLEAN argument:

boolproc 1, 1
go