dbms_pipe(管道用法)
来源:互联网 发布:php wget 下载文件 编辑:程序博客网 时间:2024/06/05 00:28
1、再一个session中建立管道
set serveroutput on;
declare
v_statpipe1 integer;
v_statpipe2 integer;
v_pubchar varchar2(100):='This is a text string';
v_pubdate date := sysdate;
v_pubnum number :=109;
begin
v_statpipe1 := dbms_pipe.create_pipe('myprivatepipe');
if v_statpipe1=0 then
dbms_pipe.pack_message('privateline1');
dbms_pipe.pack_message('privateline2');
v_statpipe1 :=dbms_pipe.send_message('myprivatepipe');
end if;
dbms_pipe.pack_message(v_pubchar);
dbms_pipe.pack_message(v_pubdate);
dbms_pipe.pack_message(v_pubnum);
--pub pipe
v_statpipe2 := dbms_pipe.send_message('mypublicpipe');
dbms_output.put_line('the status of your private pipe is '||v_statpipe1);
dbms_output.put_line('the status of your public pipe is '||v_statpipe2);
end;
/
declare
v_statpipe1 integer;
v_statpipe2 integer;
v_pubchar varchar2(100):='This is a text string';
v_pubdate date := sysdate;
v_pubnum number :=109;
begin
v_statpipe1 := dbms_pipe.create_pipe('myprivatepipe');
if v_statpipe1=0 then
dbms_pipe.pack_message('privateline1');
dbms_pipe.pack_message('privateline2');
v_statpipe1 :=dbms_pipe.send_message('myprivatepipe');
end if;
dbms_pipe.pack_message(v_pubchar);
dbms_pipe.pack_message(v_pubdate);
dbms_pipe.pack_message(v_pubnum);
--pub pipe
v_statpipe2 := dbms_pipe.send_message('mypublicpipe');
dbms_output.put_line('the status of your private pipe is '||v_statpipe1);
dbms_output.put_line('the status of your public pipe is '||v_statpipe2);
end;
/
2、再另外一个session中收取管道中的消息
set serveroutput on;
declare
v_statpipe1 integer;
v_statpipe2 integer;
v_holdtype integer;
v_holdchar varchar2(100);
v_holddate date;
v_holdnum number;
begin
v_statpipe1 := dbms_pipe.receive_message('myprivatepipe',15);
dbms_pipe.unpack_message(v_holdchar);
dbms_output.put_line(v_holdchar);
dbms_pipe.unpack_message(v_holdchar);
dbms_output.put_line(v_holdchar);
--public pipe
v_statpipe2 := dbms_pipe.receive_message('mypublicpipe',10);
loop
v_holdtype := dbms_pipe.next_item_type;
if v_holdtype=0 then exit;
elsif v_holdtype=6 then dbms_pipe.unpack_message(v_holdnum);
elsif v_holdtype=9 then dbms_pipe.unpack_message(v_holdchar);
elsif v_holdtype=12 then dbms_pipe.unpack_message(v_holddate);
end if;
end loop;
dbms_output.put_line(v_holddate||' '||v_holdnum||' '||v_holdchar);
end;
/
declare
v_statpipe1 integer;
v_statpipe2 integer;
v_holdtype integer;
v_holdchar varchar2(100);
v_holddate date;
v_holdnum number;
begin
v_statpipe1 := dbms_pipe.receive_message('myprivatepipe',15);
dbms_pipe.unpack_message(v_holdchar);
dbms_output.put_line(v_holdchar);
dbms_pipe.unpack_message(v_holdchar);
dbms_output.put_line(v_holdchar);
--public pipe
v_statpipe2 := dbms_pipe.receive_message('mypublicpipe',10);
loop
v_holdtype := dbms_pipe.next_item_type;
if v_holdtype=0 then exit;
elsif v_holdtype=6 then dbms_pipe.unpack_message(v_holdnum);
elsif v_holdtype=9 then dbms_pipe.unpack_message(v_holdchar);
elsif v_holdtype=12 then dbms_pipe.unpack_message(v_holddate);
end if;
end loop;
dbms_output.put_line(v_holddate||' '||v_holdnum||' '||v_holdchar);
end;
/
pipe相关的另外一个函数就是 remove_pipe();
status:=dbms_pipe.remove_pipe('myprivatepipe');
status:=dbms_pipe.remove_pipe('mypublicpipe');
- dbms_pipe(管道用法)
- DBMS_PIPE管道通信
- DBMS_PIPE管道通信
- 管道函数dbms_pipe
- Oracle的管道(dbms_pipe) 通信
- dbms_pipe
- oracle系统包——DBMS_PIPE用法
- Oracle系统包——DBMS_PIPE用法
- DataOutputStream 处理流的用法:(管道)
- 有名管道(FIFO)的用法
- 无名管道的用法
- 有名管道的用法
- 多线程+管道的用法
- 有名管道的用法
- linux 管道 | 命令 用法
- dbms_pipe包的使用
- java NIO之管道Pipe()的用法
- java的NIO管道用法
- 上传下载全攻略jspSmartUpload
- Easy Ajax with jQuery[中文版3]
- 继承层次中的函数重载问题
- jspsmartupload组件修改经验谈
- 水晶报表的使用(1)——动态数据填充技巧[PUSH 模式]
- dbms_pipe(管道用法)
- 图书管理系统数据库设计
- HTML复选框
- 规模较大的C++项目代码层次结构
- Microsoft .NET Pet Shop 4 架构与技术分析
- 使用资源文件
- 千万级数据的分类搜索引擎(二)
- 设计模式---封装变化
- 失败