These are useful and collceted by Surf Blog!
Question: How can I line up this output from Oracle PL SQL?
I have the PL SQL below to get some information from a table, but I want to everything to line up in the output instead of being pushed all over. Any ideas how I can format it so it all lines up cleanly?
Thanks!
DECLARE
TotNumber number := 0;
TotValue number := 0;
CURSOR inv_cursor IS
SELECT ITEM.ITEM_DESC, SUM(INVENTORY.INV_QOH) AS “INV_QOH”, SUM(INVENTORY.INV_PRICE * INVENTORY.INV_QOH) AS “INV_PRICE”
FROM ITEM, INVENTORY
WHERE ITEM.ITEM_ID = INVENTORY.ITEM_ID
GROUP BY ITEM.ITEM_DESC;
inv_cursorRow inv_cursor%RowType;
BEGIN
DBMS_OUTPUT.PUT_LINE(‘ITEM DESCRIPTION’ || ‘ ‘ || ‘NUMBER’ || ‘ Value’);
DBMS_OUTPUT.PUT_LINE(‘—————————— ———- ———–’);
FOR inv_cursorRow IN inv_cursor LOOP
DBMS_OUTPUT.PUT_LINE(inv_cursorRow.ITEM_DESC || ‘ ‘ || inv_cursorRow.INV_QOH || ‘ ‘ || inv_cursorRow.INV_PRICE);
TotNumber := TotNumber + inv_cursorRow.INV_QOH;
TotValue := TotValue + inv_cursorRow.INV_PRICE;
END LOOP;
DBMS_OUTPUT.PUT_LINE(‘—————————— ———- ———–’);
DBMS_OUTPUT.PUT_LINE(‘GRAND TOTALS’ || ‘ ‘ || TotNumber || ‘ ‘ || TO_CHAR(TotValue, ’9,999.99′));
END;
ITEM DESCRIPTION NUMBER Value
—————————— ———- ———–
Women’s Hiking Shorts 688 20605.6
Children’s Beachcomber Sandals 1008 16117.92
Boy’s Surf Shorts 250 3987.5
Women’s Fleece Pullover 726 43523.7
Men’s Expedition Parka 143 28712.85
3-Season Tent 28 7279.72
Girl’s Soccer Tee 300 5997
—————————— ———- ———–
GRAND TOTALS 3143 6,224.29

The pictures have nothing to do with the content!!
The following is the answer:
Answer by Dan
This might help you fix the format
http://sbiaffiliate.com
Answer by TheMadProfessor
Since Item Description is probably a VARCHAR, that’s what’s messing up the formatting. Try moving the field into a fixed-length string variable with a size equal to the maximum length of Item Description and use that in your output line instead..
What do you think? Answer below!
———————————
———————————
———————————-
———————————-
Ugg Classic Tall Boots, classic style as always be
Ugg Classic Tall Boots is well known for the warmth and comfort during the cold fall and winter nights. They may not look so beautiful inside people’s minds. Now, Ugg Classic Tall Boots is delivering and offering new styles specifically designed for warm spring and summer months. Some of the newly offered styles are sandals and even light weight summer boots instead of just ugg classic tall boots especially for you.
Uggs slip resistant performance rubber outsole structure. Ugg Classic Tall Boots on Sale Round leather thong toe post for comfort. The finest sheepskin lining, contoured rich suede wrapped footbed with sheepskin heel pad for plush comfort. Flexible midsole, molded polyurethane outsole for traction. UGG Australia first sheep leather boots so amazing sales record surfing brand on the beach, and is located in the same time. UGG Gypsy comfort springs from the unique flip flop gladiator style thong and yielding cork infused rubber outsole.
The embossed rivet and the buckle on the strap give the right level of design to finish off Gypsy sandal boots. They are really valuable for everyone to pampler their feet and play up the look! Here comes chocolate UGG Gpysy sandal boots to enhance you timelessly fashionable look! UGG boots have a worldwide fame for their ultimate comfort and unique fashion. They are highly appreciated by people all over the world. Right now there are a great deal of ugg boots online for your reference. Now bare suggested UGG’s official wearing UGG Classic, people dress habits formed (think ice water, surfing UGG snow put a pair of Uggs Boots too warm and comfortable.
Winter ultra wearing unusual level of comfort, warmth and features you enjoy, wholesale handbags. UGG Slippers products if outside one of the most important Cheap Uggs features is its unique excellent catch and performance, and ugg Classic Tall Boots: This boot is a top favorite because of the way it features a thinner outsole for a sleek stylish look. The color choices are popular for spring and summer choice. (White, Black and Pink) They are light weight and comfortable for everyday use. These boots offer the choice of wearing them in the fall, winter, spring and summer.
There is no wrong time to wear these boots. So just have a try and there are lot other styles here at our website on uggboots61.com.

