当前位置:网站首页>C # use Oracle stored procedure to obtain result set instance
C # use Oracle stored procedure to obtain result set instance
2022-07-06 20:57:00 【51CTO】
stored procedure :
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# Code :
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;
}
边栏推荐
- Use of OLED screen
- SAP UI5 框架的 manifest.json
- 小孩子學什麼編程?
- 监控界的最强王者,没有之一!
- @PathVariable
- 性能测试过程和计划
- 2022 portal crane driver registration examination and portal crane driver examination materials
- What key progress has been made in deep learning in 2021?
- Common doubts about the introduction of APS by enterprises
- 全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
猜你喜欢

看过很多教程,却依然写不好一个程序,怎么破?

知识图谱之实体对齐二

Manifest of SAP ui5 framework json

【mysql】游标的基本使用

强化学习-学习笔记5 | AlphaGo

(work record) March 11, 2020 to March 15, 2021

Common doubts about the introduction of APS by enterprises

数据湖(八):Iceberg数据存储格式

防火墙基础之外网服务器区部署和双机热备

全网最全的知识库管理工具综合评测和推荐:FlowUs、Baklib、简道云、ONES Wiki 、PingCode、Seed、MeBox、亿方云、智米云、搜阅云、天翎
随机推荐
知识图谱构建流程步骤详解
2022 portal crane driver registration examination and portal crane driver examination materials
强化学习-学习笔记5 | AlphaGo
【每周一坑】计算100以内质数之和 +【解答】输出三角形
APS taps home appliance industry into new growth points
Huawei device command
2022 nurse (primary) examination questions and new nurse (primary) examination questions
'class file has wrong version 52.0, should be 50.0' - class file has wrong version 52.0, should be 50.0
Swagger UI教程 API 文档神器
How to turn a multi digit number into a digital list
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
What is the problem with the SQL group by statement
1500萬員工輕松管理,雲原生數據庫GaussDB讓HR辦公更高效
C language games - minesweeping
[weekly pit] calculate the sum of primes within 100 + [answer] output triangle
Manifest of SAP ui5 framework json
【微信小程序】运行机制和更新机制
PG基础篇--逻辑结构管理(事务)
Pytest (3) - Test naming rules
HMS Core 机器学习服务打造同传翻译新“声”态,AI让国际交流更顺畅