命名参数

最近更新时间: 2025-02-18 16:02:00

  • 复制
    复制成功
postgres=# CREATE OR REPLACE FUNCTION f2(a_xm text) RETURNS TEXT AS
postgres-# $$
postgres$# DECLARE
postgres$#     v_xm ALIAS FOR $1;
postgres$# BEGIN
postgres$#     RAISE NOTICE 'a_xm = % ; v_xm = % ; $1 = %',a_xm,v_xm,$1;
postgres$#     RETURN $1;
postgres$# END;
postgres$# $$
postgres-# LANGUAGE PLPGSQL;
CREATE FUNCTION
postgres=#
postgres=# SELECT * FROM f2('TDSQL PG');
NOTICE:  a_xm = TDSQL PG ; v_xm = TDSQL PG ; $1 = TDSQL PG
  f2
------
 TDSQL PG
(1 行记录)