0

I was trying to get an select * from (for column table result) every table_name with the result bellow, how can i achieve this?

(SELECT a.table_name
  FROM all_cons_columns a
  JOIN all_constraints c ON a.owner = c.owner
                        AND a.constraint_name = c.constraint_name
  JOIN all_constraints c_pk ON c.r_owner = c_pk.owner
                           AND c.r_constraint_name = c_pk.constraint_name
 WHERE c.constraint_type = 'R'
   AND c_pk.table_name = 'MY_TABLE_NAME')

like:

suppose that the result above was:

  • TABLE_NAME
  • TABLE_LOG_NOD
  • TABLE_LOG_CASH
  • TABLE_LOG_PLUG

i want to return an select * from (only one row of that table)every one of those tables listed. Beware i cannot use variable, or any other thing related to PL/SQL, so only SQL.

Sorry for my bad english. I hope it was clear. Thank you anyone in advance.

1

This is not possible without using PL/SQL or a loop to generate the SQL in the program you're using to execute the SQL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.