You must explicitly begin each synchronization message that is sent from the replica to the master database with the MESSAGE BEGIN statement. The syntax is:
For the message, provide a name that is unique within the replica database. Be sure to also set autocommit to off. Any open transaction must be committed or rolled back in the connection before executing this statement.
Note Use the optional TO clause if you want to send a message that contains the REGISTER REPLICA command and are registering a replica with a master that resides in a database catalog other than the default catalog. For details on registration, see Registering replicas with the master database.
If you want to create and execute a synchronization message from a stored procedure, here is an example of how to create a synchronization message with a unique message name.
DECLARE Autoname VARCHAR;
DECLARE MsgBeginStr VARCHAR;
Autoname := GET_UNIQUE_STRING('MSG_') ;
MsgBeginStr := 'MESSAGE ' + autoname + ' BEGIN';
Once you have composed the SQL statement as a string, you can execute it inside a stored procedure in one of two ways — either by using the EXECDIRECT feature, or by preparing and executing the SQL statement.
EXEC SQL EXECDIRECT MsgBeginStr;
or
EXEC SQL PREPARE cursor1 MsgBeginStr; EXEC SQL EXECUTE cursor1; EXEC SQL CLOSE cursor1; EXEC SQL DROP cursor1;