ORA-01733:
VIRTUAL COLUMN NOT ALLOWED HERE
Introduction
- ORA-01733: virtual column not allowed here, this error appears when try to update the view using PL/SQL update statement.
Solution:
- Avoid this error, we should use instead of trigger.
Example:
View:
Create or replace
view customer_view as
select cust_id,cust_name,cust_city,Zip_code
from customer
order by cust_name;
Insert into customer_view values(1000,’tannie’,’us’,65001);
Insert into customer_view values(1001,’thara’,’us’,65001);
Select * from customer_view
CUST_ID
|
CUST_NAME
|
CUST_CITY
|
ZIP_CODE
|
1000
|
tannie
|
us
|
65001
|
1001
|
thara
|
us
|
65001
|
Trying to update,
Update customer_view set cust_name =’Lara’ where
cust_id =1000;
Here we had the error,
ORA-01733: VIRTUAL COLUMN NOT ALLOWED HERE
To overcome this error:
Use instead of trigger,
After the successful trigger creation run the update statement,
After the successful trigger creation run the update statement,
Update customer_view set cust_name =’Lara’ where cust_id =1000;
Select * from customer_view
CUST_ID
|
CUST_NAME
| CUST_CITY |
ZIP_CODE
|
1000
|
Lara
|
us
|
65001
|
1001
|
thara
|
us
|
65001
|
Note:
In what
kind of cases view cannot be update:
1.
When using
Distinct operator in the view
2.
When using any
kind of functions or order by clause
3.
Using a sub query
4.
Using join
condition
No comments:
Post a Comment