I have a table which contains SQL query as one of the columns. Based on record id, I want to execute SQL query which is in the record.
Master_Table
------------------------------
|Rec_ID | Query |
------------------------------
|1 | SELECT * from EMP |
------------------------------
|2 | SELECT * FROM DEPT |
------------------------------
SELECT Query FROM Master_Table WHERE Rec_ID=1
I am expecting that If I select Rec_Id =1, I have to EMP records. If I select Rec_Id=2, I need to get Dept records.
Is it possible to do it in SQL query?