In PL/SQL, how do you update a row based on the next row?
问题 I'm using Oracle PL/SQL. I have a timestamped table T, and I want to set a row's value for column A to be the same as that of the previous row, if they're sorted by columns B and Timestamp, provided that the timestamps are not different by more than 45 seconds. In pseudocode, it's something like: UPDATE T t_curr SET A = (SELECT A FROM T t_prev INNER JOIN t_curr ON (t_prev is the row right before t_curr, when you sort by B and Timestamp) AND t_curr.Timestamp - t_prev.Timestamp < 45 ) I tried