The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Saturday 3 August 2013

Overriding Temporary Table Instance


The temporary table instance in an application engine program is controlled by the PeopleSoft processor and it is assigned whenever you start an application engine program. Recently I have seen some threads in online forums asking whether we can set the temporary table instance while running an application engine program. Well, the answer is both Yes and No.

The default instance of a temporary table is decided by the PeopleSoft processor and it is done when you initiate an application engine program. But PeopleSoft has provided some options to override this instance number via PeopleCode. You have a delivered built in function SetTempTableInstance which overrides the existing temporary table instance. The function will return the previous instance number. Once this function is called the entire % Table construct thereafter will then start using the new instance.

/* Change the temporary table instance to 3 */
&nPriorInstance = SetTempTableInstance(3);

/* Change the instance back once you are done. */
SetTempTableInstance(&nPriorInstance);

You should be very careful while using this function. This function is not provided to entirely override the default instance that was created. If you have a scenario where you want to process same set of data temporarily without affecting the already selected data in the default processing, then you can consider using it. Whenever you use this function, try to revert the changes at the end by using the same function so that your default processing is not affected.


Whatever way you are using this function to override the temporary table instance, the key thing to keep in your mind is that you should have a complete control over the data that is handled in the tables. Otherwise you may see varied behaviors in your output.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Followers