Raising error in postgreSQL

前端 未结 3 1253
無奈伤痛
無奈伤痛 2021-02-20 03:45
CREATE OR REPLACE FUNCTION msgfailerror() RETURNS trigger AS 
\' BEGIN 
    IF NEW.noces< new.first_column THEN 
        RAISE EXCEPTION \'cannot have a negative sala         


        
3条回答
  •  孤城傲影
    2021-02-20 03:59

    there is nothing wrong with you the only thing is using quotes

    please change :

    RAISE EXCEPTION 'cannot have a negative salary';
    

    to:

    RAISE EXCEPTION ''cannot have a negative salary'';
    

    '' is different from "

    '' = two single quotes

提交回复
热议问题