Go For Soda

Simple Oracle Document Access (SODA) comes to PL/SQL!

Being Canadian and being in a certain age group I have been patiently waiting for SODA in PLSQL. Two reasons:

  1. Its fun to learn new things
  2. I get to use the iconic Go For Soda song from Canadian musician Kim Mitchell in a post!

And a 1…and a 2…

DECLARE

  v_doc SODA_DOCUMENT_T;
  v_chorus VARCHAR2(1000);

BEGIN

  v_chorus :=
    '{"LINE1":"Might as well go for a soda",
      "LINE2":"Nobody hurts and nobody cries",
      "LINE3":"Might as well go for a soda",
      "LINE4":"Nobody drowns and nobody dies"}';

  v_doc := SODA_DOCUMENT_T(
       b_content => UTL_RAW.CAST_TO_RAW(v_chorus));

  DBMS_OUTPUT.PUT_LINE(
      UTL_RAW.CAST_TO_VARCHAR2(v_doc.get_blob));

END;

And here is the output…

{"LINE1":"Might as well go for a soda",
"LINE2":"Nobody hurts and nobody cries",
"LINE3":"Might as well go for a soda",
"LINE4":"Nobody drowns and nobody dies"}

I’m going to delve further into the SODA offerings in Oracle 18c in the next few posts.

Thanks for reading!