ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Problem with jSON_TABLE

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

  • Problem with jSON_TABLE

    Hi all
    in SQLRPLGE i run this select to parse Json string; in Json there is a value with apex ("don't"), and this seems create problem at SQL . How can avoid this problem


    SELECT err, err_code
    FROM JSON_TABLE ('{"err":"Internal Error don't call the number xxx "}' , 'lax $' Columns
    (err VARCHAR(120) PATH '$.err' default '' on empty,
    err_code int PATH '$.err_code' default 0 on empty )) as X;

    Thanks in advance
    Gio

  • #2
    If you have to include a single quote in a String on IBM i (SQL, CL, RPG ...) you always have to double it (2 independent single quotes - not a double quote) --> "Internal Error don''t call the number xxx "
    ... at least if you hardcode it, like in this case

    Comment

    Working...
    X