壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 3420|回复: 0

[报表] ORA-01480: STR 绑定值的结尾 Null 字符缺失

[复制链接]
发表于 2012/4/12 14:25:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
源代码,
往红色字符后输入.时会报如上错误,请高手帮忙分析下
create or replace package body yt_inv_item_quantity_date_rep is
    PROCEDURE print(content VARCHAR2) is
    BEGIN
      fnd_file.PUT_LINE(fnd_file.output,content);
    END print;
   
   procedure do(errbuf OUT VARCHAR2,
               retcod OUT NUMBER,
               orgid number,
               cst_type varchar2,
               p_date varchar2
               ) is
      CURSOR cursor_user_role  is
      select decode(bsc.organization_id,83,'英唐智控',85,'英唐数码',87,'英唐电气') org_name,
            -- bsc.organization_id org_name,
             bsc.subinv ,
             bsc.inv_name ,
             bsc.mtl_num ,
             bsc.mtl_name ,
             bsc.uom ,
             st.t_qty ,
             round(cic.item_cost,5) item_cost ,
             round(nvl(st.t_qty,0)*nvl(cic.item_cost,0),2) amount,
             td1.t_date in_date ,
             td2.t_date out_date,
             months_between(to_date(nvl(p_date,sysdate),'YYYY-MM'),trunc(greatest(nvl(td2.t_date,td1.t_date),td1.t_date),'MM')) m_date
      from yt_inv_item_qty_basic_v bsc,
           cst_item_costs          cic,
           cst_cost_types          cct,
           (select t.organization_id organization_id,
               t.inventory_item_id inv_item,
               t.subinventory_code subinv,
               sum(t.transaction_quantity) t_qty
            from inv.mtl_material_transactions t
            where t.transaction_type_id <> 26
              and t.transaction_type_id <> 10008
              and trunc(t.transaction_date,'MM') <= to_date(nvl(p_date,'2222-12'),'YYYY-MM')
            group by t.organization_id,t.inventory_item_id,t.subinventory_code
            ) st,
           (select td.organization_id,td.inv_item,td.subinv,td.in_out,td.t_date,td.a
            from
                (select t.organization_id,
                        t.inventory_item_id inv_item,
                        t.subinventory_code subinv,
                        sign(t.transaction_quantity) in_out,
                        t.transaction_date t_date,
                        rank() over(partition by t.organization_id,t.inventory_item_id,t.subinventory_code,sign(t.transaction_quantity)
                                    order by t.transaction_date desc) a
                from inv.mtl_material_transactions t
                where trunc(t.transaction_date,'MM') <= to_date(nvl(p_date,'2222-12'),'YYYY-MM')
                ) td
            where td.a = 1 and td.in_out = 1
           ) td1,
           (select td.organization_id,td.inv_item,td.subinv,td.in_out,td.t_date,td.a
            from
                (select t.organization_id,
                        t.inventory_item_id inv_item,
                        t.subinventory_code subinv,
                        sign(t.transaction_quantity) in_out,
                        t.transaction_date t_date,
                        rank() over(partition by t.organization_id,t.inventory_item_id,t.subinventory_code,sign(t.transaction_quantity)
                                    order by t.transaction_date desc) a
                from inv.mtl_material_transactions t
                where trunc(t.transaction_date,'MM') <= to_date(nvl(p_date,'2222-12'),'YYYY-MM')
                ) td
            where td.a = 1 and td.in_out = -1
           ) td2
      where bsc.organization_id = cic.organization_id(+)
        and bsc.inv_item        = cic.inventory_item_id(+)
        and bsc.organization_id = st.organization_id(+)
        and bsc.inv_item        = st.inv_item(+)
        and bsc.subinv          = st.subinv(+)
        and bsc.organization_id = td1.organization_id(+)
        and bsc.inv_item        = td1.inv_item(+)
        and bsc.subinv          = td1.subinv(+)
        and bsc.organization_id = td2.organization_id(+)
        and bsc.inv_item        = td2.inv_item(+)
        and bsc.subinv          = td2.subinv(+)
        and cic.cost_type_id    = cct.cost_type_id(+)
        and bsc.org_id like '%'|| orgid ||'%'
        and cct.cost_type = nvl(cst_type,
                (select t.cost_type
                 from (select cct.organization_id ,cct.cost_type_id,cct.cost_type,
                              rank() over(partition by cct.organization_id order by cct.cost_type_id desc) a
                       from cst_cost_types cct
                       where cct.organization_id is not null) t
                 where t.organization_id = bsc.organization_id
                   and t.a = 1));
      p_row_cursor_user_role cursor_user_role%rowtype;
      
      BEGIN
      open cursor_user_role;  
      --格式控制部分
      print('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
      <title>无标题文档</title>
      <style type="text/css">
      <!--
         #Layer1 {
                   position:absolute;
                   width:339px;
                   height:152px;
                   z-index:1;
                   left: 10px;
                   top: 12px;
                  }
        .STYLE4 {font-size: 24px}
      -->
    </style>
    </head>
    <body>
    <table width="975" border="1" bordercolor="#666666">
    <tr>
    <th colspan="100" scope="col">YT库存分析表</th>
    </tr>
    <tr>
    <td width="314" bgcolor="#999999"><span class="STYLE4">组织</span></td>
    <td width="180" bgcolor="#999999"><span class="STYLE4">仓库</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">仓库名称</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">品号</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">品名</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">单位</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">数量</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">单位成本</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">金额</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">上次入库</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">上次出库</span></td>
    <td width="358" bgcolor="#999999"><span class="STYLE4">呆滞月数</span></td>
    </tr>');
      /*loop  --循环
        fetch cursor_user_role
        into p_row_cursor_user_role;
        EXIT WHEN cursor_user_role%NOTFOUND OR
        cursor_user_role%NOTFOUND IS NULL;*/
    for p_row_cursor_user_role in cursor_user_role
      loop
        print('<tr><td>' || p_row_cursor_user_role.org_name ||
              '</td>'||'<td>' ||
              replace(p_row_cursor_user_role.subinv,',','' )||
              '</td>'||'<td>' ||p_row_cursor_user_role.inv_name ||
              '</td>'||'<td>' ||p_row_cursor_user_role.mtl_num ||
              '</td>'||'<td>' ||p_row_cursor_user_role.mtl_name ||
              '</td>'||'<td>' ||p_row_cursor_user_role.uom ||
              '</td>'||'<td>' ||p_row_cursor_user_role.t_qty ||
              '</td>'||'<td>' ||p_row_cursor_user_role.item_cost ||
              '</td>'||'<td>' ||p_row_cursor_user_role.amount ||
              '</td>'||'<td>' ||p_row_cursor_user_role.in_date ||
              '</td>'||'<td>' ||p_row_cursor_user_role.out_date ||
              '</td>'||'<td>' ||p_row_cursor_user_role.m_date ||
              '</td> </tr>');
        --输出部分--End--
      END loop;
        --格式控制部分
      print('</table>
      </body>
      </html>');
       --格式控制部分
     -- close cursor_user_role;
    END do;
end yt_inv_item_quantity_date_rep;

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/29 06:05 , Processed in 0.013737 second(s), 14 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表