Click here to Skip to main content
15,900,723 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear friends,
we are making a project with asp.net and oracle 10g.my question is suppose i want to fetch all data from table.how to make it with stored procedure in oracle 10g.


for example in sql 2005;

SQL
create procedure test

as

select * from table_name

any help appreciate me,
thanks

Randeep Chauhan
Posted
Updated 19-Oct-11 19:59pm
v2

may be this link help you. actually we need to define cursor as far as i recall to retrieve values using provider


http://msdn.microsoft.com/en-us/library/ms971506.aspx[^]
 
Share this answer
 
for creating procedure


Create Procedure procedure_name(@var datatype)

begin

select * from table_name where column_name=@var

end




for excecute the stored procedure:

exec procedure_name var_value
 
Share this answer
 
SQL
CREATE OR REPLACE PROCEDURE skeleton
IS
BEGIN
 select * from table_name
END;


it is better to use column name instead of * in select such as table_name.Id
for performance reasons
 
Share this answer
 
Comments
Randeep Chauhan 20-Oct-11 2:18am    
Thanks aamir your fast reply,but when i excute query it give error;

my stored procedure is:
SQL> create or replace procedure
2 show is
3 begin
4 select * from country;
5 end;
6 /

Warning: Procedure created with compilation errors.

select * from user_errors;

NAME TYPE SEQUENCE LINE POSITION
------------------------------ ------------ ---------- ---------- ----------
TEXT
--------------------------------------------------------------------------------
ATTRIBUTE MESSAGE_NUMBER
--------- --------------
SHOW PROCEDURE 1 4 2
PLS-00428: an INTO clause is expected in this SELECT statement
ERROR 428

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900