On Sep 1, 5:52 pm, Michael Moore <michaeljmo...@gmail.com> wrote:
> Robert,
> I assume it was taken out of context and modified for the sake of example.
>
> Obviously ( or at least I hope obviously)
> TO_CHAR(to_date('07/08/2010','MM/DD/YYYY'),'YYYY')  is never = '1900'
> and since A.flg is always either 'Y' or 'N', you could remove the WHERE
> clause
> entirely and it would have no effect on the result.
>
> Mike
>
>
>
> On Wed, Sep 1, 2010 at 2:26 PM, Rob Wolfe <wolfe....@gmail.com> wrote:
>
> > On Sep 1, 5:23 pm, swaroop gowda <swaroop.t...@gmail.com> wrote:
> > > I found an answer
> > > SELECT COUNT(*) FROM TABLE_A A WHERE A.flg = CASE WHEN
> > > TO_CHAR(to_date('07/08/2010','MM/DD/YYYY'),'YYYY') = '1900' THEN
> > > 'Y'
> > > ELSE
> > > A.flg END
> > > On Wed, Sep 1, 2010 at 3:59 PM, Michael Moore <michaeljmo...@gmail.com
> > >wrote:
>
> > > > instead of using IN, do something like this:
> > > > SELECT COUNT( * )
> > > >   FROM DUAL a
> > > >  WHERE ( TO_CHAR( TO_DATE( '07/08/1900', 'MM/DD/YYYY' ), 'YYYY' ) =
> > '1900'
> > > > AND a.dummy = 'X' )
> > > >     OR  TO_CHAR( TO_DATE( '07/08/1900', 'MM/DD/YYYY' ), 'YYYY' ) !=
> > '1900'
>
> > > > On Wed, Sep 1, 2010 at 1:50 PM, Michael Moore <michaeljmo...@gmail.com
> > >wrote:
>
> > > >> you need an "END" for your CASE statement.
>
> > > >> On Wed, Sep 1, 2010 at 1:21 PM, swaroop gowda <swaroop.t...@gmail.com
> > >wrote:
>
> > > >>>  If I write a the code like this I am getting 0 count.
>
> > > >>> SELECT COUNT(*) FROM TABLE_A A WHERE A.flg IN CASE WHEN
> > > >>> TO_CHAR(to_date('07/08/2010','MM/DD/YYYY'),'YYYY') = '1900' THEN
> > > >>> 'Y'
> > > >>> ELSE '('||''''||'Y'||''''||','||''''||'N'||''''||')'
>
> > > >>> Mainly I need when the date is 1900 then I need to select only Active
> > flg
> > > >>> 'Y' ELSE I need to get all data.
>
> > > >>> Please let me know Anything wrong in my statement.
>
> > > >>> --
> > > >>> Thanks & Regards
> > > >>> Swaroop Thailuru Swamy
>
> > > >>> --
> > > >>> You received this message because you are subscribed to the Google
> > > >>> Groups "Oracle PL/SQL" group.
> > > >>> To post to this group, send email to Oracle-PLSQL@googlegroups.com
> > > >>> To unsubscribe from this group, send email to
> > > >>> oracle-plsql-unsubscr...@googlegroups.com
> > > >>> For more options, visit this group at
> > > >>>http://groups.google.com/group/Oracle-PLSQL?hl=en
>
> > > >   --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Oracle PL/SQL" group.
> > > > To post to this group, send email to Oracle-PLSQL@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > oracle-plsql-unsubscr...@googlegroups.com
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/Oracle-PLSQL?hl=en
>
> > > --
> > > Thanks & Regards
> > > Swaroop Thailuru Swamy
>
> > I must be missing something because this really seems to have very
> > limited utility.
>

That is what i was thinking but the constant date was what got me
because it is always when you toss in a join in a working query that
it seems to barf on me.

-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

Reply via email to