"SQL" Persistence storage module PSM

Source: Internet
Author: User

1. Creating PSM functions and procedures

To create a process:

CREATE PROCEDURE Name (parameter)

Partial declaration;

Process body;

To create a function:

CREATE FUNCTION Name (parameter) RETURNS type

Partial declaration;

Process body;

Parameters of the procedure: pattern-name-ternary group of type. Mode has in , out, INOUT, default in

Parameters of the function: only in.

CREATE PROCEDURE Move (    invarchar(255),    invarchar(  255))UPDATE  moviestarSET=  newaddress WHERE = oldaddress;

2. Simple statements in PSM

2.1 Call Statement:

Call Procedure name (parameter)

Called form in the host language:EXEC SQL Call Foo (: x, 3);

As a statement in another PSM

As a SQL command sent to the basic SQL interface (no function is called): CallFoo (1, 3);

2.2 Return statement:

RETURN expression;

Can only appear in the function, the PSM return statement does not end the function, and the return value may change before the function is complete.

2.3 Local variable Declaration

DECLARE name type;

2.4 Assignment Statements

SET variable = expression;

2.5 Statement Groups

Ends with a semicolon, placed between begin and end

2.6 Statement Label

Use a name and a colon as a prefix to identify the statement.

3. Branch statements

IF condition Then

"SQL" Persistence storage module PSM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.