IF...THEN...END IF

最近更新时间: 2024-06-12 15:06:00

postgres=# CREATE OR REPLACE FUNCTION f26() RETURNS VOID AS
postgres-# $$    
postgres$# BEGIN           
postgres$#     IF random()>0.5 THEN
postgres$#         RAISE NOTICE '随机数大于0.5';
postgres$#     END IF;
postgres$# END;
postgres$# $$
postgres-# LANGUAGE plpgsql;
CREATE FUNCTION
postgres=# select f26();
NOTICE:  随机数大于0.5
 f26 
-----
(1 row)
postgres=#