text: --# Copyright IBM Corp. All Rights Reserved.
  --# SPDX-License-Identifier: Apache-2.0
  
  /*
   * WLM Workloads 
   */
  
  CREATE OR REPLACE VIEW DB_WORKLOADS AS
  SELECT
      WORKLOADNAME
  ,   EVALUATIONORDER
  ,   ENABLED
  ,   COALESCE(ATTRIBUTES,'') AS ATTRIBUTES
  ,   REMARKS
  FROM SYSCAT.WORKLOADS W
  LEFT JOIN
  (
      SELECT
          workloadid
      ,   'ALTER WORKLOAD "' || WORKLOADNAME || '" ADD ' 
          || LISTAGG(CONNATTRTYPE || '(''' || RTRIM(CONNATTRVALUE) || ''')',CHR(10)) 
              WITHIN GROUP( ORDER BY CONNATTRTYPE, CONNATTRVALUE)  AS ATTRIBUTES
      FROM
          SYSCAT.WORKLOADCONNATTR
      GROUP BY
          WORKLOADID
      ,   WORKLOADNAME
  )
      AS A
  USING ( WORKLOADID )