0
I have the following expression:
SELECT us.FULL_NAME, us.USER_ID FROM knta_users us WHERE USER_ID IN(SELECT DISTINCT REGEXP_SUBSTR(PRJ.PRJ_PROJECT_MANAGER_USER_ID, '[^#@#]+', 1, LEVEL) AS GP_ID
FROM KCRT_FG_PFM_PROJECT PRJ WHERE PRJ.PRJ_PROJECT_ID = '30580' CONNECT BY REGEXP_SUBSTR (PRJ.PRJ_PROJECT_MANAGER_USER_ID,'[^#@#]+', 1, LEVEL) IS NOT NULL)
It works, but it takes a long time to load.
Is there an alternative way to do this query? Because the system that consumes it does not load the data for exceeded time.
This snippet will find in the database a field that stores several users separated by special characters (e.g.: usuario1#@#usuario2
) and bring each of them in a row.
First suggestion , normalize the table , complicated sqls because the tables are not normalized, it is not possible to try a subselect with EXISTS and LIKE.
– Motta
Sorry for the question, but what do you mean by normalize the table?
– Guilherme Montagnani
Instead of having a "string" with the concatenated users having a second table and each user in a column, look for NORMAL SHAPES. A sql would be trivial.
– Motta
Is that actually the table structure is already mounted that way. The only way would be to change the way the information is recorded? Just so you understand this field stores who is the manager of each project, but can be several people, so it will concatenate, but to display I need to separate these users.
– Guilherme Montagnani
Try by subselect and exists
– Motta