vendredi 11 septembre 2015

Encountered the symbol "DECLARE" and Encountered the symbol "end-of-file"

I'm following a tutorial from Oracle, and in the last step I'm trying to execute a SQL script where I get the errors from DECLARE and end-of-file. Any idea where I went wrong? The following is the script:

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;



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire