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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:45:52+00:00 2026-05-16T22:45:52+00:00

I have a master table (hereafter called SURVEY) and a detail table (hereafter called

  • 0

I have a master table (hereafter called SURVEY) and a detail table (hereafter called ANSWERS.) Unsurprisingly, ANSWERS has answers to SURVEY questions. ANSWERS has a VARCHAR2 column named TEXT. Some ANSWERS.TEXT values are truly text but some are actually numerics. Fortunately, I always know which rows contain text and which contain numbers-as-text.

This is the way it is. I can’t change this.

Back in the day, when certain ANSWERS rows were saved, their TEXT values were cherry-picked and put into the SURVEY table in properly typed columns. A trivial one-table select would fetch SURVEYs and the special values.

But now, with the addition of a new application, we’ve removed the special columns. Instead, we now have to fetch the appropriate ANSWERS rows’ TEXT values instead.

I have created a query that simulates the old trivial select statement. It works great… mostly.

Here’s a snippet:

select survey.*, 
       j2.overall_score
  from survey,
       (select to_number(trim(ANSWER.text)) overall_score, 
               survey.id survey_id 
          from ANSWER, 
               [edited - more SQL that gets the 'score' row from ANSWERS]) j2      
 where
   survey.id=j2.survey_id
   and overall_score > 70    

You might note the j2. In the real query, there are six such columns, j1 through j6. When I run the query, it looks just like the old query. You can’t tell it’s really being assembled from a master/detail. That’s a relief!

My problem, however, is that the ‘overall_score > 70’ phrase causes a ‘1722 invalid number’ error. Oracle is as happy as a clam when I don’t include the phrase, so all the output is passing through j2’s to_number() function and looks good. But if I add the conditional, I fail.

The ‘overall_score’ part of the where clause is being added dynamically based upon search criteria entered from a web page.

I need some fu that tells Oracle I really do know what I’m doing, please do it. If there is non-numeric data, ok, let j2’s to_number() fail. Cool. But otherwise, just do it.

Any wise words? I’m a contractor and time is nearly up. This is a new requirement :-/

  • 1 1 Answer
  • 1 View
  • 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-16T22:45:53+00:00Added an answer on May 16, 2026 at 10:45 pm

    We created a special version of to_number which internally catches the ‘1722 invalid number’ exception and returns 0 instead of. Replacing to_number with this new function in th sql eliminated this problem for us.

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

Sidebar

Related Questions

I have 2 tables- master and detail table. Master Table has ID column which
I have a master table (Team) and a detail table (TeamMember). TeamMember has a
I am wondering if it is okay to have master and detail table for
I have a master table in one word document. First column of the table
I have a master table called parent and a related table called childs Now
I have a Master Table and a Detail Table(like Categories and Products) in SQL
I have an Access 2007 table called Master which contains, among many many others,
I have a fairly huge database with a master table with a single column
I have two large tables -Master table A: 1.4million rows -Detail table B: 9
I have a master table Person and a detail table Events I need to

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.