Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL question, Please help

Re: PL/SQL question, Please help

From: Mark Styles <news_at_lambic.co.uk>
Date: Tue, 25 Jun 2002 18:56:59 GMT
Message-ID: <asehhucvpurgsqfovb9tknp6c99qh1dma5@4ax.com>


Hmm, two pieces of misinformation in a row. Luckily other posts in the thread gave the correct response, but these posts need some rebuttal...

On Tue, 25 Jun 2002 20:55:25 +0200, "shrinad_at_ora-india.com" <daekw_at_yahoo.com> wrote:
>this is a bug in oracle.

Bug? What bug?

>most things dont work as expected.

What things don't work?

>there is only a small subset of access-functionality.

Are you trying to compare Oracle to MS Access, or does 'access-functionality' mean something else?

>"Peter" <rman9i_at_yahoo.com> schrieb im Newsbeitrag:
>> Looks like this query will return more than 1 row sometimes. You need a
>> cursor to do this.

Why would a select count(*) return more than one row?

As others have pointed out, the problem is that the OP needs to use dynamic SQL to achieve what he wants.

>> "Jeff" <zheli2001_at_yahoo.com> wrote in message
>> news:41266446.0206060746.37476677_at_posting.google.com...
>> > SQL> declare
>> > 2 v_addtype varchar2(100) := '''m'',''mb''';
>> > 3 i number;
>> > 4 Begin
>> > 5 SELECT count(*) into i
>> > 6 FROM UserAddr
>> > 7 WHERE addrtype in (v_addtype);
>> > 8 DBMS_OUTPUT.put_line('##### count = ' || i||' #####' );
>> > 9 End;
>> > 10 /
>> > ##### count = 0 #####
>> >
>> > PL/SQL procedure successfully completed.
>> >
>> > But if I directly use the value instead of using the variable
>> > "v_addtype". It works fine:
>> >
>> > SQL> declare
>> > 2 i number;
>> > 3 Begin
>> > 4 SELECT count(*) into i
>> > 5 FROM UserAddr
>> > 6 WHERE addrtype in ('m','mb');
>> > 7 DBMS_OUTPUT.put_line('##### count = ' || i||' #####' );
>> > 8 End;
>> > 9 /
>> > ##### count = 265 #####
>> >
>> > PL/SQL procedure successfully completed.
Received on Tue Jun 25 2002 - 13:56:59 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US