:meta-keywords: procedure definition, create procedure, drop procedure, function definition, create function, drop function
:meta-description: Define functions/procedures in CUBRID database using create procedure, create function, drop procedure and drop function statements.
************************************************
STORED FUNCTION/PROCEDURE DEFINITION STATEMENTS
************************************************
.. _create-procedure:
CREATE PROCEDURE
=================
Create stored procedure using the **CREATE PROCEDURE** statement.
::
CREATE [OR REPLACE] PROCEDURE [schema_name.]procedure_name ([ [, ] ...])
[]
{IS | AS} LANGUAGE
COMMENT 'procedure_comment';
::= parameter_name [mode] sql_type [ { DEFAULT | = } ] [COMMENT 'parameter_comment_string']
::= [PLCSQL | JAVA]
::= IN | OUT | IN OUT | INOUT
::=
= AUTHID {DEFINER | OWNER | CALLER | CURRENT_USER}
You can use the **OR REPLACE** clause to replace or create a new stored function/procedure.
* *schema_name*: Specifies the schema name. If omitted, the schema name of the current session is used.
* *procedure_name*: Specifies the name of the stored procedure to be created (maximum 222 bytes).
* *parameter_name*: Specifies the name of the parameter (maximum 254 bytes).
* *sql_type*: Specifies the data type of the parameter. For available data types, refer to :ref:`pl-arg-type-restriction`.
* *default_arg*: Specifies the default value of the parameter. Refer to :ref:`pl-arg-default`.
* *authid*: Specifies the execution authority of the stored procedure. For more details, refer to :ref:`pl-authid`.
* *parameter_comment_string*: Specifies the comment string for the parameter.
* *body*: Specifies the body of the stored procedure.
* *procedure_comment*: Specifies the comment string for the stored procedure.
COMMENT of Stored Procedure
-----------------------------------
A comment of stored function/procedure can be written at the end of the statement as follows.
.. code-block:: sql
CREATE FUNCTION Hello() RETURN VARCHAR
AS LANGUAGE JAVA
NAME 'SpCubrid.HelloCubrid() return java.lang.String'
COMMENT 'function comment';
A comment of a paramenter can be written as follows.
.. code-block:: sql
CREATE OR REPLACE FUNCTION test(i in int COMMENT 'arg i')
RETURN int AS LANGUAGE JAVA NAME 'SpTest.testInt(int) return int' COMMENT 'function test';
A comment of a stored function/procedure can be shown by running the following syntax.
.. code-block:: sql
SELECT sp_name, comment FROM db_stored_procedure;
A comment for a parameter of a function can be shown by running the following syntax.
.. code-block:: sql
SELECT sp_name, arg_name, comment FROM db_stored_procedure_args;
Checking the Published Java Stored Procedure Information
-------------------------------------------------------------------
You can check the information on the published Java stored procedure.
The **db_stored_procedure** system virtual table provides the information on stored names and types, return types, number of parameters, Java class specifications, and the owner.
The **db_stored_procedure_args** system virtual table provides the information on parameters used in the stored function/procedure.
.. code-block:: sql
SELECT * FROM db_stored_procedure WHERE sp_type = 'PROCEDURE';
::
sp_name sp_type return_type arg_count lang target owner
================================================================================
'athlete_add' 'PROCEDURE' 'void' 4 'JAVA''Athlete.Athlete(java.lang.String, java.lang.String, java.lang.String, java.lang.String)' 'DBA'
.. code-block:: sql
SELECT * FROM db_stored_procedure_args WHERE sp_name = 'athlete_add';
::
sp_name index_of arg_name data_type mode
=================================================
'athlete_add' 0 'name' 'STRING' 'IN'
'athlete_add' 1 'gender' 'STRING' 'IN'
'athlete_add' 2 'nation_code' 'STRING' 'IN'
'athlete_add' 3 'event' 'STRING' 'IN'
.. _create-function:
CREATE FUNCTION
=================
Create stored function using the **CREATE FUNCTION** statement.
::
CREATE [OR REPLACE] FUNCTION [schema_name.]function_name ([ [, ] ...])
RETURN sql_type
[]
{IS | AS} LANGUAGE
COMMENT 'function_comment';
::= parameter_name [mode] sql_type [] [COMMENT 'param_comment_string']
::= { DEFAULT | = }
::= |
= AUTHID {DEFINER | OWNER | CALLER | CURRENT_USER}
= [NOT DETERMINISTIC | DETERMINISTIC]
::= [PLCSQL | JAVA]
::= IN | OUT | IN OUT | INOUT
* *schema_name*: Specifies the schema name (up to 31 bytes). If omitted, the schema name of the current session is used.
* *function_name*: Specifies the name of the stored function to be created (up to 222 bytes).
* *parameter_name*: Specifies the name of the parameter (up to 254 bytes).
* *sql_type*: Specifies the data type of the parameter or return value. For available data types, refer to :ref:`pl-arg-type-restriction`.
* *default_arg*: Specifies the default value of the parameter. Refer to :ref:`pl-arg-default`.
* *param_comment_string*: Specifies the comment string for the parameter.
* *authid*: Specifies the execution authority of the stored function. For more details, refer to :ref:`pl-authid`.
* *deterministic*: Specifies whether the stored function is deterministic. For more details, refer to :ref:`pl-deterministic`.
* *body*: Specifies the body of the stored function.
* *function_comment*: Specifies the comment string for the stored function.
COMMENT of Stored Function
----------------------------------
A comment of stored function/procedure can be written at the end of the statement as follows.
.. code-block:: sql
CREATE FUNCTION Hello() RETURN VARCHAR
AS LANGUAGE JAVA
NAME 'SpCubrid.HelloCubrid() return java.lang.String'
COMMENT 'function comment';
A comment of a paramenter can be written as follows.
.. code-block:: sql
CREATE OR REPLACE FUNCTION test(i in int COMMENT 'arg i')
RETURN int AS LANGUAGE JAVA NAME 'SpTest.testInt(int) return int' COMMENT 'function test';
A comment of a stored function/procedure can be shown by running the following syntax.
.. code-block:: sql
SELECT sp_name, comment FROM db_stored_procedure;
A comment for a parameter of a function can be shown by running the following syntax.
.. code-block:: sql
SELECT sp_name, arg_name, comment FROM db_stored_procedure_args;
Checking the Published Java Stored Function Information
---------------------------------------------------------
You can check the information on the published Java stored function.
The **db_stored_procedure** system virtual table provides the information on stored names and types, return types, number of parameters, Java class specifications, and the owner.
The **db_stored_procedure_args** system virtual table provides the information on parameters used in the stored function/procedure.
.. code-block:: sql
SELECT * FROM db_stored_procedure WHERE sp_type = 'FUNCTION';
::
sp_name sp_type return_type arg_count lang target owner
================================================================================
'hello' 'FUNCTION' 'STRING' 0 'JAVA''SpCubrid.HelloCubrid() return java.lang.String' 'DBA'
'sp_int' 'FUNCTION' 'INTEGER' 1 'JAVA''SpCubrid.SpInt(int) return int' 'DBA'
.. code-block:: sql
SELECT * FROM db_stored_procedure_args WHERE sp_name = 'sp_int';
::
sp_name index_of arg_name data_type mode
=================================================
'sp_int' 0 'i' 'INTEGER' 'IN'
DROP PROCEDURE
==============
In CUBRID, A stored proceudre can be deleted using the **DROP PROCEDURE** statement.
Also, you can delete multiple stored procedures at the same time with several *procedure_name*\s separated by a comma (,).
::
DROP PROCEDURE procedure_name [{ , procedure_name , ... }];
* *procedure_name*: Specifies the name of procedure to delete
.. code-block:: sql
DROP PROCEDURE hello, sp_int;
A stored procedure can be deleted only by the user who published it or by DBA members.
For example, if a **PUBLIC** user published the 'sp_int' stored procedure, only the **PUBLIC** or **DBA** members can delete it.
DROP FUNCTION
==============
In CUBRID, A stored function can be deleted using the **DROP FUNCTION** statement.
You can also delete multiple stored functions at the same time by specifying several *function_name*\s separated by commas (,).
::
DROP FUNCTION function_name [{ , function_name , ... }];
* *function_name*: Specifies the name of function to delete
.. code-block:: sql
DROP FUNCTION hello, sp_int;
A stored function can be deleted only by the user who published it or by DBA members.
For example, if a **PUBLIC** user published the 'sp_int' stored function, only the **PUBLIC** or **DBA** members can delete it.
Day widened into its first perfection as we moved down the highroad toward a near fork whose right was to lead Harry and his solemn cortége southward, while the left should be our eastward course. Camille and I rode horseback, side by side, with no one near enough to smile at my sentimental laudations of the morning's splendors, or at her for repaying my eloquence with looks so full of tender worship, personal acceptance and self-bestowal, that to tell of them here would make as poor a show as to lift a sea-flower out of the sea; they call for piccolo notes and I am no musician. The little man elected to have a cab. When Bow Street was reached Prout had the satisfaction of finding that all his birds had been netted. He received the warm congratulations of his inspector modestly. Caloric or air engines. I did not feel very comfortable after what had happened to those soldiers who lost their lives so cruelly sudden, or in any case had been seriously wounded, while the officers took little notice of them. But it was desirable to behave as discreetly as possible, and so to get a permit to Maastricht. "Louvain, “It will check up, that way, too,” smiled Larry. "Me run away," thought Shorty, as they walked along. "Hosses couldn't drag me away. I only hope that house is 10 miles off." Reuben began to take off his coat—young Realf drew back almost in disgust. "Well, would Robert have stolen money, or Albert disgraced your name, to get free, if you and your farm hadn't made them slaves? If you hadn't been a heartless slave-driver would George have died the other night alone on the Moor?—or would Richard have taken advantage of a neighbour's charity to escape from you? Don't you see that your ambition has driven you to make slaves of your children?" "D?an't tell me," said Coalbran in the bar, "as it wurn't his fault. Foot-and-mouth can't just drop from heaven. He must have bought some furriners, and they've carried it wud 'em, surelye." But meantime a strange restlessness consumed her, tinctured by a horrible boldness. There were moments when she no longer was afraid of Handshut, when she felt herself impelled to seek him out, and make the most of the short time they had together. There could be no danger, for he was going so soon ... so few more words, so few more glances.... Thus her mind worked. "What mean you, woman?" quickly returned De Boteler; "do you accuse the keeper of my chase as having plotted against your son, or whom do you suspect?" Her face was shrivelled and yellow, and the dark full eyes that now, as it were, stood forth from the sunken cheeks, looked with a strange brightness on the scene, and seemed well adapted to stamp the character of witch on so withered a form. And perhaps there were few of those entirely uninterested in the matter who now gazed upon her, who would not have sworn that she merited the stake. "Thou art set over the people, and to the Lord's anointed I come to seek for justice." HoME欧美一级毛片免费高清日韩
ENTER NUMBET 0018difansen.com.cn
zgsjysp.com.cn
www.saoai.com.cn
jstiandiheth.com.cn
www.jlfwangxijia.com.cn
cz-ph.com.cn
www.miasole.com.cn
www.gmwu.com.cn
fcjn492.com.cn
www.tianfu2.com.cn