如何使存储过程显示oracle中表中的所有数据 [英] how to make stored procedure for display all data from table in oracle

查看:141
本文介绍了如何使存储过程显示oracle中表中的所有数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,
我们正在使用asp.net和oracle 10g创建一个项目.我的问题是我想从table.fetch中获取所有数据.如何使用oracle 10g中的存储过程进行创建.


例如在sql 2005中;

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;

create procedure test

as

select * from table_name


任何帮助感激我,
谢谢

Randeep Chauhan


any help appreciate me,
thanks

Randeep Chauhan

推荐答案

可能是此链接可以帮助您.实际上,我需要定义光标,以便使用provider
检索值.

http://msdn.microsoft.com/en-us/library/ms971506.aspx [ ^ ]
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[^]


创建过程


创建过程procedure_name(@var数据类型)

开始

从table_name中选择*,其中column_name = @ var

结束




执行存储过程:

exec procedure_name var_value
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


CREATE OR REPLACE PROCEDURE skeleton
IS
BEGIN
 select * from table_name
END;



最好在选择中使用列名而不是*,例如table_name.Id
出于性能原因



it is better to use column name instead of * in select such as table_name.Id
for performance reasons


这篇关于如何使存储过程显示oracle中表中的所有数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆