云数据库 GaussDB-CREATE FUNCTION:语法格式

时间:2023-11-01 16:22:10

语法格式

  • 兼容PostgreSQL风格的创建自定义函数语法。
    CREATE [ OR REPLACE  ] FUNCTION function_name     [ ( [  { argname [ argmode  ] 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'    }
  • A数据库风格的创建自定义函数的语法。
    CREATE [ OR REPLACE  ] FUNCTION function_name     ( [  { argname [ argmode  ] argtype [  { DEFAULT | := | =  } expression  ] }  [, ...]  ] )    RETURN rettype [ DETERMINISTIC  ]    [         {IMMUTABLE  | STABLE  | VOLATILE }         | {SHIPPABLE | NOT SHIPPABLE}        | {PACKAGE}        | {FENCED | NOT FENCED}        | [ 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          | ROWS result_rows          | SET configuration_parameter { {TO | =} value  | FROM CURRENT        | LANGUAGE lang_name    ][...]     {       IS  | AS} plsql_body/
support.huaweicloud.com/centralized-devg-v2-opengauss/devg_03_0551.html