Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating A View

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am encountering difficulties when I try to update my view
I define it as follows :-

isql -Usa -Ppassword -S$AR_ENV_SYB_SERV_NAME << !
go

drop view v_account_data
go

create view v_account_data
as
select t_account.accnt accnt,
(select t_account.curr) curr,
(select t_account.stat) stat from t_account
group by t_account.accnt
go

grant select on v_account_data to PUBLIC
go


update v_account_data
set stat = &quot;N&quot;
go
!

But when I run it : -

sh view_accts
View 'v_account_data' is not updatable because a field of the view is derived or constant.

I am using SYBASE.

Can anyone tell me what I am doing wrong ?
 
From the Sybase manual ...

update, insert, or delete operations that refer to a view that includes aggregates or row aggregates, that is, built-in functions and a group by clause or a compute clause, are not allowed.

It appears that the group by is causing your problem, which is sensible enough when you think about it.

Can't offer a way around this at the moment though :-(

Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top