I am trying to select multiples detail rows into one header row for a group of records I selected in a cursor. Specifically, I have a gift that is split between 1 or many accounts. I want to display two of these accounts in one record for each record brought back in the cursor. And, I want to set a variable if there are more than two. Any ideas???
We need more detail about what your table structures are, what your PK on each table is, and some sample data.
I have created a temporary table to store multiple selects in while executing a package. I do not have any PKs on this temp table. I am selecting data from primary_pledge, pledge, allocation, entity, and address tables.
Let me give an example, I have a primary_pledge(gift) that is split into multiple pledges(gifts). Each of these gifts is associated with a different allocation. I am trying to bring back up to two allocation for each primary pledge. The allocation number can be found in the pledge table. I want the record to look something like this:
id, name, address, pledge #, allocation1, allocation2, more than two allocations flag...
id-- connects entity, address, and pledge
pledge#-- connects primary_pledge and pledge
allocation code-- connects pledge and allocation
Please advise how I might do this for a group of pledges
Sounds like a job for PL/SQL...
Click Here to Expand Forum to Full Width