In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Oracle_SQL partial _ time conversion (case 1)
Question:
Colleagues feedback that the time-consuming recorded in the XXX system is a character type. It is not convenient to calculate the time-consuming statistics through execl. Ask me if I have a good method.
Train of thought:
The data contains days, hours and minutes, and the character type cannot be calculated directly. The data of days, hours and minutes can be separated separately through the oracle database, that is, days and hours are converted into minutes. In the end, the time-consuming field is only minutes, which is convenient for later calculation.
The steps are as follows:
1 Import exec data into Oracle database
2 query data
(3) the days, hours and hours can be separated by intercepting the string through substr and obtaining the position by instr.
The longest time-consuming select process, nvl (substr (longest process time, 1, instr (longest process time, 'days',-1)-1), 0) day from process monitoring
-hours
Select
The longest time-consuming process
Substr (longest process time, instr (longest process time, 'days') + 1, instr (longest process time, 'hours')-instr (longest process time, 'days')-1 hour
From
Process monitoring
Select
The longest time-consuming process
Substr (longest process time, instr (longest process time, 'hours') + 2, instr (longest process time, 'minutes')-instr (longest process time, 'hours)-2 minutes
From
Process monitoring
4 convert days and hours into minutes, and calculate the total number of minutes
Select
The longest time-consuming process
(days)-1) * 60 + substr (longest process time, instr (longest process time, 'hours') + 2, instr (longest process time, 'minutes')-instr (longest process time, 'hours)-2)
From
Process monitoring
Welcome to follow my Wechat official account "IT Little Chen" and learn and grow together!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.