Обсуждение: PLPGSQL/EXCEPTION HANDLING
In a function implemented in 7.4.8 I had the following error when I call
the function:
ERROR: syntax error at or near "EXCEPTION"
Offending line is:
EXCEPTION WHEN dup_val_on_index THEN NULL;
When this line is removed, all is well.
Any help appreciated...
On 6/12/06, renneyt@yahoo.com <renneyt@yahoo.com> wrote:
> In a function implemented in 7.4.8 I had the following error when I call
> the function:
>
> ERROR: syntax error at or near "EXCEPTION"
>
> Offending line is:
> EXCEPTION WHEN dup_val_on_index THEN NULL;
>
> When this line is removed, all is well.
>
that's because that construction was added in 8.0, you have to upgrade to use it
--
regards,
Jaime Casanova
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook
Jaime Casanova wrote: > On 6/12/06, renneyt@yahoo.com <renneyt@yahoo.com> wrote: >> In a function implemented in 7.4.8 I had the following error when I call >> the function: >> >> ERROR: syntax error at or near "EXCEPTION" >> >> Offending line is: >> EXCEPTION WHEN dup_val_on_index THEN NULL; >> >> When this line is removed, all is well. >> > > that's because that construction was added in 8.0, you have to upgrade > to use it > What part of the original construction is not supported? Are any "exception when" statements supported? Thanks
On 6/13/06, renneyt@yahoo.com <renneyt@yahoo.com> wrote:
> Jaime Casanova wrote:
> > On 6/12/06, renneyt@yahoo.com <renneyt@yahoo.com> wrote:
> >> In a function implemented in 7.4.8 I had the following error when I call
> >> the function:
> >>
> >> ERROR: syntax error at or near "EXCEPTION"
> >>
> >> Offending line is:
> >> EXCEPTION WHEN dup_val_on_index THEN NULL;
> >>
> >> When this line is removed, all is well.
> >>
> >
> > that's because that construction was added in 8.0, you have to upgrade
> > to use it
> >
> What part of the original construction is not supported?
> Are any "exception when" statements supported?
>
all the BEGIN .. EXCEPTION block:
[ <<label>> ]
[ DECLARE
declarations ]
BEGIN
statements
EXCEPTION
WHEN condition [ OR condition ... ] THEN
handler_statements
[ WHEN condition [ OR condition ... ] THEN
handler_statements
... ]
END;
all you can do until 7.4.x was:
http://www.postgresql.org/docs/7.4/static/plpgsql-errors-and-messages.html
--
Atentamente,
Jaime Casanova
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook