ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SQL0117 Error at Insert

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

  • SQL0117 Error at Insert

    Hello,

    Im getting SQL0117 when i insert two values from sql to my physical file. the pf has only 2 fields.

    Code:
     stm = 'insert into mylib/test +      
          ' (xx1,xx2)'             +      
          ' Values(''' + %TRIM(xx1) + '''' +
          '''' + %TRIM(xx2) + ''')'
    Problem solved. I had a Problem with my statement

  • #2
    Can you post the solution so others know what is wrong with the code you posted?

    I suspect it was a missing comma?

    Comment


    • JonBoy
      JonBoy commented
      Editing a comment
      A missing single quote or spurious + on the first row, same problem later. The OP is using a + for a continuation line but then also using an opening quote on the following line.

      It is much easier to get this stuff right if you use a constant for the quote character.

      An interesting example of how using a real editor (miWorkspace, RDi, or ILEditor for example) would have made it more obvious.

      I haven't checked if this results in valid SQL syntax but it is valid RPG <grin>

      Code:
      dcl-c quote '''';
      
      stm = 'insert into mylib/test '  +
              ' (xx1,xx2)'             +
              ' Values(' + quote + %TRIM(xx1) + quote + ',' +
              quote + %TRIM(xx2) + quote + ')';
      Last edited by JonBoy; July 10, 2020, 08:41 AM.
Working...
X