Solved

oracle 11g

Posted on 2015-02-02
2
145 Views
Last Modified: 2015-02-02
Hi,

I have a table as below

create table t_temp_tb(a number,b number);

and data  like  column a is sequence number and column b contains values for some  rows only like below.
1      400      
2            
3            
4      500      
5            
6            

Now I would like to update the table as below
ie after selecting from the table

(select a,b from t_temp_tb order by a;)

1      400      
2      400      
3      400      
4      500      
5      500      
6      500

We do not know how many records exists in the table in advance.
Can you please let me know how can I update?
Because this update needs to be run daily on a table automatically in a job.

thanks.
0
Comment
Question by:GouthamAnand
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 40583951
UPDATE t_temp_tb t1
   SET b =
           (SELECT b
              FROM (SELECT a, LAST_VALUE(b IGNORE NULLS) OVER (ORDER BY a) b FROM t_temp_tb) t2
             WHERE t1.a = t2.a);
0
 

Author Closing Comment

by:GouthamAnand
ID: 40584467
Thank you very much.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question