Sybase 12.4.2 manual Statements allowed in batches, Verifying procedure input arguments, 267

Models: 12.4.2

1 536
Download 536 pages 20.34 Kb
Page 287
Image 287

CHAPTER 6 Using Procedures and Batches

Verifying procedure input arguments

You can verify that input arguments to a procedure are passed correctly in several ways.

You can display the value of the parameter on the message window of the server using the MESSAGE statement. For example, the following procedure simply displays the value of the input parameter var:

CREATE PROCEDURE message_test (IN var char(40))

BEGIN

MESSAGE var;

END

You can do the following from Interactive SQL:

Create the procedure.

Call the procedure:

CALL MESSAGE_TEST (’Test Message’);

After calling the procedure on a Windows NT system, double click the server icon in the system tray to ensure that the message was passed properly to the server.

SELECT GLOBALVAR

Statements allowed in batches

The following statements are not allowed in batches:

CONNECT or DISCONNECT statement

ALTER PROCEDURE or ALTER FUNCTION statement

DBISQL commands such as OUTPUT

Otherwise, any SQL statement is allowed, including data definition statements such as CREATE TABLE, ALTER TABLE, and so on.

The CREATE PROCEDURE statement is allowed, but must be the final statement of the batch. Therefore a batch can contain only a single CREATE PROCEDURE statement.

267

Page 287
Image 287
Sybase 12.4.2 manual Statements allowed in batches, Verifying procedure input arguments, 267