sql - Reuse of select query result oracle -


i've got following query

select id marmelades mrm  not exists      (select 1 toys toys      mrm.id = toys.id      , mrm.ingredient = toys.ingredient      , mrm.box_type = 2) , mrm.box_type = 2  

it returns 400+ results of id, example [12, 33, 45, ... , 3405]

now, want remove ids list everywhere database. not marmelades , toys. also, have example 35+ tables can have id).

i happy if query extract in functions all_unneeded_ids can use this:

delete another_table_1 id in ( all_unneeded_ids )  delete another_table_2 id in ( all_unneeded_ids )  delete another_table_3 id in ( all_unneeded_ids )  delete another_table_4 id in ( all_unneeded_ids )  ... delete another_table_35 id in ( all_unneeded_ids )  

it possible in oracle reuse such results?

use first query within subsequent queries. ie:

delete another_table_1 id in (      select id marmelades mrm       not exists           (select 1 toys toys           mrm.id = toys.id           , mrm.ingredient = toys.ingredient           , mrm.box_type = 2)      , mrm.box_type = 2 ); 

when toys , marmelades tables, you'll need temporary holder table @gordon suggests.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -