拆解一个长字段内容,长字段到一个新表(不加序列方式)

/*========================================================================================
EFFECT: 小程序数据预处理,拆解商品信息字段
TARGET_TABLE:
AUTHOR:GORKOR
DATE:2021-10-8
========================================================================================*/
PROCEDURE DWR_XCX_ORDER_R_P(MSG_NUM OUT NUMBER) IS

V_NAME        VARCHAR2(100);
--V_NUM         NUMBER(20);
V_INFORMATION VARCHAR2(100);
V_NUMBE       VARCHAR2(5); --拆解字段
V_NUMBER      NUMBER; --程序状态字段
V_ORDER_ID    NUMBER;

CURSOR CEMP IS
  SELECT S.MERCHANDISE_NEWS,S.ORDER_ID FROM DWAPP.ODS_XCX_ORDER S;

BEGIN
V_OBJECT_NAME := ‘DWAPP.PRODUCT_TEST.DWR_XCX_ORDER_R_P’;
V_NUMBER := 1;
OPEN CEMP;
LOOP
FETCH CEMP
INTO V_INFORMATION,V_ORDER_ID;
exit when CEMP%notfound;
dbms_output.put_line(V_INFORMATION);
–获取销售数量
SELECT SUBSTR(V_INFORMATION, INSTR(V_INFORMATION, ‘X’, -1) - 1) 值
INTO V_NUMBE
FROM DUAL;
–获取宝贝名称
SELECT SUBSTR(V_INFORMATION, 0, INSTR(V_INFORMATION, ‘颜’, 1, 1) - 1)
INTO V_NAME
FROM DUAL;

  INSERT INTO DWAPP.ODS_XCX_ORDER_TMP S
    (ORDER_ID, PRODUCT_NAME, PRODUCT_COLOR, PRODUCT_SIZE, QUANTITY)
    SELECT V_ORDER_ID, V_NAME, NULL, NULL, V_NUMBE
      FROM DUAL;  
              
END LOOP;

  COMMIT;
  
CLOSE CEMP;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值