Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with CTE in pl-sql

NewLearnerMay 23 2014 — edited May 23 2014

Hi All,

I am facing a kind of weird problem when am migrating code from SQL server to PL-SQL.

This is the first time I am working on CTE.

My code prototype is as below

with ABC as

(  SELECT TBLNAME.COLUMN1 AS SOMENAME1,

                   TBLNAME.COLUMN2 AS SOMENAME2,

                    ...

                   FROM TABLES

                   -- HAVE JOINS ON TABLES TOO

)

SELECT * FROM           -------------> THIS LINE IS MY PROBLEMATIC CODE

(

  SELECT

            'RESULT_ROW' AS ROW_TYPE

            ROW_NUMBER() OVER ( ORDER BY COLUMNNAME) AS ROWNUM_,

            SOMENAME1,

            SOMENAME2,

            ...

FROM ABC

) TMP ORDER BY ROWNUM_

I AM GETTING A PROBLEM AT SELECT* ->  SAYING THAT MY COLUMN IS AMBIGUOUSLY DEFINED.

however all the columns in my code are preceded with the table name.

I donno whats wrong with my query.

Please help

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 20 2014
Added on May 23 2014
7 comments
3,948 views