%SelectDummyTable meta-SQL element

Description

Use the %SelectDummyTable variable to perform a SELECT without specifying a specific table. The database platform-specific “dummy table” is substituted in the SELECT.

Example

Before: In the following example, the SELECT was performed on the one-row PeopleTools installation table.

SELECT 'x' 
  FROM PS_INSTALLATION WHERE ...

After: Using the %SelectNoTable variable ensures that the SQL will not fail if the table does not exist or if the table contains more than one row.

SELECT 'x' 
  FROM %SelectDummyTable WHERE ...

Before: In the following example, %SelectInit is used to initialize files in an Application Engine state record.

%SelectInit(GL_JP_AET.PROCESS_STATUS, GL_JP_AET.PROCESS_ORIG, GL_LOG_MSG_AET.MESSAGE_SET_NBR, GL_LOG_MSG_AET.MESSAGE_NBR, GL_LOG_MSG_AET.MESSAGE_PARM1, GL_LOG_MSG_AET.MESSAGE_PARM2, GL_LOG_MSG_AET.MESSAGE_PARM3) 
 SELECT 'P' 
 , 'P' 
 , 5830 
 , 4 
 , TO_CHAR(1) 
 , 'DVP1' 
 , 'EK' 
  FROM PS_INSTALLATION

After: Using the %SelectNoTable variable ensures that the SQL will not fail if the table does not exist or if the table contains more than one row.

%SelectInit(GL_JP_AET.PROCESS_STATUS, GL_JP_AET.PROCESS_ORIG, GL_LOG_MSG_AET.MESSAGE_SET_NBR, GL_LOG_MSG_AET.MESSAGE_NBR, GL_LOG_MSG_AET.MESSAGE_PARM1, GL_LOG_MSG_AET.MESSAGE_PARM2, GL_LOG_MSG_AET.MESSAGE_PARM3) 
 SELECT 'P' 
 , 'P' 
 , 5830 
 , 4 
 , TO_CHAR(1) 
 , 'DVP1' 
 , 'EK' 
  FROM %SelectDummyTable