Community Conundrum 10: The Titanic is now live Learn more

Oracle - create and use a "macro" variable

Dataiker
Dataiker
Oracle - create and use a "macro" variable
Hi,

I'm far from being a SQL expert, so i'm going to try to explain my issue as well as possible :

I have a list of IDs (in a csv file for example) and i want to get different information about them that are stored in many different oracle tables.

So everytime I call a table, I want to be able to do something like that :

SELECT RelevantInfo, ID

FROM mytable

WHERE ID in "mylistofIDs"



How can I do that ?

Thank you
0 Kudos
1 Reply
Dataiker
Dataiker
Hi,

Yes, you can do it if you import your list of IDs in your db:

SELECT RelevantInfo, ID

FROM mytable

WHERE ID in (select ID from listOfId)



Here's some examples: http://www.dofactory.com/sql/where-in
Mattsco
0 Kudos
Labels (2)