简体   繁体   English

Oracle APEX PL / SQL过程调试?

[英]Oracle APEX PL/SQL Procedure Debugging?

I am using a PL/SQL Procedure to Insert one Table that was previously generated into another exisiting table: 我正在使用PL / SQL过程将先前生成的一个表插入到另一个现有表中:

INSERT INTO REI_LABOUR_COST (DEALER_NUMBER, DEALER_STATUS, BILLING_PARTNER, BSI_GW, YEAR, QUANTITY_FRU, LABOUR_EUR, LABOUR_LOCAL, REQUESTED_RATE)
select c001 as DEALER_NUMBER
     , c002 as DEALER_STATUS
     , c003 as BILLING_PARTNER
     , c004 as BSI_GW
     , c005 as YEAR
     , c006 as QUANTITY_FRU
     , c007 as LABOUR_EUR
     , c008 as LABOUR_LOCAL
     , c009 as REQUESTED_RATE
from apex_collections col
where collection_name = 'COLLECTION' and seq_id != 1
order by seq_id;

But it does not work. 但这行不通。 There is no error message or other sign of the procedure failing, but it does not show any results in the final table. 没有错误消息或过程失败的其他迹象,但是在最终表中没有显示任何结果。

First question, is there any sign what I did wrong? 第一个问题,我做错了什么迹象吗?

Second question, where would I see an error message if the command fails? 第二个问题,如果命令失败,我将在哪里看到错误消息? Can I enable it somewhere? 我可以在某个地方启用它吗?

Before making the insert into the database, the apex collection must be updated for each member attribute. 在插入数据库之前,必须为每个成员属性更新顶点集合。

First Apex process: On Submit and Before Computation 第一个Apex流程:提交时和计算前

declare
    y pls_integer := 0;
    v_msg varchar2(4000);
begin
    if not apex_collection.collection_exists(p_collection_name=>'COLLECTION') then
        wwv_flow.debug('No Apex collection found!');
    else
        for x in (select * from apex_collections where collection_name = 'COLLECTION' and seq_id != 1 order by seq_id) 
        loop
           y := y+1;
            apex_collection.update_member_attribute (p_collection_name=> 'COLLECTION', p_seq=> x.seq_id,p_attr_number =>1,p_attr_value=>wwv_flow.g_f01(y));     
            apex_collection.update_member_attribute (p_collection_name=> 'COLLECTION', p_seq=> x.seq_id,p_attr_number =>2,p_attr_value=>wwv_flow.g_f02(y)); 
            apex_collection.update_member_attribute (p_collection_name=> 'COLLECTION', p_seq=> x.seq_id,p_attr_number =>3,p_attr_value=>wwv_flow.g_f03(y)); 
            apex_collection.update_member_attribute (p_collection_name=> 'COLLECTION', p_seq=> x.seq_id,p_attr_number =>4,p_attr_value=>wwv_flow.g_f04(y)); 
            apex_collection.update_member_attribute (p_collection_name=> 'COLLECTION', p_seq=> x.seq_id,p_attr_number =>5,p_attr_value=>wwv_flow.g_f05(y)); 
            apex_collection.update_member_attribute (p_collection_name=> 'COLLECTION', p_seq=> x.seq_id,p_attr_number =>6,p_attr_value=>wwv_flow.g_f06(y)); 
            apex_collection.update_member_attribute (p_collection_name=> 'COLLECTION', p_seq=> x.seq_id,p_attr_number =>7,p_attr_value=>wwv_flow.g_f07(y)); 
            apex_collection.update_member_attribute (p_collection_name=> 'COLLECTION', p_seq=> x.seq_id,p_attr_number =>8,p_attr_value=>wwv_flow.g_f08(y)); 
            apex_collection.update_member_attribute (p_collection_name=> 'COLLECTION', p_seq=> x.seq_id,p_attr_number =>9,p_attr_value=>wwv_flow.g_f09(y)); 
        end loop;   
    end if;
exception when others then
    v_msg := ''||sqlerrm;
    wwv_flow.debug('ERR: '||v_msg); 
end;

Second Apex process: After Submit 第二个Apex流程:提交后

declare
    v_msg varchar2(4000);
begin
    for x in (select * from apex_collections where collection_name = 'COLLECTION' and seq_id != 1 order by seq_id) 
    loop            
        begin
            INSERT INTO REI_LABOUR_COST (DEALER_NUMBER, DEALER_STATUS, BILLING_PARTNER, BSI_GW, YEAR, QUANTITY_FRU, LABOUR_EUR, LABOUR_LOCAL, REQUESTED_RATE) 
            values(x.c001, x.c002, x.c003, x.c004, x.c005, x.c006, x.c007, x.c008, x.c009);
        exception when others then
            v_msg := ''||sqlerrm;
            wwv_flow.debug('ERR_1: '||v_msg);                   
        end;
    end loop;   
exception when others then
    v_msg := ''||sqlerrm;
    wwv_flow.debug('ERR_2: '||v_msg);   
end;

I don't think you can reference seq_id like that. 我认为您无法像这样引用seq_id。

Use APEX_COLLECTION.DELETE_MEMBER to get rid of seq_id 1. 使用APEX_COLLECTION.DELETE_MEMBER摆脱seq_id 1。

Eg 例如

BEGIN

 APEX_COLLECTION.DELETE_MEMBER(
 p_collection_name => 'COLLECTION',
 p_seq => '1'); 

END;

Then continue as normal. 然后照常继续。

Edit - The reason why it will be failing is a wrong data type error. 编辑-失败的原因是错误的数据类型错误。 If you check the debugger you should be able to see this. 如果您检查调试器,您应该可以看到此信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM