Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Ensures that a skeletal instance of an object exists before executing an ALTER statement.
sa_make_object( objtype, objname [, owner [, tabname ] ] )
objtype: 'procedure' | 'function' | 'view' | 'trigger' | 'service' | 'event'
objtype Use this CHAR(30) parameter to specify the type of object being created. If objtype is 'trigger', this argument specifies the owner of the table on which the trigger is to be created.
objname Use this CHAR(128) parameter to specify the name of the object to be created.
owner Use this optional CHAR(128) parameter to specify the owner of the object to be created. The default value is CURRENT USER.
tabname This CHAR(128) parameter is required only if objtype is 'trigger', in which case you use it to specify the name of the table on which the trigger is to be created.
This procedure is useful in scripts or command files that are run repeatedly to create or modify a database schema. A common problem in such scripts is that the first time they are run, a CREATE statement must be executed, but subsequent times an ALTER statement must be executed. This procedure avoids the necessity of querying the system views to find out whether the object exists.
To use the procedure, follow it by an ALTER statement that contains the entire object definition.
Resource authority is required to create or modify database objects
The following statements ensure that a skeleton procedure definition is created, define the procedure, and grant permissions on it. A command file containing these instructions could be run repeatedly against a database without error.
CALL sa_make_object( 'procedure','myproc' ); ALTER PROCEDURE myproc( in p1 INT, in p2 CHAR(30) ) BEGIN // ... END; GRANT EXECUTE ON myproc TO public;
The following example uses the sa_make_object system procedure to add a skeleton web service.
CALL sa_make_object( 'service','my_web_service' );
|Discuss this page in DocCommentXchange.
Send feedback about this page using email.
|Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|