SENDPIPE¶
说明¶
此函数用于将本地发送缓冲区中的消息发送到管道中
返回值¶
发送消息成功返回0,超时等待退出会返回1,失败会报错。
注解
发送管道消息时,管道名称、超时等待时间和管道长度参数传入NULL会报错。
除创建者和管理员其他用户没有向私有管道发送消息的权限。
SENDPIPE函数提供对DBMS.SEND_MESSAGE方法的实现,该方法的详细说明请参照 SEND_MESSAGE 章节。
示例¶
-- 清理环境
drop procedure mysendpipe cascade;
select removepipe('mypipe');
REMOVEPIPE(int) |
---------------------
0 |
总数目:1
-- 发送消息程序,此程序需要调用dbms_pipe.pack_message方法构建消息
create procedure mysendpipe() is
declare
statpipe int;
mytext varchar2(100):='This is a text string';
mydate date := to_date('2017-05-05');
mynum number := 109;
begin
statpipe := createpipe('mypipe',8192,FALSE);
dbms_pipe.pack_message(mytext);
dbms_pipe.pack_message(mydate);
dbms_pipe.pack_message(mynum);
statpipe := sendpipe('mypipe',10,8192);
if statpipe = 0 then
dbms_output.put_line('send message success');
else
dbms_output.put_line('send message fail');
end if;
end;
/
exec mysendpipe();
select removepipe('mypipe');
REMOVEPIPE(int) |
---------------------
0 |
总数目:1
drop procedure mysendpipe;