Test case can be found at:
https://livesql.oracle.com/apex/livesql/s/lgh3hduetd3lqd74jvuolc78k Given:
Drop table t1;
Create table t1
(c1 Int Default 0 Not Null,
c2 Int Default 0 Not Null);
Is it then possible to:
Alter table t1
Modify c2 as (c1 + 1);
When I do I get the following result, so I am beginning to believe this cannot be done:
Table dropped
Table created
Alter table t1
Modify c2 as (c1 + 1)
ORA-54026: Real column cannot have an expression
Appreciate your help as I have not been able to find any documentation that would confirm this behaviour.
Thanks,
Aubrey
Yes, but in a couple of steps
SQL> Create table t1
2 (c1 Int Default 0 Not Null,
3 c2 Int Default 0 Not Null);
Table created.
SQL>
SQL> Alter table t1 set unused column c2;
Table altered.
SQL> alter table t1 add c2 int generated always as ( c1+1);
Table altered.
Here's a video about using set unused and not using drop column