HL7 EQQ_Q04 Embedded Query Language Query
EQQ_Q04 carries an embedded query language statement in an EQL segment. Older descriptions often use SQL as the example, but the real contract is whatever the receiver agreed to support.
Use this pattern carefully. It is flexible, but flexibility is exactly why many modern interfaces prefer named query definitions with explicit parameters.
A small EQQ Q04 example
What systems do with it
The requester sends a query tag, expected response format, query name, and query statement. The responder evaluates the query according to its local rules and returns an appropriate response, often display or tabular data.
In real interfaces, EQQ_Q04 is usually found in old query brokers, departmental systems, or compatibility layers that predate more constrained QBP/RSP designs.
How to read the structure
MSH identifies EQQ^Q04^EQQ_Q04. Optional SFT can identify software. EQL carries the query tag, response format, query name, and query statement. Optional DSC handles continuation when the query itself is being continued.
The query tag is important. It is how the response and continuation behavior are tied back to this request.
Implementation traps
Never execute a received query string as raw database SQL unless a tightly controlled private contract makes that safe. Treat the query text as untrusted input, even when the sender is another internal system.
Also avoid depending on this for new cross-organization interfaces. Named, parameterized query profiles are much easier to secure, audit, test, and monitor.
Reference notes
HL7 v2.3.1 describes EQQ as an embedded query language query used with related display and tabular query responses. See the HL7 v2.3.1 control/query chapter.