if else error

  • select (if (DESCRIPTION= 'Stop save') then ('gddo'); else ('turr'); end if;) as dep

    from CIRC.TAG

    I get 'ORA-00907: missing right parenthesis' error message. What's the mistake.

  • Mistake #1: you're obviously using Oracle 😀

    #2: assuming some logic implemented into the SQL systax Oracle is using, I'd get rid of all of the semicolons, since a semicolon should terminate a statement. And the statement would be the SELECT statement in total. Something like

    select (if (DESCRIPTION= 'Stop save') then ('gddo') else ('turr') end if) as dep

    from CIRC.TAG;



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • or with a case statement

    select

    CASE

    WHEN DESCRIPTION= 'Stop save' then 'gddo'

    ELSE 'turr'

    END DEP

    from CIRC.TAG

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply