C#调用oracle 存储过程与调用Sql server存储过程类似,比较简单:直接给出示例:

  /// <summary>
/// 判断物料类型是不是总部管控
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
/// <summary>
public bool IsHeadquartersPart(string key)
{
isGroupPart = false;
OracleCommand cmd = new OracleCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = (OracleConnection)this.dbParam.Connection;
cmd.CommandText = "PLM_ECMS_CheckPartType"; OracleParameter[] parameters = {
new OracleParameter(":pid", OracleDbType.Varchar2),
new OracleParameter(":parttype", OracleDbType.Int32)
};
parameters[].Value = key;
parameters[].Direction = ParameterDirection.Input; parameters[].Direction = ParameterDirection.Output; for (int i = ; i < parameters.Length; i++)
{
cmd.Parameters.Add(parameters[i]);
} cmd.Prepare(); try
{
int k = ;
cmd.ExecuteNonQuery();
bool temp = int.TryParse(parameters[].Value.ToString(), out k);//返回代码;0表示成功,非0表示不成功 return temp ? (k == ? true : false) : false;
}
catch (Exception ex)
{
LogHelper.CreateErrorLogTxt("IsHeadquartersPart", ex.Message, cmd.CommandText);
return false;
}
finally
{
cmd.Dispose();
} }

存储过程如下:

 create or replace procedure PLM_ECMS_CheckPartType(pid  in nvarchar2,
parttype out integer) as intNum integer := 0;
rc_id varchar2(36) := '1dda4a6a-c633-4c63-bc1b-74efbb5b01e1'; --总部通用物料 begin --用在经纬权限判断JW 根据传入的物料id 来判断顶级物料是不是产品通用物料 如果是返回1 不是返回0
parttype := 0;
select count(1) into intNum from Plm_Ecms_Rule rc where rc.r_id = pid;
if intNum >= 1 then
--是规则
intNum := 0;
select count(1)
into intNum
from Plm_Ecms_Rclass r
where r.rc_id in
(select r.rc_id
from Plm_Ecms_Rclass r
start with r.rc_id = (select rc.rc_id
from Plm_Ecms_Rule rc
where rc.r_id = pid)
connect by r.rc_id = prior r.rc_pid)
and r.rc_id = rc_id;
if intNum >= 1 then
--是总部集中管控物料
parttype := 1;
end if;
--是类型
else
select count(1) into intNum
from Plm_Ecms_Rclass rc
where rc.rc_id in (select r.rc_id
from Plm_Ecms_Rclass r
start with r.rc_id = pid
connect by r.rc_id = prior r.rc_pid)
and rc.rc_id = '1dda4a6a-c633-4c63-bc1b-74efbb5b01e1'; if intNum >= 1 then
--是总部集中管控物料
parttype := 1;
end if; end if; end PLM_ECMS_CheckPartType;

C#调用 oracle存储过程的更多相关文章

  1. MyBatis调用Oracle存储过程

    MyBatis调用Oracle存储过程 1.无输入和输出参数的存储过程 2.带有输入和输出参数的存储过程 3.返回游标的存储过程 mybatis中的配置文件代码 <resultMap type= ...

  2. Java调用oracle存储过程通过游标返回临时表数据

    注:本文来源于 <  Java调用oracle存储过程通过游标返回临时表数据   > Java调用oracle存储过程通过游标返回临时表数据 项目开发过程中,不可避免的会用到存储过程返回结 ...

  3. C#调用Oracle存储过程

    C#调用Oracle存储过程的代码如下所示: using System; using System.Collections.Generic; using System.Collections.Obje ...

  4. 123 c#调用oracle存储过程返回数据集 --通过oracle存储过程返回数据集

    c#调用oracle存储过程返回数据集 2008-12-20 10:59:57|  分类: net|字号 订阅   CREATE OR REPLACE PACKAGE pkg_tableTypeIS  ...

  5. c#调用oracle存储过程返回数据集

    c#调用oracle存储过程返回数据集 2008-12-20 10:59:57|  分类: net|字号 订阅   CREATE OR REPLACE PACKAGE pkg_tableTypeIS  ...

  6. C#调用Oracle存储过程的方法

    C#调用Oracle存储过程的方法 准备: 环境:pl/sql+oracle9i+vs2008 创建表test: create table TEST(  ID      NUMBER,//编号  NA ...

  7. Oracle创建表语句(Create table)语法详解及示例、、 C# 调用Oracle 存储过程返回数据集 实例

    Oracle创建表语句(Create table)语法详解及示例 2010-06-28 13:59:13|  分类: Oracle PL/SQL|字号 订阅 创建表(Create table)语法详解 ...

  8. python调用oracle存储过程

    oracle 存储过程 python调用oracle存储过程 -- 通过cx_Oracle连接 import cx_Oracle # 连接数据库 orcl_engine = 'scott/s123@x ...

  9. 用java 调用oracle存储过程总结

    SSM-Mybatis调用Oracle存储过程返回结果集(游标)示例 https://www.jianshu.com/p/0ae6d9d66d61 用java调用oracle存储过程总结 //1.ca ...

随机推荐

  1. bzoj 4401: 块的计数

    4401: 块的计数 Description 小Y最近从同学那里听说了一个十分牛B的高级数据结构——块状树.听说这种数据结构能在sqrt(N)的时间内维护树上的各种信息,十分的高效.当然,无聊的小Y对 ...

  2. Problem E: 深入浅出学算法019-求n的阶乘

    Problem E: 深入浅出学算法019-求n的阶乘 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 5077  Solved: 3148 Descrip ...

  3. Codeforces Round #344 (Div. 2) D. Messenger kmp

    D. Messenger 题目连接: http://www.codeforces.com/contest/631/problem/D Description Each employee of the ...

  4. Xcode8 报 ”xx“is missing from working copy 的问题解决方法

    方法一: Xcode->Preferences->Source->Enable Source Control 勾勾去掉 方法二: Xcode8更新后,编译工程一下子报出800多条类似 ...

  5. GNU Debugger for Windows----GDB

            This web page provides 32-bit and 64-bit binaries of gdb for Windows for download. Equation ...

  6. POI创建Excel使用的常见的属性

    public static void main(String[] args) { //创建新的Excel 工作簿 HSSFWorkbook workbook =new HSSFWorkbook(); ...

  7. Traefik的TLS配置

    生产环境的部署大多采用F5+ Traefik这种方式,因为Traefik的SSL方式相对来说比较慢,因此SSL更多的在F5上开放,而F5到Traefik之间以及后端都是http方式. 但客户需要在开发 ...

  8. nginx bind() to 0.0.0.0:**** failed (13: Permission denied)

    nginx 启动失败,日志里面报错信息如下: Starting nginx: nginx: [emerg] bind() to 0.0.0.0:**** failed (13: Permission ...

  9. [转]SSIS高级转换任务—行计数

    本文转自:http://www.cnblogs.com/tylerdonet/archive/2011/06/19/2084780.html 在SSIS中的Row Count转换可以在数据流中计算数据 ...

  10. web前端入坑第二篇:web前端到底怎么学?干货资料! 【转】

    http://blog.csdn.net/xllily_11/article/details/52145172 版权声明:本文为博主[小北]原创文章,如要转载请评论回复.个人前端公众号:前端你别闹,J ...