Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...