ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

RUNSQL in CL

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

  • RUNSQL in CL

    Getting back in the saddle with embedded SQL in CL. Based on all readings this stmt in the CL should be executable, yet the statement errors with a SQL9010.

    RUNSQL SQL('INSERT INTO LDNAFLDS +
    VALUES(&HRDCDE)') COMMIT(*NONE) RUNSQL SQL('INSERT INTO LDNAFLDS +
    VALUES(&HRDCDE)') COMMIT(*NONE)


    Any assistants would be grateful.

  • #2
    The problem is probably that your CL variable name is embedded in a character string. You need to replace it with the value of the variable. Something like this:

    Code:
    dcl  &HrdCde   *char    1    value('X')
    
    RUNSQL SQL('INSERT INTO LDNAFLDS VALUES(''' *CAT +
    &HRDCDE *CAT ''')') COMMIT(*NONE)

    Comment

    Working...
    X