I have many tables that ends with FCT (lets take two tables ABC_FCT, XYZ_FCT) owned by my_schema.
All the tables have the following 4 columns predominatly: REG_ID, USR_ID, CAT_ID, SPR_ID
Now I need a generic sql which gives count of the above 4 ids where the value is -1 and print it as follows:
Tab_name Col_name Cnt
ABC_FCT reg_id 10
ABC_FCT usr_id 5
ABC_FCT cat_id 6
ABC_FCT spr_id 11
XYZ_FCT reg_id 10
XYZ_FCT usr_id 5
XYZ_FCT cat_id 6
XYZ_FCT spr_id 11
Can this be done with generic dynamic sql instead of calculating for every table..
Please let me know if you need any more information..