DECLARE
l_query VARCHAR2(1000);
l_order_number VARCHAR2(50) := '52424905';
TYPE lr_order_detail_rec IS RECORD
( l_order_number oe_order_headers_all.order_number%TYPE,
l_line_number VARCHAR2(30),
l_ordered_item oe_order_lines_all.ordered_item%Type,
l_line_status oe_order_lines_all.flow_status_code%TYPE,
l_order_status oe_order_headers_all.flow_status_code%TYPE);
TYPE lt_order_detail_tab IS TABLE OF lr_order_detail_rec
INDEX BY BINARY_INTEGER;
lt_order_detail_tab_o lt_order_detail_tab;
BEGIN
l_query := 'SELECT order_number, oe_flex_util.get_concat_value (oola.line_number,
oola.shipment_number,
oola.option_number,
oola.component_number,
oola.service_number)
line_num,
oola.ordered_item,
oola.flow_status_code,
ooha.flow_status_code
FROM oe_order_headers_all ooha, oe_order_lines_all oola
WHERE ooha.header_id = oola.header_id
AND ooha.order_number = ' || l_order_number;
BEGIN
EXECUTE IMMEDIATE l_query
BULK COLLECT INTO lt_order_detail_tab_o;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Inside exception ' || SQLERRM);
END;
dbms_output.put_line('lt_order_detail_tab_o.COUNT :- ' || lt_order_detail_tab_o.COUNT);
dbms_output.put_line('Order Number || Line Number || ordered Item || Order Status || Line Status ' );
FOR i IN lt_order_detail_tab_o.FIRST..lt_order_detail_tab_o.LAST
LOOP
dbms_output.put_line( lt_order_detail_tab_o(i).l_order_number|| ' '||
lt_order_detail_tab_o(i).l_line_number || ' ' ||
lt_order_detail_tab_o(i).l_ordered_item ||' '||
lt_order_detail_tab_o(i).l_order_status ||' ' ||
lt_order_detail_tab_o(i).l_line_status);
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Inside exception when others' || SQLERRM);
END;
l_query VARCHAR2(1000);
l_order_number VARCHAR2(50) := '52424905';
TYPE lr_order_detail_rec IS RECORD
( l_order_number oe_order_headers_all.order_number%TYPE,
l_line_number VARCHAR2(30),
l_ordered_item oe_order_lines_all.ordered_item%Type,
l_line_status oe_order_lines_all.flow_status_code%TYPE,
l_order_status oe_order_headers_all.flow_status_code%TYPE);
TYPE lt_order_detail_tab IS TABLE OF lr_order_detail_rec
INDEX BY BINARY_INTEGER;
lt_order_detail_tab_o lt_order_detail_tab;
BEGIN
l_query := 'SELECT order_number, oe_flex_util.get_concat_value (oola.line_number,
oola.shipment_number,
oola.option_number,
oola.component_number,
oola.service_number)
line_num,
oola.ordered_item,
oola.flow_status_code,
ooha.flow_status_code
FROM oe_order_headers_all ooha, oe_order_lines_all oola
WHERE ooha.header_id = oola.header_id
AND ooha.order_number = ' || l_order_number;
BEGIN
EXECUTE IMMEDIATE l_query
BULK COLLECT INTO lt_order_detail_tab_o;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Inside exception ' || SQLERRM);
END;
dbms_output.put_line('lt_order_detail_tab_o.COUNT :- ' || lt_order_detail_tab_o.COUNT);
dbms_output.put_line('Order Number || Line Number || ordered Item || Order Status || Line Status ' );
FOR i IN lt_order_detail_tab_o.FIRST..lt_order_detail_tab_o.LAST
LOOP
dbms_output.put_line( lt_order_detail_tab_o(i).l_order_number|| ' '||
lt_order_detail_tab_o(i).l_line_number || ' ' ||
lt_order_detail_tab_o(i).l_ordered_item ||' '||
lt_order_detail_tab_o(i).l_order_status ||' ' ||
lt_order_detail_tab_o(i).l_line_status);
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Inside exception when others' || SQLERRM);
END;
I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. In fact after reading. I had to go show it to my friend and he ejoyed it as well! OTW777 DEPO VIA DANA
ReplyDelete