Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

oracle 11g

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

Technology Partners: 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

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…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

609 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