ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Embedded SQL update table with generated identity column

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

  • Embedded SQL update table with generated identity column

    Hey everyone. 0-)

    I was trying to write the code below to update a table that has a generated identity column, but I have not been able to get this to compile without resorting to writing out all the columns.

    Code:
           dcl-ds LabelCategoryType            extname('SYLBLCAT') alias qualified
                                               template inz;
           end-ds;
    
           dcl-ds  LabelCategory    likeds(LabelCategoryType);
    
           exec sql
             update sy_label_category overridding system value
    
             set row = :LabelCategory
    
             where label_category_id = :LabelCategory.label_category_id
           ;
    label_category_id is the generated column.


    I've searched through the sql programming concepts book and various examples on the interwebs, and it looks like it may not be possible.

    But, I wanted to ask here to confirm that it's not possible or if I am just doing it wrong.

    We're on 7.3 with ptfs current as of beginning of year.

    Thanks in advance for any clues one way or another.

    Walt
    Last edited by wegrace; July 7, 2019, 08:24 AM.
Working...
X