文档中心MogDBMogDB StackUqbar
v5.0

文档:v5.0

支持的版本:

其他版本:

支持增加存储过程及函数参数的nocopy属性

可获得性

本特性自MogDB 5.0.0版本开始引入。

特性简介

支持在创建存储过程、函数、包里的存储过程及函数的语法中支持nocopy属性。

客户价值

增强MogDB与Oracle的兼容性,减少应用程序的迁移代价。

特性描述

本特性在CREATE FUNCTION和CREATE PROCEDURE语法中添加NOCOPY关键字。在CREATE PACKAGE语法中,当package中包含函数或存储过程时,函数或存储过程的语法中添加NOCOPY关键字。

特性约束

  • 仅兼容语法,不做具体的功能。

语法描述

CreateFunction ::= CREATE [ OR REPLACE  ] FUNCTION function_name
        [ ( [  { argname [ argmode  ] [NOCOPY] argtype [  { DEFAULT  | ':='  | =  } expression  ]}  [, ...]  ] ) ]
        [ RETURNS rettype [ DETERMINISTIC  ]  | RETURNS TABLE (  { column_name column_type  }  [, '...'] )]
        LANGUAGE lang_name
        [
           {IMMUTABLE  | STABLE  | VOLATILE }
      | {SHIPPABLE | NOT SHIPPABLE}
            | WINDOW
            | [ NOT  ] LEAKPROOF
            | {CALLED ON NULL INPUT  | RETURNS NULL ON NULL INPUT | STRICT }
            | {[ EXTERNAL  ] SECURITY INVOKER | [ EXTERNAL  ] SECURITY DEFINER | AUTHID DEFINER  | AUTHID CURRENT_USER}
            | {fenced | not fenced}
            | {PACKAGE}
            | COST execution_cost
            | ROWS result_rows
            | SET configuration_parameter { {TO | =} value | FROM CURRENT }

         ]['...']
        {
            AS 'definition'
        }
CreateProcedure ::= CREATE [ OR REPLACE ] PROCEDURE procedure_name
    [ ( {[ argmode ] [ argname ] [NOCOPY] argtype [ { DEFAULT | ':=' | = } expression ]}[, '...']) ]
    [
       { IMMUTABLE | STABLE | VOLATILE }
       | { SHIPPABLE | NOT SHIPPABLE }
       | {PACKAGE}
       | [ NOT ] LEAKPROOF
       | { CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT }
       | {[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER | AUTHID DEFINER | AUTHID CURRENT_USER}
       | COST execution_cost
       | SET configuration_parameter { TO value | = value | FROM CURRENT }
    ][ '...' ]
 { IS | AS }
plsql_body

示例

CREATE FUNCTION FUN_NOCOPY_TEST (a IN nocopy INT) RETURNS INT AS
$$
SELECT a + 1;$$
LANGUAGE SQL;
Copyright © 2011-2024 www.enmotech.com All rights reserved.