HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

Support For Adding Nocopy Attributes To Procedure And Function Parameters

Availability

This feature is available since MogDB 5.0.0.

Introduction

Support for the nocopy attribute in the syntax for creating stored procedures, functions, stored procedures in packages and functions.

Benefits

Enhance MogDB compatibility with Oracle to reduce application migration costs.

Description

This feature adds the NOCOPY keyword to the CREATE FUNCTION and CREATE PROCEDURE syntax. This feature adds the NOCOPY keyword to the CREATE PACKAGE syntax when the package contains a function or procedure.

Constraints

  • Compatible syntax only, no specific features.

Syntax Description

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

Example

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.