skip to Main Content

Select JSON value from a CLOB field

The header_info field

{

"Message-ID":"<SJ0P105MB0345C789105MB0345.MAMP999.PROD.LOOKIT.COM>"

}

I tried

select JSON_VALUE(‘{header_info}’, ‘$.Message-ID’) from epres.mydata

I need to select the "Message-ID"
I get an error
ORA-40597: JSON path expression syntax error (‘$.Message-ID’)
JZN-00209: Unexpected characters after end of path
at position 10
40597. 00000 – "JSON path expression syntax error (‘%s’)%snat position %s"
*Cause: The specified JavaScript Object Notation (JSON) path expression
had invalid syntax and could not be parsed.
*Action: Specify JSON path expression with the correct syntax.

using Oracle Version 19.2.1.247

2

Answers


  1. Use:

    '$."Message-ID"'
    

    It does not like the embeded – , so you need to wrap it in double-quotes.

    Login or Signup to reply.
  2. If the json you have posted in this question is the same:

    enter image description here

    You got 2 random " there

    That is the first thing i checked. Not sure if it will fix your problem, but if the json in invalid.. that would result in other things to fail of cours.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search