Call path:
Stored Procedure-call function initialization variables in TYPE-stored procedure call specific log operations-call TYPES to implement specific Member implementations in body type bobies-call common Member the member stored procedure is written to the syslog table.
Sample Code:
1. Stored Procedure
- Createorreplaceprocedure sp_message_hisorderdata_create (
- P_l_date HsCrmType. LDate % TYPE,
- P_vc_customer hscrmtype. vc50 % type) IS
- V_l_date HsCrmType. LDate % Type;
- V_l_currentdate HsCrmType. LDate % Type;
- V_vc_customer hscrmtype. vc50 % type;
- V_l_count HsCrmType. LInt % Type;
- V_l_total HsCrmType. LInt % Type;
- V_vc_open_value HsCrmType. VC255 % Type;
- V_vc_open_value_temp HsCrmType. VC255 % Type;
- V_vc_customer_no HsCrmType. VC20 % Type;
- Vc_product_no HsCrmType. CKind % Type;
- Vc_product_temp HsCrmType. CKind % Type;
- V_vc_prefix HsCrmType. CKind % Type;
- V_vc_temp1 HsCrmType. VC255 % Type;
- V_vc_temp2 HsCrmType. VC255 % Type;
- V_vc_temp3 HsCrmType. VC255 % Type;
- V_vc_temp4 HsCrmType. VC255 % TYPE;
- V_L_SPEAK_NO HsCrmType. LInt % Type;
- L_tyLog ty_logManager: = ty_logManager ('system', '003 ');
- Begin
- Rochelle tylog.up_enter ('SP _ message_hisorderdata_create ');
- V_vc_temp1: = chr (1) | ''| chr (1) |'' | chr (1) | ''| chr (1) | '';
- V_vc_temp2: = chr (1) | ''| chr (1) |'' | chr (1) | '';
- V_vc_temp3: = chr (1) | ''| chr (1) | '';
- V_vc_temp4: = chr (1) | '';
- -- Zhoudy add initialization assignment
- V_vc_open_value: = '';
- V_l_total: = 0;
- V_L_SPEAK_NO: = 0;
- V_l_date: = nvl (p_l_date, 0 );
- V_vc_customer: = nvl (p_vc_customer ,'');
- If v_l_date = 0 then
- V_l_date: = to_number (to_char (SYSDATE-1, 'yyyymmdd '));
- End if;
- FOR r IN (SELECT a. vc_customer_no
- , A. l_product_no
- , '3' AS c_sourcetype
- , A. l_de_begin_date AS l_de_begin_date
- , A. l_de_end_date AS l_de_end_date
- , (Select wmsys. WM_CONCAT (B. vc_open_value) FROM hscrm_dbo.orderinfo B
- WHERE B. vc_customer_no = a. vc_customer_no
- AND B. l_product_no = a. l_product_no
- And B. l_product_no <20000) AS vc_open_value
- , '1' AS c_processtype
- FROM hscrm_dbo.speakforrelation
- WHERE -- a. l_create_date <= v_l_date
- -- A. l_create_date <= 20101026
- -- And
- A. l_product_no <20000
- -- And a. l_create_date <= 20101024
- -- And (a. vc_customer_no = v_vc_customer or v_vc_customer = '')
- -- And a. l_product_no = 11003
- GROUPBY vc_customer_no, l_product_no, l_de_begin_date, l_de_end_date
- )
- LOOP
- V_vc_prefix: = substr (r. vc_customer_no, 1, 3 );
- If v_vc_prefix = 'crm 'then
- V_vc_customer_no: = substr (r. vc_customer_no, 4 );
- V_vc_open_value_temp: = r. vc_open_value;
- Vc_product_temp: = substr (to_char (r. l_product_no), 1, 1 );
- If vc_product_temp = '1' then
- V_l_total: = v_l_total + 1;
- Vc_product_no: = substr (to_char (r. l_product_no), 2 );
- SELECTCOUNT (*) INTO v_l_count FROM hscrm_dbo.smsserviceparam WHERE vc_smsno = to_char (r. l_product_no );
- CASE
- WHEN v_l_count = 0 THEN
- V_vc_open_value: = '';
- WHEN v_l_count = 1 THEN
- V_vc_open_value: = REPLACE (r. vc_open_value, v_vc_temp1 );
- WHEN v_l_count = 2 THEN
- V_vc_open_value: = REPLACE (r. vc_open_value, v_vc_temp2 );
- WHEN v_l_count = 3 THEN
- V_vc_open_value: = REPLACE (r. vc_open_value, v_vc_temp3 );
- WHEN v_l_count = 4 THEN
- V_vc_open_value: = REPLACE (r. vc_open_value, v_vc_temp4 );
- -- Zhoudy 20130131
- ELSE
- V_vc_open_value: = REPLACE (r. vc_open_value, v_vc_temp4 );
- ENDCASE;
- V_vc_open_value: = REGEXP_REPLACE (v_vc_open_value ,'');
- V_vc_open_value: = REPLACE (v_vc_open_value, ',', chr (1 ));
- -- V_L_SPEAK_NO: = r. L_SPEAK_NO;
- INSERTINTO THJZX_DZGX_IN_HIS2 (KHH, CPBH, DZLY, DZSJ, DQSJ, DZLX, CS, CJRQ)
- VALUES (v_vc_customer_no
- , Vc_product_no
- , R. c_sourcetype
- , R. l_de_begin_date
- , R. l_de_end_date
- , R. c_processtype
- , V_vc_open_value
- , V_l_date );
- End if;
- End if;
- COMMIT;
- End loop;
- Commit;
- Rochelle tylog.up_leave ('SP _ message_hisorderdata_create processing is complete, number of successfully generated '| v_l_total );
- Exception
- When others then
- Rollback;
- L_tyLog.up_Error ('SP _ message_orderdata_create error: '| v_vc_customer_no |': '| V_L_SPEAK_NO |': '| v_l_date |': '| vc_product_no | ': '| v_vc_open_value |': '| SQLCODE );
- End sp_message_hisorderdata_create;
Fragment parsing:
Initialize the definition of log, in fact, the internal type;
- L_tyLog ty_logManager: = ty_logManager ('system', '003 ');
Specific sub-process of calling log
- L_tyLog.up_Error ('SP _ message_orderdata_create error: '| v_vc_customer_no |': '| V_L_SPEAK_NO |': '| v_l_date |': '| vc_product_no | ': '| v_vc_open_value |': '| SQLCODE );
- Rochelle tylog.up_leave ('SP _ message_hisorderdata_create processing is complete, number of successfully generated '| v_l_total );