Possible Duplicate:
PL/SQL function in Oracle cannot see DBMS_AQ
Below is my procedure to enqueue data in a queue, while running the procedure I am getting compilation errors, I can't find where I went wrong. Please help me with solution.
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;
ERRORS:
PLS-00201: identifier 'DBMS_AQ' must be declared
PLS-00320: the declaration of the type of this expression is incomplete or malformed
when i try to use grant privilage, i am getting following error
ERROR ORA-01031: insufficient privileges
If that is the problem i ran the below pl/sql block to enqueue message, the procedure got successfully created.How is it possible if the privilage is not there?
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;