T.alter(F:x,…;F’,…)

Read(489) Label: entity table, alter, field,

Description:

Alter one or more fields in an entity table.

Syntax:

T.alter(F:x,…;F’,…)

Note:

The function, supported only when a table is of columnar storage, adds a field F to entity table/multizone entity table T and deletes an old field F’. Values of the new field are obtained by calculating expression x and populated to the table. The dimension and sorting field before it must not be modified.

Parameter:

T

An entity table/multizone entity table

F

Name of the to-be-added field

x

An expression

F’

An existing field

Return value:

An entity table/multizone entity table

Example:

 

A

 

1

=file("emp.ctx")

An existing composite table file.

2

=A1.open()

Open the composite table’s base table.

3

=A2.cursor().fetch()

Query data in the base table.

4

=A2.alter(NEW_Salary:SALARY+1000;GENDER)

Add NEW_Salary field to the base table through calculating expression SALARY+1000, and delete existing field GENDER.

5

=A2.cursor().fetch()

Check the base table and we can see that the new field is added and GENDER field is deleted.