PL/SQL: How copy from several detail records into several fields in a single summary record?

From: John Haskins <76054.334_at_compuserve.com>
Date: Wed, 13 Jan 1999 21:55:52 -0800
Message-ID: <77k0ki$qp9$1_at_news-1.news.gte.net>



I want to write a PL/SQL script that takes records in this format (stripped to relevant columns):

   MASTER_TABLE
   id_column

   DETAIL_TABLE (up to 5 records possible per master record)    id_column
   sequence_number
   detail_value

...and produces a denormalized output table in this format:

   OUTPUT_TABLE
   id_column

   detail_value_1
   detail_value_2
   detail_value_3
   detail_value_4
   detail_value_5

I'm familiar with writing stored procedures with cursors to select data out of a table and insert it into another table. What I don't know how to do is populate a series of columns in a single row using one column in a set of source records. Can anyone point me in the right direction?

The environment is Oracle 7.2.2. The destination columns will represent 5 out of 120 columns in the output table.

Thanks very much. Received on Thu Jan 14 1999 - 06:55:52 CET

Original text of this message