Solved

check 15 fields in Oracle table = '15'  - SQL

Posted on 2014-03-24
2
356 Views
Last Modified: 2014-03-24
Experts,

I would like to know if there is a way to check msgno1 - msgn015 to see if any have a value of equal to '15' and use this is a selection criteria in a where statement if Oracle SQL.

If anyone of the respective 15 fields has a value of '15', I want to select the record if not I don't.
0
Comment
Question by:morinia
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 39950810
SELECT *
  FROM yourtable
 WHERE '15' IN (msgno1,
                msgno2,
                msgno3,
                msgno4,
                msgno5,
                msgno6,
                msgno7,
                msgno8,
                msgno9,
                msgno10,
                msgno11,
                msgno12,
                msgno13,
                msgno14,
                msgno15)
0
 
LVL 33

Expert Comment

by:ste5an
ID: 39950826
Normalize your table?
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question