描述:
为内表的键建立索引表
语法:
T.index(n)
备注:
为内表T的键创建索引长度为n的索引表,排号键时省略n,如果需要多次根据键来查找数据,在建立了索引表之后可以提高效率。建立索引时假定记录的主键唯一。
参数:
T |
主键唯一的内表 |
n |
索引长度。 |
返回值:
内表
示例:
|
A |
|
1 |
=file("D:\\emp3.ctx") |
|
2 |
=A1.create(#EID,NAME;EID) |
创建组表基表 |
3 |
=demo.cursor("select EID,NAME from employee where EID< 10") |
|
4 |
=A2.append(A3) |
|
5 |
=A2.attach(table3,#GENDER) |
在基表上添加附表 |
6 |
=demo.cursor("select EID,GENDER from employee where EID< 10") |
返回游标 |
7 |
=A5.append(A6) |
在附表中追加游标记录 |
8 |
=A5.memory() |
用附表生成内表 |
9 |
=A8.keys(EID) |
设置内表的键为EID |
10 |
=A8.index(10) |
建立长度为10的索引表 |