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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:56:05+00:00 2026-05-22T18:56:05+00:00

Somebody mailed me a list with codes, and I need to check whether each

  • 0

Somebody mailed me a list with codes, and I need to check whether each code does exist in an oracle 10 database table.

list looks something like:

code1, code2, code3

Of course for every item in the list i can do

select id from my_table where code = 'code1'.

But this would be time consuming, and not a very elegant. I would like to report back a list like:

code1        present
code2        X
code3        X
code4        present

I’m vaguely aware of oracle’s With statement, but I’m not sure how to use it with a list of values instead of a subquery.

  • 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-22T18:56:05+00:00Added an answer on May 22, 2026 at 6:56 pm

    The inverse can be achieved like this (see all codes from the database, and check whether they are in the list provided by your colleague):

    select code, case when code in ('code1', 'code2', 'code3') 
                      then 'present' 
                      else 'X' end
    from my_table;
    

    If that won’t work for you, you can try this:

    -- you need a special type for your request. Adapt dimensions if necessary
    create type codes as varray(100) of varchar(100);
    
    select c.column_value, case when exists (
      select 1 
      from my_table m 
      where m.code = c.column_value
    ) then 'present' else 'X' end
    from table(codes('code1', 'code2', 'code3')) c;
    
    -- drop that type again
    drop type codes;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Somebody posted me this code to me with a problem I had: $('#txtWeight').each( function()
Somebody know how use OpenX (php app) with Django? I need to use OpenX
Somebody said that when your PHP code and application use global variables then it
Does somebody know how to recover a never-starting eclipse when the error org.eclipse.swt.SWTError: Item
Does somebody know a Java library which serializes a Java object hierarchy into Java
Somebody knows how to implement Oracle Advance Queue from C# using PL/SSQL and ODP.NET?
Somebody please explain me this code in detail function reverse(s){ return s.split().reverse().join(); }
Somebody talking the python's code can embed into C#'s code. What the mechanism to
Somebody have idea how to use all cores for calculating integration? I need to
Somebody told me about a class for language recognition in Cocoa. Does anybody know

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.