?
Solved

oracle 11g

Posted on 2015-02-02
2
Medium Priority
?
146 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 2000 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

752 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