PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔䆹37. PL/pgSQL - SQL 誺䘋臺蘔媆誕嬉誕

37.9. 髍臇启潽敇

彷䫘 RAISE 臺埖檖只媇敇傖埪檕庺髍臇㔗

RAISE level 'format' [, expression [, ...]];

埇脘䔇亓彆橬 DEBUG(劏橉媇単斖媖喍媇敇), LOG(劏橉媇単斖媖喍媇敇嚻噽亓敘醻), INFO, NOTICE, WARNING(檪媇敇喍彄橉媇単斖媖傖埪蘸埏彄垵潙䆇庫䫘嚻噽亓锊準剺醻), EXCEPTION(檕庺婔婻髍臇锔婩锔庺嘷嬉庋媇)㔗昊婻嚻噽亓彆䔇媇敇滇檖只䂍垵潙䆇誻滇喍彄橉媇単斖媖誻滇婴婻鄘啔滇䫌 log_min_messagesclient_min_messages 陉䘞埻麟毓彽䔇㔗埗黙䆹17诙埡敘崔䂖誗㔗

婘湚嚟庖严婾麯% 赆婋婔婻埇锬埗昄䔇崡鄘臘䯄嘵嚟傼敪㔗襕臘䴺 % 庖严媙釂埯喍(%%)㔗埗昄埇傖滇䞔剘䔇埻麟潡蔙臘膆嚟蔯湚嚟媙釂滇婔婻䞔剘䔇庖严婾桺橸㔗

婘認婻冋床麯v_job_id 䔇唚儖傼敪庖严婾婺䔇 %

RAISE NOTICE 'Calling cs_create_job(%)', v_job_id;

認婻冋床儖嚔婥五䂍庺䔇髍臇媇敇锔庺庋媇

RAISE EXCEPTION 'Nonexistent ID --> %', user_id;

RAISE EXCEPTION 䕞嬉攂滇䫘潊劯湙䔇 SQLSTATE 傼乕(P0001)婉䞇脄䫘垄䔇媇敇滇傔幽㔗埇傖䫘 EXCEPTION ... WHEN RAISE_EXCEPTION THEN ... 托诙認湙䔇嚗婩嘖滇方濘傯婔婻 RAISE 麯只臬埥崡婔婻䕩噿䔇䪽攕㔗


劯锔饡釕嬉誕
橩湺婪婔亓蓥埏単誺䘋