我正在关注Oracle的教程,在最后一步中,我正在尝试执行一个SQL脚本,我从DECLARE和文件结尾处获取错误。知道我哪里错了吗?以下是脚本:
create or replace
PROCEDURE ENQUEUE_TEXT(
payload IN VARCHAR2 )
AS
enqueue_options DBMS_AQ.enqueue_options_t;
message_properties DBMS_AQ.message_properties_t;
message_handle RAW (16);
user_prop_array SYS.aq$_jms_userproparray;
AGENT SYS.aq$_agent;
header SYS.aq$_jms_header;
MESSAGE SYS.aq$_jms_message;
BEGIN
AGENT := SYS.aq$_agent ('', NULL, 0);
AGENT.protocol := 0;
user_prop_array := SYS.aq$_jms_userproparray ();
header := SYS.aq$_jms_header (AGENT, '', 'aq1', '', '', '', user_prop_array);
MESSAGE := SYS.aq$_jms_message.construct (0);
MESSAGE.set_text (payload);
MESSAGE.set_userid ('Userid_if_reqd');
MESSAGE.set_string_property ('JMS_OracleDeliveryMode', 2);
--(header, length(message_text), message_text, null);
DBMS_AQ.enqueue (queue_name => 'userQueue', enqueue_options => enqueue_options,
message_properties => message_properties, payload => MESSAGE, msgid => message_handle );
COMMIT;
END ENQUEUE_TEXT;
DECLARE
PAYLOAD varchar2(200);
BEGIN
PAYLOAD := 'Hello from AQ !';
ENQUEUE_TEXT(PAYLOAD => PAYLOAD);
END;
答案 0 :(得分:1)
你必须在创建proc之后放置一个/
。
....
message_properties => message_properties, payload => MESSAGE, msgid => message_handle );
COMMIT;
END ENQUEUE_TEXT;
/
--COMMIT;
--/
DECLARE
PAYLOAD varchar2(200);
BEGIN
PAYLOAD := 'Hello from AQ !';
ENQUEUE_TEXT(PAYLOAD => PAYLOAD);
END;
可能缺少COMMIT;
。