Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 118075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:26:14+00:00 2026-05-11T03:26:14+00:00

I have a simple function written in Oracle 9i (version 9.2.0.4.0) to simulate an

  • 0

I have a simple function written in Oracle 9i (version 9.2.0.4.0) to simulate an in-line IF. For those interested, here’s the code:

create or replace FUNCTION IIF      (testExpression NUMBER,     trueResult NUMBER,     falseResult NUMBER) RETURN NUMBER    AS BEGIN    /*       A simple in-line IF function for use with SQL queries. If the test       expression evaluates to any non-zero value, it is considered to be        true, and the trueResult is returned. Otherwise, falseResult is       returned.    */       IF (testExpression is null) or (testExpression = 0) THEN       return falseResult;    ELSE       return trueResult;    END IF; END IIF; 

This isn’t rocket science. Now, here’s the big mystery: if I execute the following SQL statements, everything is just fine, and works exactly as I expect:

SELECT IIF(1, 'true', 'false') FROM DUAL; SELECT IIF(0, 'false', 'true') FROM DUAL; 

However, the following generates a really bizarre error from Oracle:

SELECT IIF((0 = 1), 'false', 'true') FROM DUAL; 

That error is as follows:

ORA-00907: missing right parenthesis. 

Clearly, that isn’t the case. Would anyone happen to have an explanation for this little bit of bizarreness?

It’s taking a whole lot of self-control at the moment to restrain myself from hurling the Oracle server out the window. Oracle seems rife with these kinds of inanities.

EDIT: Is there some kind of magic syntax I have to use to use an equality operator in a select statement?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:26:15+00:00Added an answer on May 11, 2026 at 3:26 am

    Maybe you can explain what you are trying to do. I think you are looking for the CASE or DECODE functions, but I can’t be sure. It seems like you are working against the grain of the SQL language for some reason.

    The error occurs because Oracle doesn’t expect a relational operator in the select clause of the query:

    SQL> SELECT IIF(1>7, 0, 1) FROM DUAL; SELECT IIF(1>7, 0, 1) FROM DUAL             * ERROR at line 1: ORA-00907: missing right parenthesis  SQL> SELECT 1=0 FROM DUAL; SELECT 1=0 FROM DUAL         * ERROR at line 1: ORA-00923: FROM keyword not found where expected 

    See this Ask Tom article.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 356k
  • Answers 356k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer So when is it too much? At what point do… May 14, 2026 at 8:56 am
  • Editorial Team
    Editorial Team added an answer You mean you want the target of the onmouseover event,… May 14, 2026 at 8:56 am
  • Editorial Team
    Editorial Team added an answer Until one of the clever SOers turns up, here's my… May 14, 2026 at 8:56 am

Related Questions

I need to run a couple of relatively simple SQL update statements to update
I have an application written in Excel plus a bunch of C++ / Python
I have a simple class library written in c#. using System; namespace TestDll {
Here's a simple problem I need to solve, but it makes me feel my

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.