Re: Question Regarding Select Into

From: Uwe Mahlmann <email_at_uweimweb.de>
Date: Thu, 22 Dec 2005 23:38:38 +0100
Message-ID: <dof9nk$rlg$00$1_at_news.t-online.com>


OracleNewbie wrote:

> Oracle Gurus,
>
> DECLARE
> A VARCHAR2 (30 BYTE);
> BEGIN
> A := '';
>
> SELECT FIELDNAME INTO A
> FROM EXCELTABLEDEF
> WHERE ROWNUM = 1 AND CST = 'RP_DAT' ';
> DBMS_OUTPUT.PUT_LINE (A);
> END;
>
> The above works fine if it finds a record. If there is no record then
> it throws up the following error
> ORA-01403: no data found
> ORA-06512: at line 6
>
> I can have the exception to handle it. But, is there a way where i can
> have some value if it doesn't return anything like ISNULL(A, 'TBLS')
>
> Again, ppl i'm new and my question might too simple or ultimate
> stupidity. If you know and can guide me do post else dont post some
> crap like what one of the guy "Frank" in this group do. He thinks he is
> an Big **le in Oracle.

Hey,
it seemms, you need to know, if a record exists. If this is true, use NVL(min(FIELDNAME),'empty') or max()

min/max return a row everytime, but you have to interpret it(to look for the meaning)

If you want to see more than ' it exists, then you need an other WHERE-condition

Greeting,
happy X-mas
Uwe Received on Thu Dec 22 2005 - 23:38:38 CET

Original text of this message