The present invention comprises a Dynamic Query Interface (DQI). The DQI
provides an apparatus and method for dynamically discovering the shape of
data returned by a DBMS in response to a query statement. The DQI
comprises a Query Schema, a Select Macro, and a Macro Expansion Module
(MEM). Unlike conventional query statements, a Select Macro only requires
a select-clause. The MEM builds a conventional query statement from a
Select Macro using information contained in the Query Schema. The Macro
Token expansion approach implemented in the MEM obviates the need for
full language parsing and is thus much more suited to runtime execution
than prior art solutions. Furthermore, because the MEM examines a Select
Macro at runtime, the MEM has the added advantage over prior art
solutions of being able to discover dynamically the shape of the
requested data at runtime.