如何获取列的逗号分隔值以在 Oracle Apex 网格中显示为下一个值

问题描述 投票:0回答:1

我有一个查询,查询结果如下

从 SVC_UPLD 中选择 store_id,error_message,其中 store_id = 19258;

STOREID  ERROR_MESSAGE
19258    Box Number is mandatory.,Quantity cannot have any special 
         characters.,BRAND is not a valid Brand in             
         MFCS.,RRP_CURRENCY is not a valid currency code in MFCS.,HSCODE 
         will be with Minimum as 8 
         chars,SEASON not a valid season.,Selling_Retail_curr is not a 
         valid currency code in MFCS.,GENDER             
         is not a valid Gender in MFCS.,COLOR is invalid.

我尝试使用以下查询

select regexp_substr (
           error_message,
           '[^,]+',
           1,
           level
         ) value
  from   SVC_UPLD 
  connect by level <= 
    length ( error_message ) - length ( replace ( error_message, ',' ) ) + 1;

** 得到输出如下 **

STOREID    ERROR_MESSAGE

19258      Quantity cannot have any special characters.
19258      BRAND is not a valid Brand in MFCS.
19258      RRP_CURRENCY is not a valid currency code in MFCS.
19258      HSCODE will be with Minimum as 8 chars
19258      SEASON not a valid season.
19258      Selling_Retail_curr is not a valid currency code in MFCS.
19258      GENDER is not a valid Gender in MFCS.
19258      COLOR is invalid.
19258      ALLOCATION SIZE is mandatory.

** 我需要输出以在与下下一行相同的网格单元中显示错误消息 **

STOREID    ERROR_MESSAGE
19258      Box Number is mandatory.,
           Quantity cannot have any special characters.,
           BRAND is not a valid Brand in MFCS.,
           RRP_CURRENCY is not a valid currency code in MFCS.,
           HSCODE will be with Minimum as 8 chars,
           SEASON not a valid season.,
           Selling_Retail_curr is not a valid currency code in MFCS.,
           GENDER is not a valid Gender in MFCS.,
           COLOR is invalid.
``
plsql oracle11g oracle-apex plsqldeveloper plsql-package
1个回答
0
投票

你是不是把事情想得太复杂了?从我的角度来看,用

<br>
标签替换逗号就可以了。

经典报告,出处是

select STORE_ID,
       REPLACE(ERROR_MESSAGE, ',', '<br>') error_message
  from SVC_UPLD

关闭

error_message
列的“转义特殊字符”属性。

运行页面;结果是

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.