ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Data mapping error on hierarchical query

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Data mapping error on hierarchical query

    Given the following SQL query:

    Code:
    select * from XDPGREFL1
    start with WHONAM = 'AN150'
    connect by prior WHONAM = WHRNAM
    And given that WHONAM and WHRNAM are both char(10), and given that there are no nullable fields in the table, can someone tell me what I'm doing wrong?
    All I get is a "Selection error involving field *N. " error.
    This is accompanied by
    Code:
    Select or omit error on field SelectRela_1cycleMarkFld_14) member XDPGREFL1.
    Cause . . . . . : A select or omit error occurred in record 0, record format
    *FIRST, member number 1 of file XDPGREFL1 in library AVRTXREF, because of
    condition 6 of the following conditions:
    6 - A data mapping error occurred on the field before the select or omit
    operation was attempted.

  • #2
    Could you check the joblog whether you get more information. Data maping errors could also occur if something else is wrong.
    Also do not use SELECT *, but explicitly select the columns you want to get returned.

    Birgitta

    Comment


    • #3
      Where is this SQL statement being run?
      Embedded in an RPGLE program? Interactively on green screen using STRSQL, RUNSQL, or RUNSQLSTM? Using iACS?

      I assume XDPGREFL1 is a DDS logical, given the L1 suffix?

      Comment


      • #4
        ACS Run SQL Scripts is much more helpful than STRSQL.
        Turns out it was a recursive self-reference.
        Adding NOCYCLE fixed it.

        Thanks!

        Comment

        Working...
        X