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

  • Home
  • SEARCH
  • 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 6801243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:04:34+00:00 2026-05-26T19:04:34+00:00

I have a table with something like a dozen different columns. Is there a

  • 0

I have a table with something like a dozen different columns. Is there a way to conditionally select columns based on a certain condition?

For example we’ll say this a user table with username, password, all that stuff, and a field that holds a count of how many times that user has failed a login. (Wrong password, right username). So instead of having a query that returns nothing when either username or password are wrong, or a query that returns everything when just the username is correct, I would like a query that returns a subset when the username is correct but the password is wrong.

Pseudo SQL:

SELECT column1,
       column2,
       column3,
       column4,
       column5,
       column6,
   --If this condition is not met the following columns are not selected
   IF password = password  
   (
       conditional_column1,
       conditional_column2,
       conditional_column3
   )
FROM source_table
WHERE username = username

I have tried a CASE statement and DECODE but each of those only returns one value for each condition. I want to select several columns for a single condition.

I do not have access to PL/SQL and I am trying to keep this all in one query. Anyone know if this is possible?

EDIT:

Just to clarify, in my case I do not want to check if I’m asking for username, I want to check if there are any rows where username = x. If all I had to do was pass username to a function and build a query string this wouldn’t be a problem.

So the flow goes:
Get some columns where username is ‘x’ then, if password is ‘y’ get these other columns.

  • 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-26T19:04:35+00:00Added an answer on May 26, 2026 at 7:04 pm

    It sounds like you want to have a look at the virtual private database (VPD) feature of oracle

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

Sidebar

Related Questions

I have a table - something like: A|B 1|1 1|2 1|3 2|1 2|3 2|4
I have a table that looks something like this: word big expensive smart fast
I have a table that looks something like this: id | firstperson | secondperson
I currently have a table structure that looks something like this(some details omitted): ColumnName
Let's say I have a MySQL table that is something like this: software table:
Suppose I have a table of users. Something like: ID integer, USER text, POSITION
I have a hierarchical table on Oracle pl/sql. something like: create table hierarchical (
I have something like this: create table account ( id int identity(1,1) primary key,
I have two tables which looks something like this Table Queue int ID; string
I have jQuery code which looks something like this on Button1 Click $('table.result_grid tbody

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.