Dequeue   elements from an  apply - queue table

hi Everyone?
I'm tried dequeue elements from a queue table. This one, is associated to an apply streams process. I'd wrote this procedure to test a manual dequeue, but this error message appears :
ORA-25228: timeout or end-of-fetch during message dequeue from STADMIN.Q_APP_SELECTS_FROM_CRM
The queue is not empty
Help me please... thank you
The Procedure code is:
create or replace procedure str_clean_queue (cola in varchar2, tabla in varchar2, comando in varchar2) is
next_trans EXCEPTION;
pragma exception_init (next_trans, -25235);
no_messages EXCEPTION;
pragma exception_init (no_messages, -25228);
dequeueOpt dbms_aq.dequeue_options_t;
message_properties dbms_aq.message_properties_t;
message SYS.ANYDATA;
msgid raw(16);
newMess boolean;
lcr SYS.LCR$_ROW_RECORD;
a number :=0;
begin
dequeueOpt.CONSUMER_NAME := 'APP_SELECTS_FROM_CRM';
dequeueOpt.DEQUEUE_MODE := DBMS_AQ.LOCKED;
dequeueOpt.NAVIGATION := DBMS_AQ.FIRST_MESSAGE;
dequeueOpt.VISIBILITY := DBMS_AQ.IMMEDIATE;
dequeueOpt.WAIT :=10;
dequeueOpt.MSGID := null;
newMess:=True;
while (newMess) loop
begin
DBMS_AQ.DEQUEUE (
queue_name => 'STADMIN.'|| cola,
dequeue_options => dequeueOpt,
message_properties => message_properties,
payload => message,
msgid => msgid);
-- analizamos lo que llego en el payload
lcr := DBMS_STREAMS.CONVERT_ANYDATA_TO_LCR_ROW(message);
if (lcr.get_command_type = comando AND
lcr.get_object_name = tabla AND
lcr.get_object_owner = 'DBADMIN') then
-- hacer desaparecer el lcr de la cola
dequeueOpt.DEQUEUE_MODE := DBMS_AQ.REMOVE;
dequeueOpt.MSGID := msgid;
DBMS_AQ.DEQUEUE (
queue_name => 'STADMIN.'|| cola,
dequeue_options => dequeueOpt,
message_properties => message_properties,
payload => message,
msgid => msgid);
a:=a+1;
end if;
dbms_output.put_line(a);
exception
WHEN next_trans THEN
dequeueOpt.navigation := DBMS_AQ.NEXT_TRANSACTION;
WHEN no_messages THEN
dbms_output.put_line(sqlerrm);
newMess := FALSE;
end;
end loop;
end str_clean_queue;

Hello,
as you wrote you already have a code snippet with DBMS_AQ.DEQUEUE of an exception queue.
Wrap this DEQUEUE in an infinite loop (LOOP ... END LOOP). In order to have this procedure as an autonomous session
you can start it as a database job:
DECLARE
   v_jobno NUMBER(6);
BEGIN
    DBMS_JOB.SUBMIT( v_jobno,
                    'BEGIN <your module>; END;',
                    SYSDATE, NULL );
    COMMIT;
END;
/Kind regards,
WoG

Similar Messages

  • Dequeue from multi consumer queue table

    Hi,
    Even after all consumers I created have dequeued the messages (in REMOVE mode), they just didn't go from the queue table. Although my application works fine (the messages could no longer be dequeued again), I am afraid this will affect performance when messages piled up in Q table.
    I tried maunally delete the records in Q table. But the question is "is there an automatic way to handle this?"
    Thx for any feedback!

    Make sure that the init.ora parameter AQ_TM_PROCESSES is set to 1 or more. This is the parameter that controls the number of processes available to clean up the queue after the messages have been dequeued or the message has expired.

  • Manual deletion from queue table

    Hi All,
    Thanks in advance for helping.
    We have one queue table. The data volume in this queue table very very low.
    But someone tried to do a manual delete from the queue table. Now I think the queue table has been corrupted.
    Some of the jobs which reads from the queue table is not able to read it, its constantly trying to read and not finding any message. Whereas some other jobs are able to queue message and dequeue it from the same queue.
    My question is "Is there any way fix this issue without dropping and recreating the queue?"
    Like will purging the queue solve this issue?
    Regards,
    Samujjwal Basu

    Hello,
    in general, a direct DELETE from a queue table is not allowed. The queue will then be corrupted! 
    >Like will purging the queue solve this issue?
    Yes, there is a special PURGE statement for AQ, which should be used instead.
    Example:
    DECLARE
       v_purge_options    dbms_aqadm.aq$_purge_options_t;
    BEGIN
       v_purge_options.block := FALSE;
       DBMS_AQADM.PURGE_QUEUE_TABLE(
         queue_table     => 'SCOTT.QTAB_TEST',
         purge_condition => NULL,
         purge_options   => v_purge_options );
    END;
    Kind regards,
    WoG

  • Get selected elements from a table

    Hi all,
    I have a requirement like i m enhancing standard component in that i have added one button on click of that i want fetch the selected line item from the table ( which is a normal table). selection mode is auto.
    i tried with  the following code.
    DATA:lr_element                   TYPE REF TO if_wd_context_element,
           lv_index                     TYPE i.
    *--Get selected element
      lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
    ****Here itself its throughing dump because lr_element is initial***************
    *--get selected element index.
      lv_index = lr_element->get_index( ).
    can any one help me what is the wrong.. else suggest me how to get the selected elements from a table....
    Thanks in advance.

    *--Get selected element
    lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
    if  lr_element is bound.
    lv_index = lr_element->get_index( ).
    endif.
    Instead you can directly read the node if that row is a lead selected one.
    lo_node = wd_context->get_child_node( name = 'EMP' ).  "Emp is node name
    lo_ele = lo_node->get_lead_selection( ).
    or
    lv_index = lo_node->get_lead_selection_index( ).
    where is the above code written..is it written in OnLeadSelect event of the TABLE..
    can any one help me what is the wrong.. else suggest me how to get the selected elements from a table....
    As the selection mode is Auto there is no multiple selection..hence try to use the lead selection only.
    Edited by: Lekha on Jan 3, 2012 6:47 PM

  • How to insert queue element from C

    I want to insert a single queue element into a LabView Queue from C (from a DLL).
    The only thing I found is How to set an Labview-Occurence from C. I assume that I have to do that in 2 steps: 1. copy the string data into the queue with a push/pop command. 2. Set the Occurence from the queue to notify waiting queue elements.
    I only need to know how to realize this in the exactly way. (internals of Queue handling, Queue structure, example code, ....)
    I'm using LabView 6.0.2 with WinNT 4.0
    Thank's for help.
    Robert

    Robert,
    You currently cannot access Queue elements from external code. We hope to add this feature to a future version.
    Marcus Monroe
    National Instruments

  • Select from a queue table with SYS.AQ$_JMS_MAP_MESSAGE type

    We are using the SYS.AQ$_JMS_MAP_MESSAGE type for our queue so that we can access the queue using plsql as well as java (via jms). The queue table that gets created contains a column user_data that is of the above type. This type has two columns BYTES_RAW and BYTES_LOB which I assume contains the data. Is there a way in sql (or in plsql) to get access to the data. Also, we are retaining the messages after they have been consumed (from an audit standpoint) and might need access to the data.
    Thank you
    Navin

    yes, i understand how to describe something...
    my question is how to get a list of properties.
    this data type has get functions that take the name of a property. now how do i know that property name to get it?

  • Need to take the N-th element from a queue

    hello everyone!
    I have a problem, i don't know how to take ony one element from a queue...
    Indeed, i need to take only the 3rd element of a queue but i don't know how to do that... so i though maybe i can change it as an array (with the vi "flush queue") and then take the 3rd element of this new array but same problem, i don't know how to manage that!
    please help me, i have been trying to solve this problem all day long
    thank you very much!
    Yanis

    I am not sure if there is a more elegant solution but what I have done in the past in similar situations was to get all elements of the queue with the queue status. Then I would flush the queue and pop any elements I wanted back on the queue while removing the items I needed/wanted. As I say, this is not the most elegant but it is a tried and true method. If your elements are fairly small and you don't have lots of elements on the queue the performance hit is not too terrible.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Dequeue element times out even when queue element has new data

    Hi,
    I am using a producer/consumer set up and I am only getting one-iteration from my consumer loop.  I have probed the cluster wire that feeds the enqueue element of the producer and there is a continuous data stream there.  I have a timeout wired to the dequeue element in the consumer loop and have tried different times from 1ms to 1000ms.  It is currently at 25ms.  There has to be something else that is causing this issue, but I am overlooking it.  
    I also tried adding an event handler that would detect a value change in the data.  That didn't do anything.  I have tried to restart my machine to no avail.  I am about to shut down and take the battery out of my laptop and reboot (the act of a man out of options).
    If anyone could help, I would be indebted. 
    P Gnu
    If you want to increase your success rate, double your failure rate.
    Solved!
    Go to Solution.
    Attachments:
    Dequeue Waiting.vi ‏139 KB

    Thanks Javed_H
    I thought that I tried that, but either I didn't or I did it while there was another bug.  At any rate, the time-out on the event handler did fix it.  I appreciate your help.
    The reason I am using an event handler rather than a local variable is because I have been told many, many times that the local variable is somewhat of a hack.  They gave me other reasons, although they escape me now.  I do recognize and agree, however, that the local variable would work.  I'm letting the design asthetics of others dictate my code.
    Thank you for your input,
    P Gnu
    If you want to increase your success rate, double your failure rate.

  • WebDynpro Java: how to remove blank element from Table and Dropdown.

    Hi  Folks
    In a webdynpro application,
    I created a table and witten the below code to populate the table
         IPrivateDummyView.IFirst_TableElement First_Table_Element = null;
         First_Table_Element = wdContext.nodeFirst_Table().createFirst_TableElement();
         First_Table_Element.setF_Value("One");
         wdContext.nodeFirst_Table().addElement(First_Table_Element);
         First_Table_Element = wdContext.nodeFirst_Table().createFirst_TableElement();
         First_Table_Element.setF_Value("2");
         wdContext.nodeFirst_Table().addElement(First_Table_Element);
    As per the code, i got 2 row in the table.
    But , i have one Empty row on top of the table ,  how to get ride of this.
    i find the same problem happening with dropdown too, where i used DDBI, i populated a the content as mention, but i initial 2 row as blank and then i have my own elements ,as per my code.

    >
    > how to remove blank element from Table and Dropdown
    >
    Change selection property of related node to from 0..1 to 1..1 (mandatory)
    Re: DropdownByIndex and empty line (Thread: DropdownByIndex and empty line )
    Re: Can the empty selection be removed from element dropdownbykey(Thread: Can the empty selection be removed from element dropdownbykey )
    Edited by: Anagha Jawalekar on Nov 18, 2008 10:28 PM

  • Dequeue from an exception queue

    Hi,
    I am very new to oracle AQ and trying dequeuing of message from an exception queue. I have created a procedure for dequeuing a message from exception queue and is working fine. I have to execute this procedure manually each time a message is moved to the exception queue. Is there any mechanism to call this procedure automatically each time the message is moved to exception queue? Please help.
    Thanks in Advance
    Lokesh

    Hello,
    as you wrote you already have a code snippet with DBMS_AQ.DEQUEUE of an exception queue.
    Wrap this DEQUEUE in an infinite loop (LOOP ... END LOOP). In order to have this procedure as an autonomous session
    you can start it as a database job:
    DECLARE
       v_jobno NUMBER(6);
    BEGIN
        DBMS_JOB.SUBMIT( v_jobno,
                        'BEGIN <your module>; END;',
                        SYSDATE, NULL );
        COMMIT;
    END;
    /Kind regards,
    WoG

  • Messages remain in Queue Table

    Hello,
    I work as a dba in a company where my colleagues are developing an application that uses AQ.
    The application is installed on multiple databases but we have a problem in a particular one:
    the processed messages are not deleted from table by Oracle.
    DBMS_AQADM.CREATE_QUEUE( Queue_name => 'my_AQ', Queue_table => 'AQT', Queue_type => 0, Max_retries => 65535, Retry_delay => 0, Retention_time => 2592000, dependency_tracking => FALSE);
    SELECT msg_state, count(*) FROM AQT GROUP BY msg_state;
    PROCESSED     830548
    SELECT min(enq_time),max(enq_time) FROM AQT
    07-OCT-10      01-AUG-12
    SELECT value FROM v$parameter WHERE name='aq_tm_processes'
    10
    thanks,

    Hi,
    I didn't notice this in your first post:
    DBMS_AQADM.CREATE_QUEUE(
        Queue_name => 'my_AQ',
        Queue_table => 'AQT',
        Queue_type => 0,
        Max_retries => 65535,
        Retry_delay => 0,
        Retention_time => 2592000,      <<<<<<<<<< why are you specifying such a high value for this?
        dependency_tracking => FALSE
    );Retention_time: See doc for this value: http://docs.oracle.com/cd/E11882_01/server.112/e11013/aq_admin.htm#i1006091
    This parameter specifies the number of seconds a message is retained in the queue table after being dequeued from the queue. When retention_time expires, messages are removed by the time manager process. INFINITE means the message is retained forever. The default is 0, no retention.
    You are asking for messages to be retained for 30 days, now looking at the min/max enq_time you have messages which are much older than this, but did you check when they were actually DQ'd (DEQ_TIME)?
    Also, from my previous post, did you check out that MOS note ? Did you check what the Q00 processes are doing in the database?
    Thanks
    Paul

  • Need to delete the SPAM requests from the import queue

    Dear all,
    There were some issues with my QA system SAP patch application and we were forced to do a DB refresh from our production system. Now our QA system ABAP stack is having an issue with the  STMS import queue which shows 4 old patches(witch were applied to the system before the refresh)  with u201Crequest will not be importedu201D status. When I try to delete these requests from the import queue it shows the following error
    u201CThis is tp version 372.04.29 (release 700, unicode enabled)
    ERROR: Client 'ALL' is not possible.
    tp returncode summary:
    TOOLS: Highest return code of single steps was: 0
    ERRORS: Highest tp internal error was: 0246
    standard output from tp and from tools called by tpu201D
    When I try to import a new support package it gives the  following error,
    Error in phase: CHECK_REQUIREMENTS
    Reason for error: QUEUE_NOT_EMPTY
    Not sure how these requests arew still in the import queue even after the DB refresh. How can I delete these 4 old requests from the import queue?
    The System is ECC6.0 ABAP+JAVA stack with Oracle 10g on Win2003 server.
    Thank you,
    Siju Sam

    Dear Ganesh,
    I have tried the steps you suggested, but still the import queue is not cleared.
    Now I just wanted to remove these entires from the STMS=>queue=>import queue list.
    Number   Request      Clt   Owner          Short Text
         1   SAPKB70013   ALL   SAPUSER        Basis Support Package 13 for 7.00
         2   SAPKA70013   ALL   SAPUSER        ABA Support Package 13 for 7.00
         3   SAPKB70014   ALL   SAPUSER        Basis Support Package 14 for 7.00
         4   SAPKA70014   ALL   SAPUSER        ABA Support Package 14 for 7.00
    I think these requests(Patches) are not there in the tp buffer/(import queue) but somehow some table entries shows the status that they are still in the  queue. So I just wanted to reset the status that These TPs are already applied.
    Thank you,
    Siju Sam

  • Select on queue table

    Hi,
    A Queue Table has been defined with payload type as SYS.AQ$_JMS_MESSAGE.
    In java a property has been defined using setStringProperty("AdditionalMsgID",'123456').
    Requirement is to get this property using sql SELECT statement.
    Question is how can this be achieved.
    By this "Requirement is to get this property using sql SELECT statement. "
    what I mean is that this property can be used in selecting or sorting the messages by using it in "WHERE" clause or "ORDER BY" clause of sql "SELECT" statement.
    I should be able to fire a SELECT statement from java using this property in the "ORDER BY" clause.
    For Example:- SELECT * FROM MsgTable ORDER BY UserMsgID;
    (where UserMsgID is a property defined in java for the message using setStringProperty() method.)
    I should not have to dequeue or browse the message as that would mean getting the Message Body as well which can be very huge.
    If I did not use JMS and instead I defined a simple type (structure) for holding the header and body of the message I am able to use that header in select statement. Similarly I wish if I could use the header or property defined in JMS as JMS payload is also built using type and type body.
    Hoping for a concrete solution as our lots of problem would be solved if this works out.
    Thanks & regards
    Sanjeev
    P.S. : I have posted a similar query in Advance queuing also but have not received any reply so I am posting it here hope one doesn't mind.
    Message was edited by:
    user453374

    Hello
    I've not used JMS myself but I've been having a dig round and I think you should be able to do what you're wanting to. This very simple example shows the principal:
    CREATE OR REPLACE TYPE ot_Test_Type IS OBJECT
    (     id     number,
         MEMBER FUNCTION GetProp(prop_name     IN VARCHAR2) RETURN NUMBER
    CREATE OR REPLACE TYPE BODY ot_Test_Type
    AS
         MEMBER FUNCTION GetProp(prop_name     IN VARCHAR2) RETURN NUMBER
         IS
              ln_Ret     NUMBER;
         BEGIN
              RETURN ASCII(prop_name);
         END;
    END;
    SQL> create table dt_test_ot_tab of ot_test_type;
    Table created.
    SQL> insert into dt_test_ot_tab values(ot_test_type(1));
    1 row created.
    SQL> select a.id from dt_test_ot_tab a where a.getprop('a') = 97;
            ID
             1
    SQL> select a.id from dt_test_ot_tab a where a.getprop('b') = 97;
    no rows selected
    SQL> select a.id from dt_test_ot_tab a where a.getprop('b') = 98;
            ID
             1So from the documentation for AQ$_JMS_MESSAGE, there are member functions
    MEMBER FUNCTION get_boolean_property (property_name   IN   VARCHAR)
    RETURN   BOOLEAN,
    MEMBER FUNCTION get_byte_property    (property_name   IN   VARCHAR)
    RETURN   INT,
    MEMBER FUNCTION get_short_property   (property_name   IN   VARCHAR)
    RETURN   INT,
    MEMBER FUNCTION get_int_property     (property_name   IN   VARCHAR)
    RETURN   INT,
    MEMBER FUNCTION get_long_property    (property_name   IN   VARCHAR)
    RETURN   NUMBER,
    MEMBER FUNCTION get_float_property   (property_name   IN   VARCHAR)
    RETURN   FLOAT,
    MEMBER FUNCTION get_double_property  (property_name   IN   VARCHAR)
    RETURN   DOUBLE PRECISION,
    MEMBER FUNCTION get_string_property  (property_name   IN   VARCHAR)
    RETURN   VARCHAR);Which you should be able to call in the where caluse of a select on that table in a similar way to the example above. The main thing I found is that you need to alias the table to be able to call the function.
    HTH
    David
    Message was edited by:
    david_tyler
    Oops! Forgot to put in the create table bit :-)

  • Multi-consumer queue table does not empty

    Hello,
    I must be missing something pretty trivial here but I have setup queue with a queue table where multiple_consumers = true. When I dequeue a message from the queue it is received, but the message is still left in the queue table. When I do a second dequeue I get a end-of-fetch error.
    Currently, there is only one subscriber and the subscriber is specified as the recipient of the message.
    How do I get the messages removed from the queue table?
    DECLARE
        queue_options       DBMS_AQ.ENQUEUE_OPTIONS_T;
        message_properties  DBMS_AQ.MESSAGE_PROPERTIES_T;
        recipients          DBMS_AQ.AQ$_RECIPIENT_LIST_T;
        message_id          RAW(16);
        my_message          MYRESP_T;
    BEGIN
        recipients(1) := sys.aq$_agent('MY_SUBSCRIBER',null,null);
        message_properties.recipient_list := recipients;
        my_message := MYRESP_T('99293','ORCL','TEST');
        DBMS_AQ.ENQUEUE(
            queue_name => 'RESP_Q',
            enqueue_options => queue_options,
            message_properties => message_properties,
            payload => my_message,
            msgid => message_id);
        COMMIT;
    END;
    DECLARE
            r_dequeue_options    DBMS_AQ.DEQUEUE_OPTIONS_T;
            r_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
            v_message_handle     RAW(16);
            o_payload                 MYRESP_T;
            v_dynamic_sql           VARCHAR2(4000);
            BEGIN
                r_dequeue_options.wait := DBMS_AQ.NO_WAIT;
                r_dequeue_options.dequeue_mode := DBMS_AQ.REMOVE;
                r_dequeue_options.navigation := DBMS_AQ.FIRST_MESSAGE;
                r_dequeue_options.consumer_name := 'MY_SUBSCRIBER';
                DBMS_AQ.DEQUEUE(
                    queue_name         => 'RESP_Q',
                    dequeue_options    => r_dequeue_options,
                    message_properties => r_message_properties,
                    payload            => o_payload,
                    msgid              => v_message_handle
              commit;
            END;Thanks in advance

    Presumably the message gets left on the Q with a state of PROCESSED? If so then that suggests you have aq_tm_processes explicitly set to 0 (zero) in your spfile/pfile - these background processes clear messages which have been PROCESSED.
    If this is not the case can you post the state of the messages and some more information like version and AQ related parameters?
    Thanks
    Paul

  • Command requires GPIB Controller to be Controller in Charge on dequeue element

    I have some funky stuff going on in the attached VI. What the VI does is simply to log data to a text file. It is built up as a state machine. This VI's Create state is called from a mainVI (with the help of named queues). I get more than one error and it seems completely random.The error usually occurs if I stop the mainVI, then starts it again. So the second (or following) times the DP VI is called, I get random errors such as the two below:
    Error 1 occurred at Dequeue Element in DP.vi->PSS.vi
    Possible reason(s):
    LabVIEW:  An input parameter is invalid.
    NI-488:  Command requires GPIB Controller to be Controller in Charge.
     Error 1 occurred at Close File in DP.vi->PSS.vi
    Possible reason(s):
    LabVIEW:  An input parameter is invalid.
    NI-488:  Command requires GPIB Controller to be Controller in Charge.
    Why is this? I don't even have a GPIB controller?
    Solved!
    Go to Solution.
    Attachments:
    DP.vi ‏61 KB

    Siniz wrote:
    blawson, I think you found the error!
    So shift registers only gets uninitialized again if I close the actual VI, and not when I start executing it again? So in reality, they actually behave like real shift registers? I found two solutions to this problem.
    1) To initialize the error shift register with an empty error constant.
    2) To remove the wire from the shift register to the Write to Text File. This works since I always call the Create state first.
    Which one would you recommend?
    Also, what is the reason to keep the typedef strict? I have seen non-strict in other code.
    Generally you should always explicitly initialize your shift registers unless you want to retain the values from one execution to the next. This is required for Action Engines but in most other cases you should use initialized shift registers to avoid side effects like you encountered in this application.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Maybe you are looking for

  • Repeating Group header on each page

    Hello Everybody, I have two groups in my report. For my first group value, i have given report - group expert - options and checked "Repeat group header on each page" assuming that my first group values will appear on each page. But it is not doing s

  • Calling a stored procedure with an XmlType parameter.

    I am attempting to execute a stored function via a named query. The stored procedure has a single parameter of Oracles 'xmltype', and also returns an xmltype. For example this dummy function function testXML(xml_in xmltype) return xmltype is begin re

  • Can PSD files saved back to Lightroom retain their layers?

    When a file is edited in Photoshop. you can choose a TIFF or PSD. It would seem the advantage to PSD would be the ability to retain layers when saved back to Lightroom especially in a file which remains a work in progress. I have not been able to ach

  • No setup cartridges in new printer purchase

    Hello, I was trying to setup the printer (HP OfficeJet Pro 8600, but could not find the setup cartridges needed for new printer.  I checked, there is retail sell of these cartridges.  What are my option? Thanks, Atik

  • Problems during application postcloning

    Hi all , I am trying to create a new clone instance on our test server which already has an instance that was created earler . The database post clone was fine . During the application postcloning i am doing the fllowing : cd /gltest/oraclegl/glappl1