Code Assistant Displaying Invalid Results

CoffeeK1d

Member²
I found that the code assistant is not displaying results based on the current scope of the alias, but based on when the alias was first used.

In the sample code below X was assigned to DUAL in the CTE but is not being used. The same alias X is being used in the main query, pointing to a different table. The main query code assistant is displaying results for DUAL, which is out of scope.

SQL:
WITH temp1 AS
 (SELECT USER    AS db_user
        ,SYSDATE AS db_sysdate
    FROM dual x)
SELECT x.* FROM jgust.t_application x;

 
I didn't see the fix listed, but indeed, Code Assistant is now displaying the expected results after installing 16.0.6.2170.

 
This is indeed not yet fixed. When I test this the Code Assistant shows the x table of the main select when typing x. in the sub select.
 
It looks like different behavior from before, but I do see that CA does return results from inside the CTE not being used in a way not previously tested.

-- outside alias is y instead of reusing x. CA does provide listing from dual, but it shouldn't have access to that.

SQL:
WITH temp1 AS
(SELECT USER AS db_user
        ,SYSDATE AS db_sysdate
FROM dual x)
SELECT x. FROM t_application y;

-- outside alias is x, same as CTE. CA is now listing results for t_application, not dual for me. Previously, it was still displaying dual.

SQL:
WITH temp1 AS
(SELECT USER AS db_user
        ,SYSDATE AS db_sysdate
FROM dual x)
SELECT x. FROM t_application x;

-- outside alias is x, same as CTE. This time, I added a where clause in the CTE and used x. Now, in the outside query CA is returning the results from dual.

SQL:
WITH temp1 AS
 (SELECT USER    AS db_user
        ,SYSDATE AS db_sysdate
    FROM dual x
    WHERE X.DUMMY IS NOT NULL)
SELECT x.  FROM jgust.t_application x;
 
Last edited:
Back
Top