Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to return data from Database

Status
Not open for further replies.

campbere

Technical User
Oct 10, 2000
146
US
Ok,

I have completely confused myself. I need to return data from a database from a select statement. How do I do this? Is this done in a package, function, stored procedure?

It is a simple query that would return several rows.

For example

select product_id, product_name, product_price
from product_table
where product_season = 'spring'

I have read several things but nothing is sinking in for me. I appreciate the help and examples you may provide.

 
Campbear, I need a bit more information. Your SELECT statement looks syntactically correct. Have you executed this SELECT from SQL*Plus? If so, what were your results (or lack thereof)? If you ran the statement and it responded with 'no rows selected', then your WHERE clause is the culprit. To determine the problem with the WHERE clause, I would start by issuing this SELECT:

SELECT distinct product_season from product_table;

This would show if there is a problem with case sensitivity.

So, please offer us more information on what you have done to try this statement and what were the results.

Dave
 
I can run the statement in sqlplus. This is a statement that is going to be used by other applications so I wanted to make it a stored procedure or function. I am not sure what is the right way to go or how to write it.

Here is a snippet of results:

product_id product_name product_price
1A widget 124.00
2Q widget_plus 133.00
54T widget wonder 980.00
 
You may create view if your reusable query is sosimple.

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top