我有两张桌子。
派对名单
create table partyList
(
sno serial NOT NULL,
Party_title text,
Party_venue text,
Party_date date,
Party_list character varying,
Amount_list text
);
列表
create table list(
sno integer,
participant_name text,
amount_paid integer
);
这是完整的SQL FIDDLE。
我想调用一个可以将值插入两个表的函数。我的输出应该是这样的。 派对列表表
| SNO | PARTY_TITLE | PARTY_VENUE | PARTY_DATE | PARTY_LIST | |AMOUNT_LIST
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 1 | games | indoor stadium | August, 10 2013 00:00:00+0000 | ronald;sania;sachin;pointing;samueal;gibbs;gayle;smith; | 100;200;100;100;200;100;100;100; |
| 2 | dance | stage | August, 15 2013 00:00:00+0000 | micheal jakson; britney ; daddy yankee; ar rehaman; jestin bebber; |200;100;100;200;100; |
列表表
| SNO | PARTICIPANT_NAME | AMOUNT_lIST
---------------------------------------
| 1 | ronald | 100
| 1 | sania | 200
| 1 | sachin | 100
| 1 | pointing | 100
| 1 | samueal | 200
| 1 | gibbs | 100
| 1 | gayle | 100
| 1 | smith | 100
| 2 | micheal jakson | 200
| 2 | britney | 100
| 2 | daddy yankee | 100
| 2 | ar rehaman | 200
| 2 | jestin bebber | 100
当我通过这些值调用我的函数时,如下例所示。
insert_function('games','indoor stadium','08-10-2013','ronald;sania;sachin;pointing;samueal;gibbs;gayle;smith;','100;200;100;100;200;100;100;100;'),
('dance','stage','08-15-2013','micheal jakson; britney ; daddy yankee; ar rehaman; jestin bebber;','200;100;100;200;100;');
是否有way to split
列表项(整数)list table
并在循环中调用插入查询?