(and BTW: beware, this "averaging understood as taking the middle point" is not something that you can generalize to more dates by doing for example "averaging( d1, d2, d3 ) = middle_point( middle_point( d1, d2 ), d3 )", except if you accept the consequences (avg( d1, d2, d3 ) is not the same as avg( d1, d3, d2 ). (decide and write your rules accordingly) OK for you? Maybe you will disagree if > the interval was in fact (thinking at a date as "the whole day"), then the middle is rather 1 00:00:00. format parameter is omitted, the TRUNC function will truncate the date to the day value, so that any hours, minutes, or seconds will be truncated off. What is the middle time between 1 and 1? Answer: 1 12:00:00, but if you don't look at hour:min:sec, this is seen as 1. If we store thoise dates with 00:00:00, the computation for "middle day" might be the cause of dispute -) In some cases we store dates for which we don't want "hour:min:sec", like for example "hire_date", "birth_date", "date_of_promotion". No problem, but middle_date will be computed "exactly" (well, max 0.5 second of mistake) with this in mind, and maybe you don't have this in mind. Indeed: dateA and dateB are Oracle dates, this means that they can have something else then 00:00:00 for their hour=min:sec component. If we want more than "first sight" we have to decide a few things. Middle_date := datea + ( dateb - datea ) / 2: We add this to first date (or we subtract it from second date) and we have the middle point: Then at first sight this is very easy, as we know that we can do things like "dateb - datea gives nb of days" and things like "datea + nb_days gives another date": if you want the middle point between dateA and dateB: (dateB - dateA) is the time between the 2 dates we divide it by two and we have "half the interval". Replying seriously to your question about " averaging 2 dates": maybe you mean "take the middle point between the 2 dates". You can get the average of DATEs if you can convert them to NUMBERs (e.g., the number of days after some reference date), compute the average of those numbers, then add that number back to the reference date.įor example, if d1 and d2 are both DATEs, then the average of those 2 DATEs (that is, the DATE that is between them, equally distant from each) is d1 + ((d2 - d1) / 2) Oracle only computes averages for NUMBERs. Whenever you have a question, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the exact results you want from that data, so that the people who want to help you can re-create the problem and test their ideas.Įxplain, using specific examples, how you get those results from that data.Īlways say what version of Oracle you're using (e.g. Hi, 3240146 wrote:Hi, One more concern, can we get avg date from these two columns, because if i am running a query with id column using these two dates(sysdate-begin_date) getting few records. 1.7K Training / Learning / Certification.165.3K Java EE (Java Enterprise Edition).7.9K Oracle Database Express Edition (XE). 3.8K Java and JavaScript in the Database.Thank you for being an awesome reader! Subscribe to this blog if you don’t want to miss the latest updates and posts. Hope you found this one useful! Catch you in the next one! ✌ That brings us to end the of this article. NOTE: The flow may not resume strictly after ‘X’ minutes because it just gets queued up after ‘X’ minutes and then executes depending on the queue size, so there might be a slight difference between the timings. Step 2: Set up your Pause element as follows.Īnd voila! Your flow is now set to resume after ‘X’ minutes. Replace ‘’ with the number of minutes you’d like to have the flow resume. Step 1: Create a formula variable of datetime type,(Time) with the following formula. The base time in the formula can be current datetime or any record’s field value or something else depending upon the use case. The idea is to create a formula variable of datetime type (say, dateTimeAfterXMinutes) where we add X minutes to any base time and use that variable as base time in Resume configuration and set the Offset Unit to 0. This article is about making a flow resume after X minutes. If you’ve ever found yourself working with Pause element in flows, you might’ve noticed that the “Offset Unit” only supports hours or days and doesn’t support minutes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |