use 
RAISE exception_name;RAISE_APPLICATION_ERROR (
   num BINARY_INTEGER,
   msg VARCHAR2,
   keeperrorstack BOOLEAN DEFAULT FALSE);
see examples at
http://www.promemoria.net/oreilly/books/oracle/langpkt/ch01_10.htm

解决方案 »

  1.   

    saucer(思归, MS .NET MVP) 兴致真好啊,这里也来了,佩服
      

  2.   

    谢谢,我试了一下,试出来了,但是还不知道 keeperrorstack 参数的具体作用,我现在是把这个参数省了,请问 keeperrorstack 的意义是什么呢?
      

  3.   

    According to
    http://www.promemoria.net/oreilly/books/oracle/bipkt/ch01_03.htmPROCEDURE DBMS_STANDARD.RAISE_APPLICATION_ERROR
        (num BINARY_INTEGER
        ,msg VARCHAR2
        ,keeperrorstack boolean default FALSE);
    Raises PL/SQL exception num, together with text msg from a stored program. The error can be placed together with any other errors on the error stack. If keeperrorstack is set to TRUE, default behavior is to replace the error stack with this single exception. ===============================================================
    The explanation seems to be contrary to what I think it should be, :-)