case, nvl and datetime fields

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bon

    #1

    case, nvl and datetime fields

    I have a mssql view I am translating to oracle syntax

    One of the lines in the mssql view is like this:
    DATO=CASE (isnull(loandat e,1)) WHEN 1 THEN 'N' ELSE 'Y' END

    In other words, the view will return a Y if loandate has a value, N if
    it does not have a value

    How can I accomplish the same with Oracle9?
  • VC

    #2
    Re: case, nvl and datetime fields

    Hello,

    DECODE(loandate , null, 'N', 'Y')

    ...or

    case when loandate is null then 'N' else 'Y' end

    Rgds.


    "bon" <magicrat880@ho tmail.comwrote in message
    news:c7986eaf.0 312091002.51327 b57@posting.goo gle.com...
    I have a mssql view I am translating to oracle syntax
    >
    One of the lines in the mssql view is like this:
    DATO=CASE (isnull(loandat e,1)) WHEN 1 THEN 'N' ELSE 'Y' END
    >
    In other words, the view will return a Y if loandate has a value, N if
    it does not have a value
    >
    How can I accomplish the same with Oracle9?

    Comment

    • bon

      #3
      Re: case, nvl and datetime fields

      "VC" <boston103@hotm ail.comwrote in message news:<rqoBb.347 574$ao4.1164423 @attbi_s51>...
      Hello,
      >
      DECODE(loandate , null, 'N', 'Y')
      >
      ..or
      >
      case when loandate is null then 'N' else 'Y' end
      >
      Rgds.
      >
      Thanks

      I actually did find out a way to do it eventually, but unlike you I
      complicated it more than necessary...
      (if you are good at reading between the lines, you probably realize
      now my real problem was with conflicting data types in my original
      attempt to translate it)

      CASE nvl(loandate,to _date(NULL)) WHEN to_date(NULL) THEN 'N' ELSE 'Y'
      END

      Comment

      Working...