From: | Emi Lu <emilu(at)encs(dot)concordia(dot)ca> |
---|---|
To: | "Pedro B(dot)" <pedro(dot)borracha(at)netcabo(dot)pt> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: About how to use "exception when ??? then " |
Date: | 2006-03-16 19:32:10 |
Message-ID: | 4419BD3A.1050903@encs.concordia.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi Pedro,
>|> The place where I have ???, what I should put there please?
>|>
>|> e.g.,
>|> 1. WHEN sqlcode = '02000' THEN
>|> 2. WHEN no_data then
>|> 3. other ways?
>|>
>|> From the 8.0 docs, I am not be able to find Constant values of all
>|> error codes.
>|> http://www.postgresql.org/docs/8.0/static/errcodes-appendix.html
>|>
>|> Please enlighten me.
>
>Maybe this link will help you better, as it has the Constants:
>
>http://developer.postgresql.org/docs/postgres/errcodes-appendix.html
>
>Then, some logic real life examples would be something like:
>
>(snip)
>EXCEPTION
> WHEN NOT_NULL_VIOLATION THEN
> RAISE WARNING 'Not null...';
> WHEN OTHERS THEN
> RAISE NOTICE 'Hmmmm.... [%,%]', SQLSTATE, SQLERRM;
>
>or
>
>
>
I am using postgresql 8.0.1. The keyword "SQLSTATE" & "SQLERRM" did not
work for me. But, I think I do need the two outputs "sql error code",
and "sql error code statement".
Errors I got are:
syntax error at or near "SQLSTATE" at character 2613
LINE 58: RAISE NOTICE 'Hmmmm.... [%,%]', SQLSTATE, SQL...
Should I install any patches or do anything elese to have SQLSTATE and
SQLERRM work for me?
Ying
From | Date | Subject | |
---|---|---|---|
Next Message | Emi Lu | 2006-03-16 19:44:53 | Re: About how to use "exception when ??? then " |
Previous Message | A. Kretschmer | 2006-03-16 19:29:09 | Re: executing external command |