以下是我将数据排入队列的过程,在运行该过程时出现编译错误,我找不到出错的地方。请帮我解决。
CREATE OR REPLACE PROCEDURE p_enqueue(msg IN VARCHAR2)
AS
PRAGMA AUTONOMOUS_TRANSACTION;
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
BEGIN
dbms_aq.enqueue( queue_name => 'example_queue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message_type(msg),
msgid => message_handle);
COMMIT;
END;
错误:
PLS-00201:必须声明标识符“DBMS_AQ”
PLS-00320:此表达式类型的声明不完整或格式错误
当我尝试使用授予权限时,出现以下错误
错误 ORA-01031: 权限不足
如果这是我运行下面的 pl/sql 块来排队消息的问题,那么程序已成功创建。如果权限不存在怎么可能?
DECLARE
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
message message_typ;
BEGIN
message := message_typ('NORMAL MESSAGE',
'enqueued to msg_queue first.');
dbms_aq.enqueue(queue_name => 'msg_queue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
COMMIT;
end;