当前位置:网站首页>c#使用oracle存储过程获取结果集实例
c#使用oracle存储过程获取结果集实例
2022-07-06 12:44:00 【51CTO】
存储过程:
create or replace PACKAGE FIRSTPAGE AS
/* TODO enter package declarations (types, exceptions, methods etc) here */
type v_cursor is REF CURSOR;
procedure getnumber(re_cursor out v_cursor);
END FIRSTPAGE;
create or replace PACKAGE BODY FIRSTPAGE AS
procedure getnumber(re_cursor out v_cursor) AS
BEGIN
/* TODO implementation required */
open re_cursor for
select * from testable;
END getnumber;
END FIRSTPAGE;
C#代码:
public DataSet GetTableByProcedure()
{
OracleConnection con = new OracleConnection(_connectionString);
OracleCommand cmd = new OracleCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "firstpage.getnumber";
OracleParameter sp = new OracleParameter("re_cursor", OracleType.Cursor);
sp.Direction = ParameterDirection.Output;
cmd.Parameters.Add(sp);
OracleDataAdapter da = new OracleDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
cmd.Dispose();
con.Close();
con.Dispose();
return ds;
}
边栏推荐
- 【每周一坑】正整数分解质因数 +【解答】计算100以内质数之和
- Laravel notes - add the function of locking accounts after 5 login failures in user-defined login (improve system security)
- [DIY]如何制作一款个性的收音机
- Utilisation de l'écran OLED
- Logic is a good thing
- Performance test process and plan
- B-jiege's tree (pressed tree DP)
- Number of schemes from the upper left corner to the lower right corner of the chessboard (2)
- Zoom with unity mouse wheel: zoom the camera closer or farther
- 过程化sql在定义变量上与c语言中的变量定义有什么区别
猜你喜欢
Reinforcement learning - learning notes 5 | alphago
2022 nurse (primary) examination questions and new nurse (primary) examination questions
新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
Redis insert data garbled solution
No Yum source to install SPuG monitoring
Web security - payload
Application layer of tcp/ip protocol cluster
为什么新手在编程社区提问经常得不到回答,甚至还会被嘲讽?
(工作记录)2020年3月11日至2021年3月15日
Rhcsa Road
随机推荐
Comment faire une radio personnalisée
请问sql group by 语句问题
OAI 5G NR+USRP B210安装搭建
Force deduction brush question - 98 Validate binary search tree
C language games - three chess
知识图谱之实体对齐二
Web security - payload
SQL injection 2
In line elements are transformed into block level elements, and display transformation and implicit transformation
什么是RDB和AOF
动态切换数据源
(work record) March 11, 2020 to March 15, 2021
Pycharm remote execution
正则表达式收集
Zoom with unity mouse wheel: zoom the camera closer or farther
基于STM32单片机设计的红外测温仪(带人脸检测)
[DIY]如何制作一款個性的收音機
Taylor series fast Fourier transform (FFT)
Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices
【微信小程序】运行机制和更新机制