title: Simulate a scenario where message goes into exception queue
body: <p>How to simulate an exception during enqueue/dequeue/browse of oracle aq so that message goes into exception queue. I am newbie and yet to go through subscribers and consumer. What I hv done is ----</p>
  
  <pre><code>BEGIN dbms_aqadm.drop_queue_table ( 
     queue_table        =&gt; 'demo_queue_table', 
     force              =&gt; TRUE); 
  END;
  ---------------------  Creation of queue table 
  BEGIN
   DBMS_AQADM.CREATE_QUEUE_TABLE (
      queue_table        =&gt; 'demo_queue_table',
      queue_payload_type =&gt; 'demo_queue_payload_type'
      );
  END;
  -------------------- Creation and starting of the queue
  BEGIN
       DBMS_AQADM.CREATE_QUEUE (
          queue_name  =&gt; 'demo_queue',
          queue_table =&gt; 'demo_queue_table'
          );
  
       DBMS_AQADM.START_QUEUE (
          queue_name =&gt; 'demo_queue'
          );
  END;
  ---------------------Exception Queue 
  BEGIN  
    dbms_aqadm.create_queue(
    queue_name =&gt; 'demo_queue_e',
    queue_table =&gt; 'demo_queue_table',
    queue_type =&gt; DBMS_AQADM.EXCEPTION_QUEUE,
    dependency_tracking =&gt; FALSE,
    comment =&gt; 'EXCEPTION QUEUE OF DEMO QUEUE TABLE');
  
    -- start queue
    dbms_aqadm.start_queue('DEMO_QUEUE_E',enqueue =&gt; FALSE, dequeue =&gt; TRUE);
  END;
  
  
  BEGIN 
   dbms_aqadm.start_queue('AQ$_DEMO_QUEUE_TABLE_E',enqueue =&gt; FALSE, dequeue =&gt; TRUE);
   END;
  ------------- Enqueue with Exception queue specified
  DECLARE
         r_enqueue_options    DBMS_AQ.ENQUEUE_OPTIONS_T;
       r_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
       v_message_handle     RAW(16);
       o_payload            demo_queue_payload_type;
    BEGIN
        o_payload := demo_queue_payload_type('Message'); 
        r_message_properties.exception_queue := 'DEMO_QUEUE_E';
        DBMS_AQ.ENQUEUE(
           queue_name         =&gt; 'demo_queue',
           enqueue_options    =&gt; r_enqueue_options,
           message_properties =&gt; r_message_properties,
           payload            =&gt; o_payload,
           msgid              =&gt; v_message_handle
           );
         DBMS_OUTPUT.PUT_LINE('*** Exception Queue is [' || o_payload.message || '] ***'); 
         DBMS_OUTPUT.PUT_LINE('*** Exception Queue is [' || r_message_properties.exception_queue || '] ***');   
       COMMIT; 
     END;
     ------------------------------ BRowse  
     DECLARE  
        r_dequeue_options    DBMS_AQ.DEQUEUE_OPTIONS_T;
        r_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
        v_message_handle     RAW(16);
        o_payload            demo_queue_payload_type;  
     BEGIN 
        r_dequeue_options.dequeue_mode := DBMS_AQ.REMOVE;  
         DBMS_AQ.DEQUEUE(
           queue_name         =&gt; 'demo_queue',
           dequeue_options    =&gt; r_dequeue_options,
           message_properties =&gt; r_message_properties,
           payload            =&gt; o_payload,
           msgid              =&gt; v_message_handle
           );
       DBMS_OUTPUT.PUT_LINE('*** Browsed message is [' || o_payload.message || '] ***');
      --  DBMS_OUTPUT.PUT_LINE('*** Browsed message is [' || r_message_properties.exception_queue || '] ***');
     END;
    -----------------------------------Dequeue
    DECLARE  
        r_dequeue_options    DBMS_AQ.DEQUEUE_OPTIONS_T;
        r_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
        v_message_handle     RAW(16);
        o_payload            demo_queue_payload_type;   
        no_messages            exception;
        pragma                       exception_init (no_messages, -25263);
     BEGIN   
        DBMS_AQ.DEQUEUE(
           queue_name         =&gt; 'demo_queue',
           dequeue_options    =&gt; r_dequeue_options,
           message_properties =&gt; r_message_properties,
           payload            =&gt; o_payload,
           msgid              =&gt; v_message_handle
           );  
        DBMS_OUTPUT.PUT_LINE('*** Dequeued message is [' || o_payload.message || '] ***');   
       COMMIT;   
     END;
     ---------------------------------start the error queue---------------------------------------------
     exec dbms_aqadm.start_queue('AQ$_DEMO_QUEUE_TABLE_E',false, true);
  </code></pre>
  
  <p>I am familier with enqueue , dequeue, browse functionality now.
  I just want to see how exception queue works, and do some experiments on exception queue (browse and dequeue). 
  Theoritically it is not possible to enqueue in exception queue. SO I have to generate some scenario where message goes into exception queue during enqueue ,dequeue or browse. </p>