oracle 导出excel 时报错,直接输出excel的包,怎么调用啊,出错了?

找到一个包,好象可以直接输出excel文件,不知道怎么调用,谁能给看看怎么用?

begin

as_xlsx.query2sheet( 'select * from dual' );

as_xlsx.save( 'MY_DIR', 'my.xlsx' );

end;

出错为

Error report:

ORA-04067: not executed, package body "OMC.AS_XLSX" does not exist

ORA-06508: PL/SQL: could not find program unit being called: "OMC.AS_XLSX"

ORA-06512: at line 2

04067. 00000 -  "not executed, %s does not exist"

*Cause:    Attempt to execute a non-existent stored procedure.

*Action:   Make sure that a correct name is given.

以下包as_xlsx已经编译通过

create or replace

package as_xlsx

is

/**********************************************

**

** Author: Anton Scheffer

** Date: 19-02-2011

** Website: http://technology.amis.nl/blog

** See also: http://technology.amis.nl/blog/?p=10995

**

** Changelog:

**   Date: 21-02-2011

**     Added Aligment, horizontal, vertical, wrapText

**   Date: 06-03-2011

**     Added Comments, MergeCells, fixed bug for dependency on NLS-settings

**   Date: 16-03-2011

**     Added bold and italic fonts

**   Date: 22-03-2011

**     Fixed issue with timezone's set to a region(name) instead of a offset

**   Date: 08-04-2011

**     Fixed issue with XML-escaping from text

**

******************************************** */

--

type tp_alignment is record

( vertical varchar2(11)

, horizontal varchar2(16)

, wrapText boolean

);

--

procedure clear_workbook;

--

procedure new_sheet( p_sheetname varchar2 := null );

--

function OraFmt2Excel( p_format varchar2 := null )

return varchar2;

--

function get_numFmt( p_format varchar2 := null )

return pls_integer;

--

function get_font

( p_name varchar2

, p_family pls_integer := 2

, p_fontsize number := 11

, p_theme pls_integer := 1

, p_underline boolean := false

, p_italic boolean := false

, p_bold boolean := false

)

return pls_integer;

--

function get_fill

( p_patternType varchar2

, p_fgRGB varchar2 := null -- this is a hex ALPHA Red Green Blue value

)

return pls_integer;

--

function get_border

( p_top varchar2 := 'thin'

, p_bottom varchar2 := 'thin'

, p_left varchar2 := 'thin'

, p_right varchar2 := 'thin'

)

/*

none

thin

medium

dashed

dotted

thick

double

hair

mediumDashed

dashDot

mediumDashDot

dashDotDot

mediumDashDotDot

slantDashDot

*/

return pls_integer;

--

function get_alignment

( p_vertical varchar2 := null

, p_horizontal varchar2 := null

, p_wrapText boolean := null

)

/* horizontal

center

centerContinuous

distributed

fill

general

justify

left

right

*/

/* vertical

bottom

center

distributed

justify

top

*/

return tp_alignment;

--

procedure cell

( p_col pls_integer

, p_row pls_integer

, p_value number

, p_numFmtId pls_integer := null

, p_fontId pls_integer := null

, p_fillId pls_integer := null

, p_borderId pls_integer := null

, p_alignment tp_alignment := null

, p_sheet pls_integer := null

);

--

procedure cell

( p_col pls_integer

, p_row pls_integer

, p_value varchar2

, p_numFmtId pls_integer := null

, p_fontId pls_integer := null

, p_fillId pls_integer := null

, p_borderId pls_integer := null

, p_alignment tp_alignment := null

, p_sheet pls_integer := null

);

--

procedure cell

( p_col pls_integer

, p_row pls_integer

, p_value date

, p_numFmtId pls_integer := null

, p_fontId pls_integer := null

, p_fillId pls_integer := null

, p_borderId pls_integer := null

, p_alignment tp_alignment := null

, p_sheet pls_integer := null

);

--

procedure hyperlink

( p_col pls_integer

, p_row pls_integer

, p_url varchar2

, p_value varchar2 := null

, p_sheet pls_integer := null

);

--

procedure comment

( p_col pls_integer

, p_row pls_integer

, p_text varchar2

, p_author varchar2 := null

, p_width pls_integer := 150  -- pixels

, p_height pls_integer := 100  -- pixels

, p_sheet pls_integer := null

);

--

procedure mergecells

( p_tl_col pls_integer -- top left

, p_tl_row pls_integer

, p_br_col pls_integer -- bottom right

, p_br_row pls_integer

, p_sheet pls_integer := null

);

--

procedure set_column_width

( p_col pls_integer

, p_width number

, p_sheet pls_integer := null

);

--

procedure set_column

( p_col pls_integer

, p_numFmtId pls_integer := null

, p_fontId pls_integer := null

, p_fillId pls_integer := null

, p_borderId pls_integer := null

, p_alignment tp_alignment := null

, p_sheet pls_integer := null

);

--

procedure set_row

( p_row pls_integer

, p_numFmtId pls_integer := null

, p_fontId pls_integer := null

, p_fillId pls_integer := null

, p_borderId pls_integer := null

, p_alignment tp_alignment := null

, p_sheet pls_integer := null

);

--

procedure freeze_rows

( p_nr_rows pls_integer := 1

, p_sheet pls_integer := null

);

--

procedure freeze_cols

( p_nr_cols pls_integer := 1

, p_sheet pls_integer := null

);

--

procedure set_autofilter

( p_column_start pls_integer := null

, p_column_end pls_integer := null

, p_row_start pls_integer := null

, p_row_end pls_integer := null

, p_sheet pls_integer := null

);

--

function finish

return blob;

--

procedure save

( p_directory varchar2

, p_filename varchar2

);

--

procedure query2sheet

( p_sql varchar2

, p_column_headers boolean := true

, p_directory varchar2 := null

, p_filename varchar2 := null

, p_sheet pls_integer := null

);

--

/* Example

begin

as_xlsx.new_sheet;

as_xlsx.cell( 5, 1, 5 );

as_xlsx.cell( 3, 1, 3 );

as_xlsx.cell( 2, 2, 45 );

as_xlsx.cell( 3, 2, 'Anton Scheffer', p_alignment => as_xlsx.get_alignment( p_wraptext => true ) );

as_xlsx.cell( 1, 4, sysdate );

as_xlsx.cell( 2, 4, sysdate, p_numFmtId => as_xlsx.get_numFmt( 'dd/mm/yyyy h:mm' ) );

as_xlsx.cell( 3, 4, sysdate, p_numFmtId => as_xlsx.get_numFmt( as_xlsx.orafmt2excel( 'dd/mon/yyyy' ) ) );

as_xlsx.cell( 5, 5, 75, p_borderId => as_xlsx.get_border( 'double', 'double', 'double', 'double' ) );

as_xlsx.cell( 2, 3, 33 );

as_xlsx.hyperlink( 1, 6, 'http://www.amis.nl', 'Amis site' );

as_xlsx.cell( 1, 7, 'Some merged cells', p_alignment => as_xlsx.get_alignment( p_horizontal => 'center' ) );

as_xlsx.mergecells( 1, 7, 3, 7 );

for i in 1 .. 5

loop

as_xlsx.comment( 3, i + 3, 'Row ' || (i+3), 'Anton' );

end loop;

as_xlsx.new_sheet;

as_xlsx.set_row( 1, p_fillId => as_xlsx.get_fill( 'solid', 'FFFF0000' ) ) ;

for i in 1 .. 5

loop

as_xlsx.cell( 1, i, i );

as_xlsx.cell( 2, i, i * 3 );

as_xlsx.cell( 3, i, 'x ' || i * 3 );

end loop;

as_xlsx.query2sheet( 'select rownum, x.*

, case when mod( rownum, 2 ) = 0 then rownum * 3 end demo

, case when mod( rownum, 2 ) = 1 then ''demo '' || rownum end demo2 from dual x connect by rownum <= 5' );

as_xlsx.save( 'MY_DIR', 'my.xlsx' );

end;

*/

end;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值