2

I've ran the following query to find out the access rights assigned to each user :

SELECT DISTINCT
       A.GRANTEE AS DB_ACCOUNT,
       B.PRIVILEGE AS ACCESS_RIGHTS
  FROM SYS.EXA_DBA_ROLE_PRIVS A
 INNER JOIN SYS.EXA_DBA_SYS_PRIVS B
    ON A.GRANTED_ROLE = B.GRANTEE;

The output of the query has each user having multiple access rights listed in row by row format, I need all ACCESS_RIGHTS listed into a single row for each user.

For Eg.: The output comes like this for all the users:

EXECUTE
SELECT
CREATE

whereas I need the output as :

EXECUTE, SELECT, CREATE

I NEED A FUNCTION IN EXASOL.

Thanks in advance :)

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
msbeast
  • 45
  • 1
  • 9

2 Answers2

1

use group_concat as

group_concat(B.PRIVILEGE) AS ACCESS_RIGHTS

this link might be referenced for the format.

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
0

I have got a function in Exasol for rolling up the rows into a single row and the function name is GROUP_CONCAT. Modified query is :

SELECT DISTINCT
A.GRANTEE AS DB_ACCOUNT,
GROUP_CONCAT(B.PRIVILEGE) AS ACCESS_RIGHTS
FROM
SYS.EXA_DBA_ROLE_PRIVS A
INNER JOIN
SYS.EXA_DBA_SYS_PRIVS B
ON
A.GRANTED_ROLE = B.GRANTEE
GROUP BY A.GRANTEE;

msbeast
  • 45
  • 1
  • 9