在Oracle SQL语句中获取使用的列和表?

时间:2018-09-03 11:02:50

标签: python sql oracle

我有一堆在oracle数据库上运行的sql语句。我想知道如何获取每个sql语句使用的表和列的列表。

 select b.country country, 
    a.country code, 
    ASNs, 
    tot_demands, 
    case when has_pp=0 then null else round(100*in_country/has_pp,2) end in_country_pct, 
    case when has_pp=0 then null else round(100*in_asn/has_pp,2) end in_ASN_pct,
    case when has_pp=0 then null else round(100*in_provider/has_pp,2) end in_provider_pct,
    round(100*has_pp/tot_demands,2) has_PP_pct,  
    case when has_pp=0 then null else round(distance/has_pp,2) end avg_distance
 from (
 select country, count(*) ASNs, sum(sum_demand) tot_demands, sum (sum_demand*in_country_pct*has_pp_pct) in_country, sum(sum_demand*in_asn_pct*has_pp_pct) in_asn,sum(sum_demand*in_provider_pct*has_pp_pct) in_provider, sum(sum_demand*has_pp_pct) has_pp, sum(sum_demand*weighted_distance*has_pp_pct) distance
 from ns_pp_inpct 
 where day = (select max(day) from ns_pp_inpct) 
 group by country 
 ) a,
 country_code b
 where a.country=b.code
 order by tot_demands desc
;

我搜索了许多网站,但没有找到相关的解决方案。请帮我。 如果可能的话,请给我python解决方案。

0 个答案:

没有答案