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
198 views
in Technique[技术] by (71.8m points)

sql - delete from the request oracle all that is further words "info"

I have an oracle request.

    SELECT DISTINCT  
           to_char(to_date('1970/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss') + rep.value_number/86400000, 'yyyy.mm.dd hh24:mi:ss') ||' '|| nvl(trns.representation, '')  transaction_number 
    FROM IOT_STREAM_ANALYTICS_LOG_REPRESENTATION rep
        LEFT join txn 
       on rep.VALUE_NUMBER = txn.transaction_value_number
        
        LEFT  JOIN IOT_STREAM_ANALYTICS_EVENT_LOG evlog
           ON rep.parent = evlog.id
         LEFT JOIN IOT_DEVICE_EVENT ev
           ON evlog.device_event = ev.id
         LEFT JOIN IOT_STREAM_ANALYTICS_TRANSACTIONS trns
           ON rep.value_number = trns.name
    WHERE lower(rep.key) = 'transaction'
          AND rep.value_number <> 0
          AND rownum = 1 

This query is easy I am looking for a deadline with some information. This query works, but I want to remove something from the answer. The answer I have is one template:

2021.01.25 13:48:15 weight: 0 max weight: 35000 min weight: 1000 info: 37

I want to remove the word INFO from this answer and everything after that word. I will be grateful for your help!

question from:https://stackoverflow.com/questions/65888674/delete-from-the-request-oracle-all-that-is-further-words-info

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

1 Reply

0 votes
by (71.8m points)

You would use regexp_substr function like below

regexp_substr(your_answer_column, '(.*?)info.*?$', 1, 1, 'i', 1)


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

...