Oracle - create and use a "macro" variable
UserBird
Dataiker, Alpha Tester Posts: 535 Dataiker
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
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
Answers
-
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