Creating remote procedures

Use one of the following procedures to issue a remote procedure call.

Remote procedures accept input parameters up to 254 bytes in length, and return up to 254 characters in output variables.

If a remote procedure can return a result set, even if it does not return one in all cases, then the local procedure definition must contain a RESULT clause.

To create a remote procedure (Sybase Central)

  1. Connect to the host database as a user with DBA authority.

  2. In the left pane, double-click Remote Servers.

  3. Select the remote server, and in the right pane click the Remote Procedures tab.

  4. From the File menu, choose New » Remote Procedure.

  5. Follow the instructions in the Create Remote Procedure Wizard.

To create a remote procedure (SQL)

  1. Connect to the database as a user with DBA authority.

  2. Define the procedure to SQL Anywhere.

    The syntax is the same as a local procedure definition, except instead of using SQL statements to make up the body of the procedure, a location string is given defining the location where the procedure resides.

    CREATE PROCEDURE remotewho()
    AT 'bostonase.master.dbo.sp_who';

For more information, see CREATE PROCEDURE statement.

To issue a remote procedure call (SQL)

  1. Connect to the database as a user with DBA authority.

  2. Execute the procedure as follows:

    CALL remotewho();
Example

This example specifies a parameter when calling a remote procedure:

CREATE PROCEDURE remoteuser ( IN uname CHAR( 30 ) )
AT 'bostonase.master.dbo.sp_helpuser';
CALL remoteuser( 'joe' );
Data types for remote procedures

The following data types are allowed for RPC parameters: