王朝网络
分享
 
 
 

关于lob字段的处理(通过modplsql处理blob)

王朝mssql·作者佚名  2008-05-19
宽屏版  字体: |||超大  

这是oracle提供的一个范例,我try了一下,非常好用.

代码:--------------------------------------------------------------------------------

@$oracle_home/rdbms/admin/owaload.sql

使用ie对oracle http server 中的modpl/sql实施配置

Database Access Descriptor Name updown

Schema Name scott

Oracle User Name scott

Oracle Password scott

Oracle Connect String

Document Table scott.documents

Document Access Procedure scott.cntsample.download

CONNECT Samples/Samples

SET DEFINE OFF

CREATE TABLE documents (

NAME VARCHAR2(256) NOT NULL,

MIME_TYPE VARCHAR2(128) NULL,

DOC_SIZE NUMBER NULL,

DAD_CHARSET VARCHAR2(128) NULL,

LAST_UPDATED DATE NULL,

CONTENT_TYPE VARCHAR2(128) NULL,

CONTENT LONG RAW NULL,

BLOB_CONTENT BLOB

)

/

CREATE TABLE documentspart (

DOCUMENT VARCHAR2(256),

PART VARCHAR2(256),

UPLOADED CHAR(1),

constraint documentspart_pk primary key( document, part )

)

/

CREATE OR REPLACE PACKAGE cntsample IS

/*

This package was written by Audun V. Nes (anes@dk.oracle.com).

The intention of this sample is to show the File Upload/Download

capabilities of the PL/SQL gateway shipped with iAS.

Last updated 24th of May 2000.

*/

PROCEDURE startup;

PROCEDURE menu;

PROCEDURE dummy;

PROCEDURE upload_form;

PROCEDURE upload(name IN owa.vc_arr);

PROCEDURE download_form;

PROCEDURE download(p_file IN VARCHAR2);

PROCEDURE remove_form;

PROCEDURE remove(p_file IN owa.vc_arr);

END;

/

CREATE OR REPLACE PACKAGE BODY cntsample IS

PROCEDURE startup IS

BEGIN

-- This procedure only creates a simple frameset.

htp.htmlOpen;

htp.framesetOpen(crows = '72,*');

htp.frame(csrc = 'cntsample.menu', cname = 'frame1', cscrolling = 'NO');

htp.framesetOpen(ccols = '40%,*');

htp.frame(csrc = 'cntsample.dummy', cname = 'frame2', cscrolling = 'NO');

htp.frame(csrc = 'cntsample.dummy', cname = 'frame3', cscrolling = 'AUTO');

htp.framesetClose;

htp.framesetClose;

htp.htmlClose;

EXCEPTION

WHEN OTHERS THEN

htp.p(sqlerrm);

RETURN;

END;

PROCEDURE menu IS

BEGIN

-- This procedure creates a simple menu from which the end user can make his choice.

htp.htmlOpen;

htp.bodyOpen(cattributes = 'TEXT="#FFFFFF" LINK="#FFFFFF" ALINK="#FFFFFF" VLINK="#FFFFFF"');

htp.tableOpen(cattributes = 'BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%" BGCOLOR="#666699"');

htp.tableRowOpen;

htp.tableData(htf.img(curl = '/images/wwcban.jpg'));

htp.tableData(htf.fontOpen('#FFFFFF', 'arial,helvetica','+2')||'Content Table Sample'||htf.fontClose);

htp.tableData(htf.anchor2(curl = 'cntsample.upload_form', ctext = 'Upload File(s)', ctarget = 'frame2'));

htp.tableData(htf.anchor2(curl = 'cntsample.download_form', ctext = 'Download File(s)', ctarget = 'frame2'));

htp.tableData(htf.anchor2(curl = 'cntsample.remove_form', ctext = 'Remove File(s)', ctarget = 'frame3'));

htp.tableData(htf.anchor2(curl = 'owa_util.showsource?cname='||owa_util.get_procedure, ctext = 'View Source

Code', ctarget = 'frame3'));

htp.tableRowClose;

htp.tableClose;

htp.bodyClose;

htp.htmlClose;

EXCEPTION

WHEN OTHERS THEN

htp.p(sqlerrm);

RETURN;

END;

PROCEDURE dummy IS

BEGIN

-- This procedure shows an empty page with a background image. It is used in the frameset startup.

htp.htmlOpen;

htp.bodyOpen(cbackground = '/images/wsd.gif');

htp.bodyClose;

htp.htmlClose;

EXCEPTION

WHEN OTHERS THEN

htp.p(sqlerrm);

RETURN;

END;

PROCEDURE upload_form IS

BEGIN

htp.header(3,'Upload a file');

-- This procedure creates a simple HTML form that lets the end user upload his file(s).

htp.formOpen(curl = 'cntsample.upload', cmethod = 'POST', cenctype = 'multipart/form-data');

htp.p('');

htp.formSubmit;

htp.formClose;

htp.para;

htp.header(3,'Upload multiple files');

htp.formOpen(curl = 'cntsample.upload', cmethod = 'POST', cenctype = 'multipart/form-data');

htp.p('');

htp.br;

htp.p('');

htp.br;

htp.p('');

htp.br;

htp.p('');

htp.br;

htp.p('');

htp.br;

htp.formSubmit;

htp.formClose;

EXCEPTION

WHEN OTHERS THEN

htp.p(sqlerrm);

RETURN;

END;

PROCEDURE upload(name IN owa.vc_arr) IS

/* This procedure can upload both one single file as well as multiple files.

The actual upload is done by the listener. You simply initialize the process

by providing the file to be uploaded. */

i BINARY_INTEGER := 0;

BEGIN

LOOP

i := i + 1;

IF name(i) IS NOT NULL THEN

htp.p(name(i)||' uploaded');

htp.br;

ELSE

NULL;

END IF;

END LOOP;

EXCEPTION

WHEN NO_DATA_FOUND THEN

NULL;

WHEN OTHERS THEN

htp.p(sqlerrm);

RETURN;

END;

PROCEDURE download_form IS

-- This procedure shows you which files can be downloaded, and allows you to do so.

CURSOR c1 IS

SELECT name FROM documents;

BEGIN

htp.htmlOpen;

htp.bodyOpen;

FOR l1 IN c1 LOOP

htp.anchor2(curl = 'cntsample.download?p_file='||l1.name, ctext = l1.name, ctarget = 'frame3');

htp.br;

END LOOP;

htp.bodyClose;

htp.htmlClose;

EXCEPTION

WHEN OTHERS THEN

htp.p(sqlerrm);

RETURN;

END;

PROCEDURE download(p_file IN VARCHAR2) IS

BEGIN

/*

The actual download is handled by the PL/SQL gateway based on the settings

in your DAD. The code below simply initialize the process by specifying which file to get.

*/

wpg_docload.download_file(p_file);

EXCEPTION

WHEN OTHERS THEN

htp.p(sqlerrm);

RETURN;

END;

PROCEDURE remove_form IS

-- This procedure creates an HTML form that lets the end user delete unwanted files.

CURSOR c1 IS

SELECT name, mime_type, doc_size, dad_charset, last_updated, content_type FROM documents;

BEGIN

htp.header(3,'Select the file(s) to remove');

htp.formOpen(curl = 'cntsample.remove', cmethod = 'POST');

htp.tableOpen(cborder = 'BORDER=1');

FOR l1 IN c1 LOOP

htp.tableRowOpen;

htp.tableData(htf.formCheckbox(cname = 'p_file', cvalue = l1.name));

htp.tableData(l1.name);

htp.tableData(l1.mime_type);

htp.tableData(l1.doc_size);

htp.tableData(l1.dad_charset);

htp.tableData(l1.last_updated);

htp.tableData(l1.content_type);

htp.tableRowClose;

END LOOP;

htp.tableClos

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
>>返回首页<<
推荐阅读
 
 
频道精选
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有