|
|
| Author |
Message |
SSR Warnings : 1 New User
Joined: 26 Feb 2006 Posts: 38
|
|
|
|
Hi all,
I have two tables A & B and a view which is created based on A & B. Now am altering the table to add one column in Table A and other in Table B. Now how could i make my view to reflect this change (2 new columns) and how will the data get refreshed when we load the values for Tables A & B for those columns.
Regards
SSR |
|
| Back to top |
|
 |
References
|
Posted: Tue May 06, 2008 2:20 pm Post subject: Re: ALTER View after updating the table structure |
 |
|
|
 |
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 168 Location: Bangalore
|
|
|
|
| whats the problem in recreating the view? |
|
| Back to top |
|
 |
ashimer
Senior Member
Joined: 13 Feb 2004 Posts: 348 Location: Bangalore
|
|
|
|
Hi SSR,
Keep in mind that unlike a table data is populated in a view when you refer the view ..
here as gautam said drop the view and then recreate it adding the extra column ..it will work normally ...
thanks,
ashimer |
|
| Back to top |
|
 |
SSR Warnings : 1 New User
Joined: 26 Feb 2006 Posts: 38
|
|
|
|
hi,
| the_gautam wrote: |
| whats the problem in recreating the view? |
There are no issues in dropping and recreating, want to know similar to addition of columns to the table, is there any way by which we could alter the view to reflect the change in columns?
Regards
Sundar |
|
| Back to top |
|
 |
ashimer
Senior Member
Joined: 13 Feb 2004 Posts: 348 Location: Bangalore
|
|
|
|
Hi SSR,
you do not have an ALTER privilege on a view ... you need to drop and recreate the view .. |
|
| Back to top |
|
 |
nabarundas
New User
Joined: 21 Jun 2007 Posts: 19 Location: pune
|
|
|
|
SSR worte:
| Quote: |
| and how will the data get refreshed when we load the values for Tables A & B for those columns |
we do not have to bother about the refreshment of data in the view. It will do automatically. In layman terms a view is a mirror image of the actual table with the given constrains. So if we alter the actual table data the view will change accordingly. |
|
| Back to top |
|
 |
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 168 Location: Bangalore
|
|
|
|
Following are the RDBMS objects that can be modified using the ALTER command : TABLEINDEX, TABLE, TABLESPACE & STOGROUP.
So, you need to DROP and CREATE the VIEW according to your requirement. |
|
| Back to top |
|
 |
SSR Warnings : 1 New User
Joined: 26 Feb 2006 Posts: 38
|
|
|
|
Thank you all for your prompt replies.
Regards
Sundar |
|
| Back to top |
|
 |
|
|