oracle行转列

每次都忘,每次都要先找度娘,留个记录。

SELECT lower(a.GRANTOR),
       lower(a.TABLE_SCHEMA),
       lower(a.TABLE_NAME),
       lower(a.GRANTEE),
       LISTAGG(a.privilege, ',') WITHIN GROUP(ORDER BY privilege) privilege
  FROM all_tab_privs a
 where a.GRANTOR IN ('GIS', 'HIS')
   and a.GRANTEE = 'GISMEI'
 group by a.GRANTOR, a.TABLE_SCHEMA, a.TABLE_NAME, a.GRANTEE

 

posted @ 2021-03-02 16:41  篮球是圆的  阅读(61)  评论(0编辑  收藏  举报