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: Question on PL/SQL statement.

Re: Question on PL/SQL statement.

From: Jeremy <jeremy0505_at_gmail.com>
Date: Wed, 14 Jun 2006 17:48:22 +0100
Message-ID: <MPG.1efa4e358ac2ebeb98a21b@news.individual.net>


In article <1150295218.092853.323630_at_f6g2000cwb.googlegroups.com>, says...
> Thanks for your insight. I appreciate that.
>
> How about this:
>
> EXEC SQL SELECT COUNT(*)
> INTO :rowcount
> FROM MY_LIST L1
> WHERE AND L1.batch_id = '1'
> AND L1.send_delete_ind = 'Y'
> OR L1.send_delete_ind = 'N';

Your problem here is mixing AND with OR

you probably need

                 WHERE AND L1.batch_id = '1'
                 AND 
                    (L1.send_delete_ind = 'Y'
                     or
                     L1.send_delete_ind = 'N');

or perhaps

                 WHERE AND L1.batch_id = '1'
                 AND L1.send_delete_ind in ('Y','N');

>
> Would it be the same as following? I just don't understand why it has
> L1 and L2. What are they for? Thanks.
>
> EXEC SQL SELECT COUNT(*)
> INTO :rowcount
> FROM MY_LIST L1,
> MY_LIST L2
> WHERE L1.key_no = L2.key_no
> AND L1.supply_code = L2.supply_code
> AND L1.batch_id = '1'
> AND L1.send_delete_ind = 'Y'
> AND L2.batch_id = '1'
> AND L2.send_delete_ind = 'N';
>
>

This one is all ANDs and is therefore different. Daft but different.
-- 

jeremy
Received on Wed Jun 14 2006 - 11:48:22 CDT

Original text of this message

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