1

I am trying to achieve the '' in varchar field instead of NULL if value is not present in the column.

SELECT JSON_OBJECT('name' VALUE 'nikhil') FROM DUAL

{'name' : 'nikhil'}

SELECT JSON_OBJECT('name' VALUE null) FROM DUAL
{'name': ''}
  • can you show what exactly do you expect as output ? – Roberto Hernandez Jul 06 '20 at 11:33
  • SELECT JSON_OBJECT('name' VALUE (SELECT COL1 FROM TEMP1)) FROM DUAL so in this query if i col1 has value then i got the value if data is not present then i got null but i got '' for name key. – NIKHIL KULSHRESTHA Jul 07 '20 at 04:15
  • check here: https://stackoverflow.com/questions/21120999/representing-null-in-json. Oracle gives you the option to return the value null or to not show the element (JSON_on_null_clause in the docs). – Koen Lostrie Jul 07 '20 at 08:15

0 Answers0