这是一段oracle数据转换为excel表格的程序,
应用了excel的dde(动态数据交换),编译出错,请问 EXCEL97
的版本足够吗,还应该安装什么东东!请熟悉的朋友提示!
前面的function没问题的!
SQL> create or replace type myobjectype as object (x number,y number,z number);
2/
Type created.
SQL> create or replace type mytabletype as table of myobjectype
2/
Type created.
commit;
Commit complete.
sQL> create or replace function testrerecordtabname (c_tj in varchar2)
return mytabletype
as
l_data mytabletype :=mytabletype();
strsql varchar2(500);
type v_cursor is ref cursor;
v_tempcursor v_cursor;
i1 number;
i2 number;
i3 number;
begin
strsql := 'select year,month,byyd from jhhyyd where ' || c_tj;
open v_tempcursor for strsql;
loop
fetch v_tempcursor into i1,i2,i3;
l_data.extend;
l_data(l_data.count) := myobjectype(i1,i2,i3);
exit when v_tempcursor%NOTFOUND;
end loop;
return l_data;
end;
/
Function created.
SQL> commit;
SQL> set serveroutput on
SQL> declare
testre mytabletype :=mytabletype();
i number :=0;
crow varchar2(8);
ccol1 varchar2(8);
ccol2 varchar2(8);
ccol3 varchar2(8);
convid pls_integer;
begin
testre := testrerecordtabname('year=2003 and month=5');
convid:=dde.initiate('EXCEL','C:\excel.xls');
dde.poke(convid,'R1C1','年',dde.cf_text,1000);
dde.poke(convid,'R1C2','月',dde.cf_text,1000);
dde.poke(convid,'R1C3','本月用电',dde.cf_text,1000);
loop
i := i+1;
--dbms_output.put_line(';' || testre(i).x || ';' || testre(i).y || ';' || testre(i).z || ';');
crow:=i+1;
ccol1:='R'||crow||'C1';
ccol2:='R'||crow||'C2';
ccol3:='R'||crow||'C3';
dde.poke(convid,ccol1,testre(i).x,dde.cf_text,2000000000);
dde.poke(convid,ccol2,testre(i).y,dde.cf_text,2000000000);
dde.poke(convid,ccol3,testre(i).z,dde.cf_text,2000000000);
exit when i = testre.count;
end loop;
dde.terminate(convid);
end;
/
错误位于第1行:
ORA-06550: 第 11 行, 第 15 列:
PLS-00201: 必须说明标识符 'DDE.INITIATE'
ORA-06550: 第 11 行, 第 7 列:
PL/SQL: Statement ignored
ORA-06550: 第 12 行, 第 35 列:
PLS-00201: 必须说明标识符 'DDE.CF_TEXT'
ORA-06550: 第 12 行, 第 7 列:
PL/SQL: Statement ignored
ORA-06550: 第 13 行, 第 35 列:
PLS-00201: 必须说明标识符 'DDE.CF_TEXT'
ORA-06550: 第 13 行, 第 7 列:
PL/SQL: Statement ignored
ORA-06550: 第 14 行, 第 41 列:
PLS-00201: 必须说明标识符 'DDE.CF_TEXT'
ORA-06550: 第 14 行, 第 7 列:
PL/SQL: Statement ignored
ORA-06550: 第 22 行, 第 42 列:
PLS-00201: 必须说明标识符 'DDE.CF_TEXT'
ORA-06550: 第 22 行, 第 8 列:
PL/SQL: Statement ignored
ORA-06550: 第 23 行, 第 42 列:
PLS-00201: 必须说明标识符 'DDE.CF_TEXT'
ORA-06550: 第 23 行, 第 8 列:
PL/SQL: Statement ignored
ORA-06550: 第 24 行, 第 42 列:
PLS-00201: 必须说明标识符 'DDE.CF_TEXT'
ORA-06550: 第 24 行, 第 8 列:
PL/SQL: Statement ignored
ORA-06550: 第 27 行, 第 4 列:
PLS-00201: 必须说明标识符 'DDE.TERMINATE'
ORA-06550: 第 27 行, 第 4 列:
PL/SQL: Stateme
|