考虑三个表:汽车表,演员表和链接表,是这样的:的Oracle PL/SQL Denomalised结果
table_car
---------
int car_id
string make
string model
table_extras
------------
int extra_id
string extra
table_car_extras_link
---------------------
int car_id
int extra_id
我想编写一个PL/SQL存储过程返回数据用以下方式:
car_id, make, model, extra[]
例如
1, Ford, Fiesta, sunroof;electric windows
2, BMW, M3, sports pack;alarm;sat nav
3, subary, impreza, leather seats;ABS
对于数据库,我是一个非常新手,所以任何帮助表示赞赏。请注意,在我们的实际系统中,我们将返回“车”的1000与每节车厢具有多达约10“附加”
+1:漂亮的链接,总结了所有可用的技术。您可能想要添加WM_CONCAT不受支持,但未记录。在11gR2中,您将使用LISTAGG(此处记录:http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/functions087.htm#SQLRF30030) – 2009-11-10 11:44:12