Our stored procedures often capture information and store that data as a string or number. But sometimes we need to process more than just a single value. PL/SQL allows you to do this via collections. Now, if you’re looking for help getting started with collections, I would start with
- Using PL/SQL Collections and Records Oracle Docs
- The PL/SQL Guru, Steven Feuerstein
Once you have a program working, and you want to know what your data looks like before it processes or passes the data to another program, I recommend using our PL/SQL debugger. The debugger allows you to run your program, step-by-step, and inspect what the code is doing, line-by-line. If you need a quick, ‘Debugger 101‘, then you’re in luck
Once you’re debugging, you’re ready to ‘watch.’ Need help figuring our how watches work, and when to use a watch versus the Data or Smart Data panel?
Stepping Through the ‘Table’
Your PL/SQL table has one or more rows, and now you want to know what’s in those rows, right?
Your code may look a little something like this:
OPEN c1; --c1 is a cursor tied to a query that is executed
LOOP
FETCH c1 INTO tab (len + 1); -- tab is a 'table of table%rowtype'
EXIT WHEN c1%NOTFOUND;
len := len + 1;
END LOOP;
Once you invoke the debugger in SQL Developer, you’ll notice the Smart Data Panel has an entry that matches our ‘tab’ object:
Now Expand the TAB Tree Node
My indexed table happens to be indexed by an integer. This integer grows as my cursor loop runs. I can drill into one of the rows and see the data being stored.
As I step through the loop, I’ll see more and more rows appear.
Quick Inspect
Now maybe I don’t want to click and expand to see what’s happening. You can instead do a ‘Quick Inspect’ or a ‘peek’ to see what’s being stored. That’s what the ‘little green dots’ indicate.
Having trouble getting the watches or data panels to show anything? You’ve remembered to compile your procedure ‘For Debug,’ right?





Twitter
RSS
GooglePlus
Facebook
Sep 17, 2012 @ 10:02:54
Hey there just wanted to give you a quick heads up.
The text in your post seem to be running off the screen in Opera.
I’m not sure if this is a format issue or something to do with browser compatibility but I thought I’d post to let you know.
The layout look great though! Hope you get the issue solved soon.
Cheers
Sep 17, 2012 @ 12:52:19
It looks like my WP plugin SyntaxHighlighter isn’t working for some reason. Oh joy. Thanks for bringing it to my attention Salvador!