sqljsonoracle-databaseoracle12cjson-value

Oracle JSON Query with hyphen-key


I have an Oracle database in version 12.1.0.2.0 and JSON field that I want to query.

This query works:

select JSON_VALUE('{"-": "hello", "de":"hallo"}','$."de"') from DUAL

This query returns the error ORA-40442.

select JSON_VALUE('{"-": "hello", "de":"hallo"}','$."-"') from DUAL

Queries to the hyphen are no problem with MySQL and MSSQL.

I can't change the JSON-string.

How can I still query for the hyphen?


Solution

  • The solution is to use unicode representation:

    select JSON_VALUE('{"-": "hello", "de":"hallo"}','$."\u002d"') from DUAL