Outer reference in SELECT clause of subquery

From: Roger MacNicol <roger_at_uvmark.uucp>
Date: Tue, 27 Oct 92 19:56:35 GMT
Message-ID: <1992Oct27.195635.21752_at_uvmark.uucp>


Oracle permits the SELECT clause of a subquery to reference a column which is an outer reference (ie correlated). This is illegal according to the 1989 SQL standard 5.24: Let R denote the result of the <table expression>. Each <column specification> in the <value expression> shall unambiguously reference a column of R).

For (a stupid) example:

        SELECT * FROM EMPS T WHERE AGE IN (SELECT T.AGE FROM EMPS); Has anyone used this non-standard feature in real life?

More to the point, why did the standard want to ban it? It is stupid to select an outer reference on its own because it is a constant during the evaluation of the subquery, but it is conceivably useful in a value expression.

  • Roger
-- 
******************************************************************

* Roger MacNicol, Snr. Software Engineer
* VMark Software, Inc., 30 Speen Street, Framingham, MA 01701-1800
* email: uvmark%roger_at_merk.com
Received on Tue Oct 27 1992 - 20:56:35 CET

Original text of this message