Show TOC

Changes to create subscriptionLocate this document in the navigation structure

The syntax for the create subscription command has been modified. The command now supports "and", "or", and "in value list" operators in subscription where clauses. The only limitation is that each sub-clause in "and" and "or" must conform to the standards that SAP Replication Server currently accepts. Syntax and examples below illustrate the use of these operators.

Syntax

Syntax to create a database subscription:

create subscription <subname>
for database replication definition <repdefname>
with primary at <pdsname>.<pdbname>
with replicate at <rdsname>.<rdbname>
{with materialization 
[init replicate table with {create | create_or_truncate | truncate | recreate} 
[date time]
[user <username> password <password>]]
| without materialization}
[subscribe to truncate table]
Syntax to create a non-database subscription:
create subscription <subname> 
for {table_repdef | func_repdef | publication pub}
[with primary at <pdsname>.<pdbname>]
with replicate at <rdsname>.<rdbname>
[where 
      {{column_name | @param_name}
      {< | > | >= | <= | = | &} value
      [and {column_name | @param_name}
      {< | > | >= | <= | = | &} value]...
      [or where { column_name | @param_name }
      {< | > | >= | <= | = | &} value
      [and {column_name |@param_name}
      {< | > | >= | <= | = | &} value]...]} |
      {{column_name | @param_name}
      in (value1,value2,value3...)
      [and {column_name | @param_name}
      in (value1,value2,value3...)]...
      [or where { column_name | @param_name }
      in (value1,value2, value3...)
      [and {column_name |@param_name}
      in(value1,value2,value3...)...]...]}]
[without holdlock [direct_load [init replicate table with {create |
      create_or_truncate | truncate | recreate}]
      [user username password pass][num_of_selects selects]
[hold_resource_on_error]]| incrementally | without materialization]
[subscribe to truncate table]
[for new articles]
Examples
Example 1
Create a subscription with the "or" keyword in the "where" clause:
create subscription tb_name_demo
for tb_name_repdefdemo
with replicate at rqa10.tdb2
where col1 > 20
and col1 < 100
or where col2 = 'charvalue0'
or where col3 = 'varcharvalue0'
Example 2
Create a subscription with the "in value list" keyword in the "where" clause:
create subscription tb_name_subdemo
for tb_name_repdefdemo
with replicate at rqa10.tdb2
where col2 in ('charvalue0','charvalue2', 'charvalue3','charvalue4')
or where col3 in ('varcharvalue0')

For more information, refer to the SAP Replication Server Reference Manual.