Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.5k views
in Technique[技术] by (71.8m points)

apache nifi - I'm trying send pl/sql command in to oracleAQ

I am trying send pl/sql command to oracle, but i have no idea how I can do that. There is no select or insert only work with oracle AQ. So, Maybe someone have experience with that situation? Any idea's. I put script bellow.(But instead "SOME TEXT FROM FLOW FILE" I must put information from flowfile)

    /* Enqueue to msg_queue: */
    DECLARE
       enqueue_options     dbms_aq.enqueue_options_t;
       message_properties  dbms_aq.message_properties_t;
       message_handle      RAW(16);
       message             aq.message_typ;
    
    BEGIN
       message := message_typ('NORMAL MESSAGE',
       'SOME TEXT FROM FLOW FILE');
    
       dbms_aq.enqueue(queue_name => 'msg_queue',           
             enqueue_options      => enqueue_options,       
             message_properties   => message_properties,     
             payload              => message,               
             msgid                => message_handle);
    
       COMMIT;
END;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

So I find solution. So, firs I extract xml file for pl/sql query. Then I add 2 processors(ReplaceText) and add part of query in start and end of the query. In example: I extract xml in avro format:

[ {
 "atribute" : "xml:
} ]

Next thing i come to the view of flow file and on original format. So it was look like: [enter image description here][1]

Then I make regular expression for changing original formated flowfile(it is important) so it look like:

^Obj([sS]+?)<?xmlsversion="1.0"sencoding="UTF-16"?>

So it is add all standart information in avro format. Then i replace this information on part of my pl/sql query and did it once with end of file. So in output of last replace text I had pl/sql. [enter image description here][2]

And this pl/sql I input in oracleAQ. [1]: https://i.stack.imgur.com/haz6W.png [2]: https://i.stack.imgur.com/WutqR.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...