RE: How to use Array in Array of Json

<[email protected]> Mon, 25 Nov 2019 08:14:18 -0800
Newsgroups gmane.comp.db.postgresql.sql
Message-ID <[email protected]>
This is a multipart message in MIME format.

------=_NextPart_000_044F_01D5A368.560B6010
Content-Type: text/plain;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hi Monalee,

=20

You can just use a json/jsonb variable. Content should be looking like =
this:

=20

[

{=E2=80=9Cvin_comp_cd=E2=80=9D: 1, =E2=80=9Cvin_div_cd=E2=80=9D:11, =
=E2=80=9Cvin_array=E2=80=9D: [{=E2=80=9Cvin_loc_cd=E2=80=9D: 33, =
=E2=80=9Cvin_bt_cd=E2=80=9D: 44}] },

=E2=80=A6

{=E2=80=9Cvin_comp_cd=E2=80=9D: N, =E2=80=9Cvin_div_cd=E2=80=9D:NN, =
=E2=80=9Cvin_array=E2=80=9D: [{=E2=80=9Cvin_loc_cd=E2=80=9D: AA, =
=E2=80=9Cvin_bt_cd=E2=80=9D: BB}] }

=20

]

=20

Or if =E2=80=9Cvin_loc_cd=E2=80=9D and =E2=80=9Cvin_bt_cd=E2=80=9D can =
be independent arrays if they are independent.

=20

Best,

Igor

=20

From: Monalee Bhandge <[email protected]>=20
Sent: Monday, November 25, 2019 4:02 AM
To: [email protected]
Subject: How to use Array in Array of Json

=20

Dear Friends,

My function definition is as:

=20

CREATE OR REPLACE FUNCTION schema1.samplefun1(

    vin_comp_cd smallint,

    vin_div_cd smallint,

    vin_loc_cd smallint[],

    vin_bt_cd integer[],

  )

=20

Here instead of passing parameter I want to just send a single i/p in =
Json[].

=20

My problem is how to pass array in Json[] variable. And how to use in =
code.

=20

=20

Thanking You!

Monalee

Database Lead Engineer.


------=_NextPart_000_044F_01D5A368.560B6010
Content-Type: text/html;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8"><meta =
name=3DGenerator content=3D"Microsoft Word 15 (filtered =
medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
	{mso-style-name:msonormal;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
span.EmailStyle18
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US =
link=3D"#0563C1" vlink=3D"#954F72"><div class=3DWordSection1><p =
class=3DMsoNormal>Hi Monalee,<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>You can just =
use a json/jsonb variable. Content should be looking like =
this:<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>[<o:p></o:p></p><p class=3DMsoNormal =
style=3D'text-indent:.5in'>{=E2=80=9Cvin_comp_cd=E2=80=9D: 1, =
=E2=80=9Cvin_div_cd=E2=80=9D:11, =E2=80=9Cvin_array=E2=80=9D: =
[{=E2=80=9Cvin_loc_cd=E2=80=9D: 33, =E2=80=9Cvin_bt_cd=E2=80=9D: 44}] =
},<o:p></o:p></p><p class=3DMsoNormal =
style=3D'text-indent:.5in'>=E2=80=A6<o:p></o:p></p><p class=3DMsoNormal =
style=3D'text-indent:.5in'>{=E2=80=9Cvin_comp_cd=E2=80=9D: N, =
=E2=80=9Cvin_div_cd=E2=80=9D:NN, =E2=80=9Cvin_array=E2=80=9D: =
[{=E2=80=9Cvin_loc_cd=E2=80=9D: AA, =E2=80=9Cvin_bt_cd=E2=80=9D: BB}] =
}<o:p></o:p></p><p class=3DMsoNormal =
style=3D'text-indent:.5in'><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>]<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>Or if =
=E2=80=9Cvin_loc_cd=E2=80=9D and =E2=80=9Cvin_bt_cd=E2=80=9D can be =
independent arrays if they are independent.<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>Best,<o:p></o:p></p><p =
class=3DMsoNormal>Igor<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal><b>From:</b> =
Monalee Bhandge &lt;[email protected]&gt; <br><b>Sent:</b> =
Monday, November 25, 2019 4:02 AM<br><b>To:</b> =
[email protected]<br><b>Subject:</b> How to use Array in =
Array of Json<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><div><div><p =
class=3DMsoNormal>Dear Friends,<o:p></o:p></p><div><p =
class=3DMsoNormal>My function definition&nbsp;is =
as:<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><div><p =
class=3DMsoNormal>CREATE OR REPLACE FUNCTION =
schema1.samplefun1(<o:p></o:p></p></div><div><p class=3DMsoNormal>&nbsp; =
&nbsp; vin_comp_cd smallint,<o:p></o:p></p></div><div><p =
class=3DMsoNormal>&nbsp; &nbsp; vin_div_cd =
smallint,<o:p></o:p></p></div><div><p class=3DMsoNormal>&nbsp; &nbsp; =
vin_loc_cd smallint[],<o:p></o:p></p></div><div><p =
class=3DMsoNormal>&nbsp; &nbsp; vin_bt_cd =
integer[],<o:p></o:p></p></div><div><p class=3DMsoNormal>&nbsp; =
)<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>Here instead of passing parameter&nbsp;I want to just =
send a single i/p in Json[].<o:p></o:p></p></div></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>My problem is how to pass array in Json[] variable. =
And how to use in code.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>Thanking You!<o:p></o:p></p></div><div><p =
class=3DMsoNormal>Monalee<o:p></o:p></p></div><div><p =
class=3DMsoNormal>Database Lead =
Engineer.<o:p></o:p></p></div></div></div></div></body></html>
------=_NextPart_000_044F_01D5A368.560B6010--