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 6884683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:32:23+00:00 2026-05-27T05:32:23+00:00

This is from a Cognos report, it has an interactive, multi-valued prompt (P_prompt_param). The

  • 0

This is from a Cognos report, it has an interactive, multi-valued prompt (P_prompt_param).

The query is written with Tabular SQL. To make it an optional filter on the column (someval) the report writer wrote it like this in the query’s where clause:

( 
       'NO INPUT' IN (#promptmany('P_prompt_param', 'String', sq('NO INPUT'))#)
       or
       table.somval IN (#promptmany('P_prompt_param', 'String', sq('NO INPUT'))#)
      )

In this case table.somval is of type NUMBER. If you don’t select a value in the prompt on the input page. The report will return, on 4 environments with identical DB schemas, but there is one environment where this will not work.

Instead in the one outlier it results in ORA-01722: invalid number

This on Oracle 10.2.0.4.

I’ve been playing around in SQL to see if I can reproduce it on a “working” environment, if I imagine how the #promptmany# macro would be evaluated when there is no input selected (defaultText value of ‘NO INPUT’).

A query like this will get ORA-01722

select * from mytable where ( someval in ('NO INPUT'));

Where as this query, more like the above where clause in my report, will not

select * from mytable where ('NO INPUT' in ('NO INPUT') or someval in ('NO INPUT'));

Is there any way that the OR expressions could be both evaluated even after the first one returns true? Or is it possible that the order of evaluation can “switch”?

is there some setting in Cognos or Oracle that might determine the order or if both expressions could be evaluated? might it depend on the optimizer somehow?

This is on Cognos ReportNet 1.1, Oracle 10g

  • 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. Editorial Team
    Editorial Team
    2026-05-27T05:32:24+00:00Added an answer on May 27, 2026 at 5:32 am

    The optimizer is free to evaluate predicates in whatever order it chooses. So it is free to evaluate the someval in ('NO INPUT') predicate before the 'NO INPUT' in ('NO INPUT') predicate in which case you’ll get an error.

    If someval is a NUMBER, it ought to be compared with a number, not a string, so I would expect that the prompt ought to be defined as a number and that the “No Input” option ought to be a number that isn’t valid, i.e. -1. Alternately, you could convert someval to a string before doing the comparison

    to_char( someval ) IN ('NO INPUT')
    

    will be valid syntax that won’t throw a runtime error. However, if you are relying on an index on someval, adding the TO_CHAR will prevent that index from being used. You can work around that problem by creating a function-based index

    CREATE INDEX fbi_tbl_someval
        ON mytable( to_char( someval ) );
    

    But then you have potentially two different indexes to maintain when data changes in the tables, two indexes consuming disk space, etc.

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

Sidebar

Related Questions

I have a result like this from an SQL query: Month Day Customer Item
If I execute this from SQL Server, I get the output parameter with no
So far i got this code: function toplist() {$sql = SELECT * FROM list
This (from body of a stored proc) is throwing a syntax error: IF (name
I see this from time to time and want to know what it is.
Say I write this: from subprocessing import Popen, STDOUT, PIPE p = Popen([myproc], stderr=STDOUT,
I'm coming at this from the Windows world... On Windows, we have Windows Installer
How can I stop this from happening, it is grabbing files in .svn folders
I got this from php.net website. This is related to the problem I am
I found this from C++FAQ Generally, No. From a member function or friend of

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.