Re: Question Regarding Select Into

From: Frank van Bortel <frank.van.bortel_at_gmail.com>
Date: Tue, 27 Dec 2005 14:39:48 +0100
Message-ID: <dorfip$ijv$1_at_news2.zwoll1.ov.home.nl>


kumar wrote:
> Hi ,
> I tried the same thing with an anonymous plsql block. i got
> some errors, just wondering if i have understood it correctly and
> executed in the correct way.
>
>
> 1 declare
> 2 a varchar2(30);
> 3 begin
> 4 select person_id into nvl(a,'asdf') from per_all_people_f where
> person_id = 110;
> 5* end;
> SQL> /
> select person_id into nvl(a,'asdf') from per_all_people_f where
> person_id = 110;
> *
> ERROR at line 4:
> ORA-06550: line 4, column 24:
> PLS-00306: wrong number or types of arguments in call to 'NVL'
[snip]

You cannot use the function as an assignment. person_id should be assigned the outcome of the function:
select nvl(person_id, 'asdf')
into a
from per_all_people_f
where person_id = 110;

The where clause strikes me as odd: why select if you *know* the id will be 110? Just an example, I hope?

-- 
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
Received on Tue Dec 27 2005 - 14:39:48 CET

Original text of this message