ЭТО НОВЫЙ СТИЛЬ НАДЕЖДЫ, ЭТО ПОМОГАЕТ
SELECT FIRSTNAME ,LASTNAME , CASE WHEN POSITION ( 'OBJ1') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ1' IN STR )+5 ,1) :: INT END AS OBJ1,
CASE WHEN POSITION ( 'OBJ2') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ2' IN STR )+5 ,1) :: INT END AS OBJ2,
CASE WHEN POSITION ( 'OBJ3') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ3' IN STR )+5 ,1) :: INT END AS OBJ3,
CASE WHEN POSITION ( 'OBJ4') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ4' IN STR )+5 ,1) :: INT END AS OBJ4,
CASE WHEN POSITION ( 'OBJ5') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ5' IN STR )+5 ,1) :: INT END AS OBJ5,
CASE WHEN POSITION ( 'OBJ6') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ6' IN STR )+5 ,1) :: INT END AS OBJ6,
CASE WHEN POSITION ( 'OBJ7') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ7' IN STR )+5 ,1) :: INT END AS OBJ7,
CASE WHEN POSITION ( 'OBJ8') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ8' IN STR )+5 ,1) :: INT END AS OBJ8,
CASE WHEN POSITION ( 'OBJ9') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ9' IN STR )+5 ,1) :: INT END AS OBJ9,
CASE WHEN POSITION ( 'OBJ10') IN STR ) = 0 THEN NULL ELSE SUBSTR( STR ,POSITION ('OBJ10' IN STR )+6 ,1) :: INT END AS OBJ10
FROM
( SELECT ID, FIRSTNAME ,LASTNAME , STRING_AGG(OBJECT :: TEXT || '$' || TOTAL ::TEXT ,',') AS
FROM YOURTABLE
WHERE OBJECT
GROUP BY ID, FIRSTNAME ,LASTNAME )A