PRC_S_SYS_LOG(5)

本文探讨了SQL查询用于获取特定标识符的数据,并在成功获取后插入到日志记录表中,包括月份、任务ID、程序名称等详细信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 select T.FLAG_VALUE into oi_flag from LBI_SYS_VDF.t_s_flag t where t.flag_code = 'DEBUG';
        if oi_flag = '1' then
          insert into LBI_SYS_VDF.t_s_sys_log
                    (
                     log_month,   -- add month partition
                     task_id,     -- task id
                     task_name,   -- program name
                     table_name,  -- target table name
                     task_sign,   -- task sign,task start date
                     start_time,  -- task start time
                     end_time,    -- task end time or error time
                     task_status, -- task status
                     task_log,    -- task log description
                     task_pos,    -- task position
                     row_count    -- count of the data record
                    )
           
create or replace function FUNC_WO_WAFERLIST(V_WAFER_LIST varchar2, V_CUSTCODE varchar2, V_WO_TYPE varchar2) return varchar2 as V_WAFER_ID varchar2(500); V_WAFER_LIST_BACK varchar2(500); begin V_WAFER_ID := null; V_WAFER_LIST_BACK := null; --判断不能为空 if V_CUSTCODE is null or V_WO_TYPE is null or V_WAFER_LIST is null then return V_WAFER_ID; end if; --删除 delete from SJ_WAFER_NUMBER_TEMP t where t.custcode = V_CUSTCODE and t.wotype = V_WO_TYPE; commit; V_WAFER_LIST_BACK := V_WAFER_LIST; if INSTR(V_WAFER_LIST, '.') > 0 then V_WAFER_LIST_BACK := replace(V_WAFER_LIST, '.', ','); end if; if INSTR(V_WAFER_LIST_BACK, ',') > 0 then if SUBSTR(V_WAFER_LIST_BACK, -1) != ',' then insert into SJ_WAFER_NUMBER_TEMP (WAFERID, CUSTCODE, WOTYPE) select t.COLUMN_VALUE, V_CUSTCODE, V_WO_TYPE from table (select FUNC_SPLIT_NUMBER(replace(V_WAFER_LIST_BACK, '?', ',') || ',', ',') from DUAL) t; else insert into SJ_WAFER_NUMBER_TEMP (WAFERID, CUSTCODE, WOTYPE) select T.COLUMN_VALUE, V_CUSTCODE, V_WO_TYPE from table (select FUNC_SPLIT_NUMBER(V_WAFER_LIST_BACK, ',') from DUAL) T; end if; commit; select LISTAGG(WAFERID, ',') WITHIN group(order by WAFERID) WAFERID into V_WAFER_ID from SJ_WAFER_NUMBER_TEMP t where t.custcode = V_CUSTCODE and t.wotype = V_WO_TYPE; return V_WAFER_ID; commit; elsif INSTR(V_WAFER_LIST_BACK, ';') > 0 then if SUBSTR(V_WAFER_LIST_BACK, -1) != ';' then insert into SJ_WAFER_NUMBER_TEMP (WAFERID, CUSTCODE, WOTYPE) select T.COLUMN_VALUE, V_CUSTCODE, V_WO_TYPE from table (select FUNC_SPLIT_NUMBER(V_WAFER_LIST_BACK || ';', ';') from DUAL) T; else insert into SJ_WAFER_NUMBER_TEMP (WAFERID, CUSTCODE, WOTYPE) select T.COLUMN_VALUE, V_CUSTCODE, V_WO_TYPE from table (select FUNC_SPLIT_NUMBER(V_WAFER_LIST_BACK, ';') from DUAL) T; end if; commit; select LISTAGG(WAFERID, ',') WITHIN group(order by WAFERID) WAFERID into V_WAFER_ID from SJ_WAFER_NUMBER_TEMP t where t.custcode = V_CUSTCODE and t.wotype = V_WO_TYPE; return V_WAFER_ID; commit; else insert into SJ_WAFER_NUMBER_TEMP (WAFERID, CUSTCODE, WOTYPE) select T.COLUMN_VALUE, V_CUSTCODE, V_WO_TYPE from table (select FUNC_SPLIT_NUMBER(V_WAFER_LIST_BACK || ',', ',') from DUAL) T; commit; select LISTAGG(WAFERID, ',') WITHIN group(order by WAFERID) WAFERID into V_WAFER_ID from SJ_WAFER_NUMBER_TEMP t where t.custcode = V_CUSTCODE and t.wotype = V_WO_TYPE; return V_WAFER_ID; end if; exception when others then rollback; DBMS_OUTPUT.PUT_LINE('Error occurred at:' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE); -- 发邮件 send_mail('FUNC_WO_WAFERLIST', ',Error:' || 'SQLCODE:' || sqlcode || 'SQLERRM:' || sqlerrm || ',' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE); --插入错误日志 prc_write_sys_log('error', 'FUNC_WO_WAFERLIST', '', ',Error:' || 'SQLCODE:' || sqlcode || 'SQLERRM:' || sqlerrm || ',' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE, ''); raise; end; 解释一下
08-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值