Example 2: Replicating to a non-Oracle database

The user wants to replicate a stored procedure defined by the following PL/SQL:

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;

The user manually creates a replication definition on Replication Server using the following RCL:

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

NoteIf the Replication Agent pdb_auto_create_repdefs configuration parameter is set to true, a replication definition will be created automatically.

The user then marks the stored procedure for replication:

pdb_setrepproc boolproc, mark

Adaptive Server Enterprise does not support boolean-type stored procedure arguments, so the user maps the Oracle stored procedure BOOLEAN argument to an integer argument for the corresponding stored procedure at the replicate database.

The user creates a stored procedure, defined by the following Transact-SQL, at the replicate database:

create proc boolproc (@a int, @b int) as
if @a = 1
   print 'True'
else
   print 'False or NULL'
go

The user then creates 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 will be 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