Example: Replicating to an Oracle Replicate Database

Replicate a stored procedure with BOOLEAN arguments to an 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. Create a function string on Replication Server:
    create function string ra$xxx_boolproc.boolproc
                            for rs_oracle_function_class
                            output language 
                            'begin execute immediate "begin ra_user.boolproc
    (?a!param?=1,?b!param?);;end;;";;end;;'
                            go
  4. 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);