给标识符指定别名

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

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