Home > front end >  How to read a JSON with ORACLE
How to read a JSON with ORACLE

Time:08-27

How can I make a query or function that allows me to obtain the description when sending the language en_US or es_LA

Currently what I have in the OFFER_DESC field is the text indicated below

SELECT OFFER_DESC FROM TAB_DESCRIPTION
{"en_US":"English text example","es_LA":"Ejemplo de texto en español"}

How can I send the language en_US or es_LA and get the value English text example or Ejemplo de texto en español

CodePudding user response:

Maybe this?

    with TAB_DESCRIPTION as(
    SELECT '{"en_US":"English text example","es_LA":"Ejemplo de texto en español"}'  OFFER_DESC FROM dual )
    select json_value( offer_desc, '$.en_US'),json_value( offer_desc, '$.es_LA') 
from tab_description
  • Related