<p>In Oracle we can print output by <code>dbms_output.put_line()</code> but I don't know to do the same thing in DB2.</p>

<p>I currently use <code>signal</code> for printing some messages when I debug.</p>

What kind of document library information do you want in the view?
How do you want the user to filter the view?
In general the most powerful way of creating views in sharepoint is with the data view web part.
http://office.microsoft.com/en-us/sharepointdesigner/HA100948041033.aspx
You will need Microsoft Office SharePoint Designer.
You can present different views of you folders using the data view filter and sorting controls.
You can use web part connections to filter a dataview.
You can use any datasource linked to say a drop down to filter a dataview.
How to tie a dropdown list to a gridview in Sharepoint 2007?