0
votes

I am trying to create oracle table with virtual column as below in liquibase create table MY_TABLE ( entry_datetime DATE not null, entry_date DATE AS (TRUNC(entry_datetime)))

As per the documentation I tried to use ValueComputed attribute as below

<changeSet author="base_script" id="idx_31710" context="btr_rem" dbms = "oracle">
</changeSet>
<changeSet author="my_scripts" id="t11" dbms="oracle">
<createTable
          remarks= ""
          tableName= "my_table1">
<column name="entry_datetime" type="date" >
          <constraints nullable="false"/>
</column>
<column name="entry_date" type="DATE"  ValueComputed="TRUNC(entry_datetime)"></column>
</createTable>
</changeSet>

How ever when I am running it is giving error as below cvc-complex-type.3.2.2: Attribute 'ValueComputed' is not allowed to appear in element 'column'.

I tried using computed attribute as but its giving error cvc-complex-type.3.2.2: Attribute 'Computed' is not allowed to appear in element 'column'.

1

1 Answers

2
votes

You are creating a new table, not assigning the value to a column. This requires a defaultValueComputed attribute.

E.g.: <column name="entry_date" type="DATE" defaultValueComputed="TRUNC(entry_datetime)"></column>