用DBMS_OUTPUT()
最好用TOAD,PL/SQL DEVELOPER ,调试功能比较好

解决方案 »

  1.   

    在toad中,编译通过了,不知怎么执行存储过程,等待....
      

  2.   

    exec pro_name(parameters list);
      

  3.   

    报错:
    ORA-01401: 插入的值对于列过大
    ORA-06512: 在"SCITEL.GEN_MORE_COMM", line 74
    ORA-06512: 在line 1怎么知道那个值是多大呢,在存储过程中怎样把这个值输出来显示呢?谢谢!
      

  4.   

    各位帮帮忙,代码如下:CREATE OR REPLACE PROCEDURE GEN_MORE_COMM (
    p_comm_date IN varchar2)             --结算日期
    AS
    --取直销商相关变量
    v_Agent_ID varchar2(10);
    v_Level_ID integer;
    v_Net_Type varchar2(5);
    --入库变量
    v_FAMgrBak number(8,2):=0.0;
    v_FAAdMeAw number(8,2):=0.0;
    v_FAKeAw number(8,2):=0.0;
    v_temp number(8,2):=0.0;
    --遍历表中指定级别、指定结算月的所有直销商IDCURSOR csr_agent_else IS
    SELECT agent_id,net_type,to_number(level_id)
    FROM dir_agent_info
    WHERE level_id='00002' or level_id='00001';
    begin
    open csr_agent_else;                 --打开游标
    loop
    FETCH csr_agent_else INTO v_Agent_ID,v_Net_Type,v_Level_ID;
    EXIT WHEN csr_agent_else%NOTFOUND; --计算该直销商所有子、孙(不包括他自身)三个佣金
    select nvl(sum(value),0) into v_FAMgrBak from dir_result_detail
    where comm_date=p_comm_date
    and Factor_id in ('FAFrGCom','FAFrCCom','FANeCCom','FANeGCom','FASrGCom','FASrCCom')
      and agent_id in (select agent_id from dir_agent_info
      START WITH (agent_id<>v_Agent_ID) and parent_id=v_Agent_ID
    CONNECT BY PRIOR agent_id=parent_id);
    if (v_Level_ID=1) then
    v_FAMgrBak:=v_FAMgrBak*0.05+1200;
    -------------------------------------------------------------------
    select nvl(count(*),0) into v_FAAdMeAw from dir_agent_info
    where first_pass=p_comm_date and to_number(level_id)=3 and parent_id<>v_Agent_ID and agent_id in (select agent_id from dir_agent_info
      START WITH (agent_id<>v_Agent_ID) and parent_id=v_Agent_ID
    CONNECT BY PRIOR agent_id=parent_id); select nvl(count(*),0) into v_temp from dir_agent_info
    where first_pass=p_comm_date and to_number(level_id)=3 and parent_id=v_Agent_ID and agent_id in (select agent_id from dir_agent_info
      START WITH (agent_id<>v_Agent_ID) and parent_id=v_Agent_ID
    CONNECT BY PRIOR agent_id=parent_id);
    v_FAAdMeAw:=v_FAAdMeAw*10+v_temp*40;
    -------------------------------------------------------------------
    select nvl(count(*),0) into v_FAKeAw from dir_agent_info
    where to_number(pass_flag)=1 and to_number(level_id)=3 and agent_id in (select agent_id from dir_agent_info
      START WITH (agent_id<>v_Agent_ID) and parent_id=v_Agent_ID
    CONNECT BY PRIOR agent_id=parent_id);
    if v_FAKeAw>=25 then
    v_FAKeAw:=600;
    else
      v_FAKeAw:=0;
    end if;
    else
    v_FAMgrBak:=v_FAMgrBak*0.05+800;
    --------------------------------------------------------------------------------
    select nvl(count(*),0) into v_FAAdMeAw from dir_agent_info
    where first_pass=p_comm_date and to_number(level_id)=3 and parent_id=v_Agent_ID and agent_id in (select agent_id from dir_agent_info
      START WITH (agent_id<>v_Agent_ID) and parent_id=v_Agent_ID
    CONNECT BY PRIOR agent_id=parent_id);
    v_FAAdMeAw:=v_FAAdMeAw*40;
    -----------------------------------------------------------------------------
    select nvl(count(*),0) into v_FAKeAw from dir_agent_info
    where to_number(pass_flag)=1 and to_number(level_id)=3 and agent_id in (select agent_id from dir_agent_info
      START WITH (agent_id<>v_Agent_ID) and parent_id=v_Agent_ID
    CONNECT BY PRIOR agent_id=parent_id);
    if v_FAKeAw>=10 then
    v_FAKeAw:=300;
    else
      v_FAKeAw:=0;
    end if;
    end if;

    insert into dir_result_detail(agent_id,factor_id,value,comm_date,net_type)
    values(v_Agent_ID,'FAMgrBak',to_char(v_FAMgrBak),p_comm_date,v_Net_Type); insert into dir_result_detail(agent_id,factor_id,value,comm_date,net_type)
    values(v_Agent_ID,'FAKeAw',to_char(v_FAKeAw),p_comm_date,v_Net_Type); insert into dir_result_detail(agent_id,factor_id,value,comm_date,net_type)
    values(v_Agent_ID,'FAAdMeAw',to_char(v_FAAdMeAw),p_comm_date,v_Net_Type);
    commit;
    END LOOP; close csr_agent_else;
    end;
      

  5.   

    用dbms_output.put_line();怎么显示不出来呢?
      

  6.   

    set serveroutput on
    exec ...........
      

  7.   

    put_line输出的每一行的最大的长度不能超过255个字节