Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to sort data in PL/SQL table and print them in Order?

748473Jul 6 2010 — edited Jul 7 2010
Hi Guys

I wan to create a csv file layout as below, maximum we got 12 weeks sales figure for each item. Week is week of the year, it will different every time based on sales_date.

- - - -- - - - - - - - -- - - -- - - - - --- - --- -- - - - -- - -- -- - - -- - - -- - --- - -- - - - -- --- ---- ---- - - - -- - - - - - - -- - - - - -- ---- -
Item Number Description Sales Week 27 26 25 24 23 22 21 20..
- - - -- - - - - - - - -- - - -- - - - - --- - - -- -- - - - -- - -- -- - - -- - - -- - --- - -- - - - -- --- ---- ---- - - - -- - - - - - - -- - - - - -- -----
1234 Sample 10 6 2 8 10
1230 Test 50 60 2 10

I got item number, description, week_no and sales in a temp table which is populated by a procedure. Now I need to write these records from table to a file.
I not sure how to store multiple records for each item in PL/SQL table, sort them and print them in above format.

My select statement is as below

select item_number,
description,
week_no,
year,
opening_stock_qty,
production_qty,
sales_qty,
creation_date,
(production_qty - sales_qty) net_qty
from xxsu_planning_report
order by item_number,year,week_no;


Any help will be much appreciated.

Thanks and regards

VJ
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 4 2010
Added on Jul 6 2010
10 comments
4,350 views