1

I am using Oracle database ver 12.1.0.2. I need to create JSON string using standard PL/SQL functions. Without using 3rd party libraries. For an example,

declare
   json_text varchar2(20);
begin
   json_text.add_as_json("key","value");
end;

Thank you!

0

1 Answer 1

3

You could do it like that:

declare
   json_text varchar2(20);
begin
   json_text := '{"key":"value"}';
end;

but that obviously gets tedious in real-world cases. Better use a lib for that, for example this one: http://sourceforge.net/projects/pljson/

Sign up to request clarification or add additional context in comments.

1 Comment

Surprisingly this seems to be as good as it gets. There are several Oracle methods for reading JSON but there doesn't appear to be anything for writing JSON.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.