Virtual tables can be considered a collection of a complex type or, more precisely, as a reflection of an SQL table in memory.
1 Declaration of a Virtual Table
Copy
<xsql-script> <body> <vtable name='v_update1'> <column name='delega' type='string' size='10' unique='true' /> <column name='depart' type='string' unique='true' /> <column name='numope' type='smallint' /> <column name='import' type='decimal' size='12' scale='3' /> </vtable> <set name='v_update2'> <vtable.clone name='v_update1' /> </set> <vtable.insert name='v_update1'> <matrix> { 'D01', 'COM', '1', '1000.25' }, { 'D02', 'COM', '2', '400' }, { 'D03', 'VEN', '3', '700.75' }, { 'D04', 'ABC', '4', '200.0' } </matrix> </vtable.insert> <vtable.insert name='v_update2'> <matrix> { 'D01', 'COM', '1', '1000.25' }, { 'D02', 'COM', '2', '400' }, { 'D03', 'VEN', '3', '700.75' }, { 'D04', 'ABC', '4', '1000.0' } </matrix> </vtable.insert> <println>table 1:<v_update1 /></println> <println>table 2:<v_update2 /></println> <vtable.update name='v_update1' where='delega="D04"'> <column name='import'><number>1000</number></column> </vtable.update> <println>Updated table 1:<v_update1 /></println> <assert> <expr><vtable.equals><v_update1 /><v_update2 /></vtable.equals></expr> </assert> </body> </xsql-script>