SHARED dynamic temp table?

chadj

New Member
Static temp tables can be declared to be SHARED with

Code:
DEFINE NEW SHARED TEMP-TABLE temp-table-name

Is there anyway to create a dynamic temp table (i.e. CREATE TEMP-TABLE handle) that is SHARED?

-Chad Johnson
 
Can't you just make the handle variable that references the temp-table shared? Something like 'DEF NEW SHARED VARIABLE tmp_table AS HANDLE NO-UNDO'.

I have never actually tried this because, IMO, shared variables should almost never be used. But that is a whole separate discussion.
 
The nice thing about dynamic objects is, that you just need the handle to that object and you have everything you need to access it's attributes and methods. Therefore if you want to share something, you don't share the object, instead you share the access to it. But, using shared things is not best practice. You rather should pass the handle to the dynamic objects or have a function or internal procedure in the procedure in which the dynamic object lives that will pass out the handle to it.

Regards, RealHeavyDude.
 
You have been told how to do what you want ... but the better answer is don't do that, static or dynamic. If you have to communicate something between two pieces of code, either pass it as a parameter or put it in a common place where it can be accessed. With something as complex as a temp-table, best is to encapsulate the TT in one place and provide methods or IPs so that other code can use it.
 
My apologies for not being more specific. I was looking for a mechanism to create a dynamic TEMP-TABLE that satisfies a subsequent DEFINE SHARED TEMP-TABLE declaration in a separate procedure. From what I gather that cannot be done.

This, unfortunately, is not a design choice of my own. I'm trying to inter-operate with a 3rd party ERP system system that is dictating this choice.

-Chad Johnson
 
Yeah, I think you are SOL on that one. Progress is pretty awesome, IMO, in terms of the way you can mix and match shared and dynamic TT's. But in your case, I don't think there is any getting around the need to have a static DEF NEW SHARED TEMP-TABLE somewhere in your code.
 
Back
Top