• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Temp-table Scope Clarification

Hi Everyone,

Openedge 11.6
Windows 10

I have defined a TEMP-TABLE in a procedure which I am populating with some data then passing as an INPUT parameter to and external procedure (.p).

My questions is, if I empty the TEMP-TABLE in the second procedure will this have any effect on the content of the TEMP-TABLE in the calling procedure?

Thanks in advance,

By default temp-tables are passed by-value, which means that the external procedure receives a copy of the temp-table.
Emptying the copy does not impact the original.
You can change this by adding 'by-reference' in the run statement.
This will make the external procedure use the original temp-table.


ProgressTalk.com Sponsor
You need to look carefully at the various ways of passing temp-tables. Passing as a copy means clean separation, but it also means the overhead of making a copy. Passing by reference just passes a handle and so is much more performant, but means you do not have the separation. Whether or not you should have separation should be well defined by the nature of the procedures involved.

Note that the best answer is not to pass it at all. Put it in a class and provide methods for populating it, manipulating it, and reading it. This kind of isolation is one of the things OO is good at!