I am working with an Oracle 10g database and want to retrieve a group of records from a single table, and then use it to retrieve records from several related tables.
If it were T-SQL, I would do it something like this:
CREATE TABLE #PatientIDs ( pId int ) INSERT INTO #PatientIDs select distinct pId from appointments SELECT * from Person WHERE Person.pId IN (select pId from #PatientIDs) SELECT * from Allergies WHERE Allergies.pId IN (select pId from #PatientIDs) DROP TABLE #PatientIDs
However, all the useful pages I look at make it a lot more time consuming than it might be, so I think I'm missing something obvious.
(By the way, instead of running this as a single script, I will probably open a session in Oracle SQL Developer, create a temporary table, and then run each query from it, exporting them to CSV as I move. Will this work?)
sql oracle plsql oracle10g temp-tables
SarekOfVulcan
source share