How do you set a table temporary:
- You can set the property ‘temporary’ in the AOT to yes –> this table is always temporary
- You can declare a buffer of a table and call the method setTemp() or setTempData(), from that moment on the buffer contains temporary data.
CustTable custTable; ; custTable.setTmp(); if (custTable.isTmp()) { // Do something with your temporary table }
Things to know:
- When you declare a buffer of a record of temporary table type, the table does not contain any values.
- Memmory and filespace aren’t allocated for a temporary table till the first record is inserted. This means that you have to watch out for client/server problems.
When the first record is inserted in a buffer on the client tier, the memory is allocated there. All actions (insert / update / delete) to this buffer will run trough that tier, so try to reduce round-trips and improve your performance. - When you declare 2 different buffers of the same temporary table, they will both have a life of their own. To share the date between the tables use the setTmpData method.
for example: tmpCommonBuffer1.setTmpData(tmpCommonBuffer2); - You can’t (normally) set up logging on temporary tables.
- Use the method isTmp() to know if a record is temporary or not (true –> temporary, false –> phisical)
My opinion: Temporary tables are very useful and can help you to easily manipulate data you don’t need store permanently, but watch out where and how you use them.