Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2014
    Posts
    294

    Answered: column names are required for the recursive common table expression

    Hi,

    I am trying to create a view on a table .

    CREATE OR REPLACE VIEW SR5683D.APPLE AS SELECT EMPNO,FIRSTNME,MIDINIT,
    reg_514187(LASTNAME) LASTNAME,WORKDEPT,PHONENO,HIREDATE,
    JOB,EDLEVEL,SEX,reg_52571(BIRTHDATE)
    BIRTHDATE,SALARY,BONUS,COMM FROM SAMPLE.SR5683D.APPLE;

    For this I am getting the below error:
    The column names are required for the recursive common table expression "SR5683D.APPLE".. SQLCODE=-343, SQLSTATE=42908

    can some explain me what is this error?

    I tried to read from the docs but not able to understand the error.

  2. Best Answer
    Posted by Pat Phelan

    "You accidentally referred to the VIEW itself in the FROM clause of the SELECT statement that defines the view. DB2 tends to interpret that syntax as a recursive CTE even though there isn't any WITH clause.

    You probably meant to refer to a base table in the FROM clause instead of the VIEW.

    -PatP"


  3. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You accidentally referred to the VIEW itself in the FROM clause of the SELECT statement that defines the view. DB2 tends to interpret that syntax as a recursive CTE even though there isn't any WITH clause.

    You probably meant to refer to a base table in the FROM clause instead of the VIEW.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •