Solved

oracle 11g

Posted on 2015-02-02
2
143 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle DBLINKS From 11g to 8i 3 67
Import and exporting Oracle Data with encrypted columns 4 58
Oracle encryption 12 60
format dd/mm/yyyy parameter 16 48
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‚Ķ
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

733 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