Oracle存储过程 [英] Oracle Stored Procedure

查看:101
本文介绍了Oracle存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是sql服务器开发人员,但当前我使用的是oracle 10g.
我不知道如何在oracle中创建SP.

我想为简单的从Emp选择*"创建过程,然后从c#调用它.

请帮助我

I am a sql server developer but currently I am using oracle 10g.
I don''t know how to create SP in oracle.

I want to create procedure for simple "Select * from Emp" and call it from c#.

Please help me

推荐答案

您正在使用哪个提供程序(用于访问数据库)?您的C#代码将取决于此.

Oracle.com的网站上有很多书籍,尽管搜索有些废话.您将在此处找到所有信息.尝试使用google和site:oracle.com
Which provider (to access database) are you using? Your C# code will depend on that.

Oracle.com has lots of books in there website although their search is a bit crap. You will find all the information there. Try searching for the books maybe using google and site:oracle.com


Spec:
搜索书籍
Spec:

CREATE OR REPLACE PACKAGE PKG_VERIFY AS




PROCEDURE prc_Verify  (i_id  IN  tablename.id%TYPE,
o_cursor         OUT    sys_refcursor,
o_ErrorCode      OUT       VARCHAR2);


END PKG_VERIFY;




正文:




Body:

create or replace
PACKAGE BODY PKG_VERIFY IS

PROCEDURE prc_Verify
                                 (i_id          IN  tablename.id%TYPE,
                                  o_cursor         OUT    sys_refcursor,
                                  o_ErrorCode      OUT       VARCHAR2)
  IS
  BEGIN

   o_Errorcode := SQL_OK;
  OPEN o_cursor FOR
      SELECT Acc,Bcc
      FROM   tablename
      WHERE  id = i_id;

   EXCEPTION
                 WHEN NO_DATA_FOUND THEN
                    o_Errorcode := 'No Record Found';
  END;
END PKG_VERIFY;



希望这会有所帮助!



Hope this helps!


检查以下文章

从Oracle.NET调用Oraclestoredprocedures

如果发现有用,请接受答案:)
Check the below article

Calling Oracle stored procedures from Microsoft.NET

Accept the answer if find useful :)


这篇关于Oracle存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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