Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Question on PL/SQL statement.
feilip_at_gmail.com wrote:
> Thanks all!
>
> So both of these codes do the same thing, right?
>
> EXEC SQL SELECT COUNT(*)
> INTO :rowcount
> FROM MY_LIST L1
> WHERE AND L1.batch_id = '1'
> AND L1.send_delete_ind in ('Y','N');
>
>
> 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';
>
>
> What is that guy uses the second method? Make the code more confusing...
Might be too late in the day for my brain to work right, but isn't the second one a self-join limited to the set where both Y and N exist, but the first is if either exists (ignoring the extra AND)?
jg
-- @home.com is bogus. Google and the Borg both need to learn about transactions and rollback. http://www.nytimes.com/2006/06/14/technology/14search.html?ei=5088&en=c96a72bbc5f90a47&ex=1307937600&adxnnl=1&partner=rssnyt&emc=rss&adxnnlx=1150326563-WzIpwF1JJud9MXqu1YFtwQReceived on Wed Jun 14 2006 - 18:20:49 CDT