Domanda

I am inserting the array of elements {idno,age,salary} as {1,10000,30} in PostgreSQL database and I need to split and store into the respected columns of the table.

How to store the split array elements in respect columns of table?

First is this possible , if possible can some one explain me ,how can we do it?

È stato utile?

Soluzione

Like this?

insert into test(idno, age, salary)
select D[1], D[2], D[3]
from (select '{1,10000,30}'::int[]) as A(D);

sql fiddle demo

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top