Re: exception problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: java4dev <java4dev(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: exception problem
Date: 2011-02-22 17:48:14
Message-ID: 3391.1298396894@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

java4dev <java4dev(at)gmail(dot)com> writes:
> SELECT is_unlocked INTO v_is_unlocked
> FROM aaa.domains
> WHERE pk_domain_id = p_domain_id;

> RETURN v_is_unlocked;

> EXCEPTION
> WHEN TOO_MANY_ROWS THEN
> RETURN FALSE;
> WHEN NO_DATA_FOUND THEN
> RETURN FALSE;

Perhaps you want "if found then return v_is_unlocked; else return false;
end if;" in there. Or if you really want to do it as above, you need to
say SELECT INTO STRICT to have those exceptions be thrown. See the
manual.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message java4dev 2011-02-22 18:04:07 Re: exception problem
Previous Message Vibhor Kumar 2011-02-22 17:45:50 Re: simple test code