【问题标题】:40735: when-button-pressed trigger raised unhandled exception ORA-30550040735: 按下按钮时触发器引发未处理的异常 ORA-305500
【发布时间】:2019-04-21 12:00:27
【问题描述】:

我想使用 oracle forms 10g 在 Excel 文件中生成报告,并在按下按钮时实现触发器。按下按钮时出现以下错误:

40735:按下按钮时触发器引发未处理的异常 ORA-305500

代码:

declare
  application ole2.obj_type;
  workbooks ole2.obj_type;
  workbook ole2.obj_type;
  worksheets ole2.obj_type;
  worksheet ole2.obj_type;
 cell ole2.obj_type;
 arglist ole2.list_type;
 row_num number;
 col_num number;
 fontObj ole2.obj_type;

cursor rec is SELECT so.descr saleorgdescr,ih.invdate invdatemaster, ih.docNUM docnum,
   TO_CHAR(ih.invdate,'mon-yyyy') invmonth
FROM ARMINVHEAD ih, SDMSALEORG so
WHERE
ih.status='69'
AND  TO_DATE(ih.INVDATE,'DD-MM-RRRR')
              BETWEEN
                   TO_DATE('01-01-2008','DD-MM-RRRR') 
              AND  
                   TO_DATE('01-01-2009','DD-MM-RRRR') 
order by IH.INVDATE, ih.docnum;

procedure SetCellValue(rowid number,colid number,cellValue varchar) is
begin
arglist := ole2.create_arglist;
ole2.add_arg(arglist,rowid);
ole2.add_arg(arglist,colid);
cell:= ole2.get_obj_property(worksheet,'Cells',arglist);
fontObj := ole2.get_obj_property(cell,'Font');
ole2.destroy_arglist(arglist);
ole2.set_property(cell,'value',cellValue);
ole2.set_property(fontObj,'Size',16);
ole2.set_property(fontObj,'BOLD',1);
ole2.set_property(fontObj,'ColorIndex',7);
ole2.release_obj(cell);
end SetCellValue;

procedure app_init is
begin
application := ole2.create_obj('Excel.Application');
ole2.set_property(application,'Visible',true);
workbooks := ole2.get_obj_property(application,'workbooks');
workbook := ole2.Get_Obj_Property(workbooks,'add');
worksheets := ole2.get_obj_property(application,'worksheets');
worksheet := ole2.Get_Obj_Property(worksheets,'add');
ole2.set_property(worksheet,'Name','Emp Sheet');
end app_init;

procedure save_excel(path varchar,filename varchar) is
begin
OLE2.Release_Obj(worksheet);
OLE2.Release_Obj(worksheets);
-- Save the Excel file created
If path is not null then
Arglist := OLE2.Create_Arglist;
OLE2.Add_Arg(Arglist,path||'\'||file_name||'.xls');
OLE2.Invoke(workbook, 'SaveAs', Arglist);
OLE2.Destroy_Arglist(Arglist);
end if;
end save_excel;

begin
app_init;
row_num:=1;
col_num:=1;
SetCellValue(row_num,col_num,'saleorgdescr');
col_num:=col_num + 1;
SetCellValue(row_num,col_num,'invdatemaster');
col_num:=col_num + 1;
SetCellValue(row_num,col_num,'docnum');
col_num:=col_num + 1;
SetCellValue(row_num,col_num,'invmonth');
for i in rec loop
row_num:=row_num + 1;
col_num:=1;
SetCellValue(row_num,col_num,i.saleorgdescr);    
col_num:=2;
SetCellValue(row_num,col_num,i.invdatemaster);    
col_num:=3;
SetCellValue(row_num,col_num,i.docnum);
col_num:=4;
SetCellValue(row_num,col_num,i.invmonth);   
end loop;    
save_excel('C:\excel_export','emp_data');       
OLE2.Release_Obj(workbook);
OLE2.Release_Obj(workbooks);
OLE2.Release_Obj(application); 
end;

oracle forms 10g如何解决这个问题?

我正在使用带有 Oracle Apps ERP 模块的 oracle forms 10g

【问题讨论】:

    标签: oracle oracle10g oracleforms oracle-apps


    【解决方案1】:

    ORA-305500 是一般的 OLE2 错误,表明 Forms 和非 Oracle 资源(在本例中为 Excel)之间存在问题。

    在行应用程序中引发以下错误:= ole2.create_obj('Excel.Application');

    基本问题是您使用的是 Forms 10g,它使用 n 层架构。这是与 Forms 6i 或更早版本的客户端服务器相比的巨大变化。这意味着 Forms OLE 在本地运行诸如 Excel 之类的应用程序到 Forms 应用程序,即在 Forms 应用服务器上而不是在您的桌面上。因此,除非您的 Forms 应用服务器在 Windows 操作系统上运行并安装了 Excel,否则 OLE 将无法工作,即便如此,它也会在服务器上生成文件。

    Forms 10g 附带了 Webutils 库,以在多层系统中功能性地支持客户端-服务器样式。您需要使用CLIENT_OLE2() 函数来处理Forms 10g 中的Excel,并使用WebUtil_File.File_Save_Dialog() 将文件保存到本地目录。

    the OTN Forum here (link).上有一个很好的例子


    Webutil 错误:找不到 Oracle.forms.webutil.ole.OleFunctions bean

    听起来您还没有将表单配置为正确(或根本没有)使用 Webutil。表单帮助文档中有一些内容,或者您​​可以关注this article (link).

    【讨论】:

    • 我放了带有暂停选项的消息。在行应用程序中引发以下错误:= ole2.create_obj('Excel.Application');
    • 我添加了 CLIENT_OLE2 并收到以下错误:Webutil Error: Oracle.forms.webutil.ole.OleFunctions bean not found
    • 是的,但需要一些额外的步骤才能使其工作。您收到的错误消息表明您没有关注所有这些。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-30
    • 2012-04-16
    • 1970-01-01
    • 2019-11-13
    • 1970-01-01
    • 2022-01-26
    • 2016-04-25
    相关资源
    最近更新 更多