Q
Problem solve Get help with specific problems with your technologies, process and projects.

Including headings in stored procedure output

I am creating a stored procedure that, when I pass it a manufacturer's number, will print out (DBMS_OUTPUT.PUT_LINE) 5fivefields (I choose) from the manufacturer's table. I am having trouble including headings in the output. I also need to include my name in the heading. And, if a manufacturer isn't found, I want to print out the asked for ID and a "NOT FOUND" message.

Because DBMS_OUTPUT will only print what you tell it to, you will have to provide the proper calls to DBMS_OUTPUT to print any headings and other information you desire.

To print headings with DBMS_OUTPUT, you can simply format the first line of output you send to have the proper column names displayed. Since you know the values you'll be displaying, you should easily be able to create a heading line.

As far as the "NOT FOUND" message goes, I'll assume that you are using a SELECT...INTO statement to get your data. If that's the case and an invalid manufacturer is asked for, the SELECT should generate a NO_DATA_FOUND error. In the exception section, simply code a WHEN NO_DATA_FOUND handler to use DBMS_OUTPUT to put out the NOT FOUND message you desire.

For More Information


Dig Deeper on Oracle stored procedures

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close