MSSQL的存储过程返回数据集好简单,直接SELECT 就可以. ORACLE的存储过程返回数据集必须通过游标. 创建ORACLE存储过程 create or replace procedure cxg_test(out_var out sys_refcursor) is begin open out_var for select * from a; end; 调用ORACLE存储过程 declare cur_calling sys_refcursor; v_row
c#调用oracle存储过程返回数据集 2008-12-20 10:59:57| 分类: net|字号 订阅 CREATE OR REPLACE PACKAGE pkg_tableTypeIS type Tabletype is ref cursor; PROCEDURE SP_CPZD ( CPNO IN VARCHAR2, STATUS IN VARCHAR2, t_sql out Tabletype );END;CRE
c#调用oracle存储过程返回数据集 2008-12-20 10:59:57| 分类: net|字号 订阅 CREATE OR REPLACE PACKAGE pkg_tableTypeIS type Tabletype is ref cursor; PROCEDURE SP_CPZD ( CPNO IN VARCHAR2, STATUS IN VARCHAR2, t_sql out Tabletype );END;CRE
创建返回结果集类型的存储过程: CREATE OR REPLACE FUNCTION public.f_get_member_info( id integer, productname character) RETURNS SETOF record LANGUAGE 'plpgsql' COST 100 VOLATILE ROWS 1000AS $BODY$ DECLARE rec record;BEGIN for rec in EXECUTE 'select id
在程序开发中,常用到返回结果集的存储过程,这个在mysql和sql server 里比较好处理,直接返回查询结果就可以了,但在oracle里面 要 out 出去,就多了一个步骤,对于不熟悉的兄弟们还得出上一头汗:),这里我简单介绍一下,以供参考, 1 定义包 oracle 返回的结果集需要自定义一个 CURSOR (游标变量)性质的变量,这个要在包头定义,所以要建立一个包,如下是包头 Pl/sql代码 CREATE OR REPLACE PACKAGE PAK_rstest IS
一.返回一个值 --创建存储过程 create or replace procedure sp_hu_test(spcode in varchar2,spname out varchar2)is begin select cname into spname from gb_customerinfo where ccode = spcode; end; //java代码调用和接受返回值 public static void main(String[] arg) { try { Class.forN
这里使用Oracle数据库的thin连接. 下面是存储过程SQL 1 createorreplaceprocedure proc3(stid in student.stuid%type, stname out student.sname%type, stphone out student.phonenumber%type, stuadd out student.saddress%type) 2 as countnumber number; 3 begin 4 selectcount(*) int
整理一下级联更新和删除 c#调用返回值 use master go IF exists(select 1 from sysdatabases where name='temp') BEGIN DROP DATABASE temp END create database temp go use temp go --drop table ProductInfo create table ProductInfo ( ProductId int primary key , ProductName var
存储过程示例: create or replace procedure Fsp_Plan_CheckPrj(v_grantno varchar2, v_deptcode number, v_cursor out sys_refcursor) is ……………… ---返回统计结果 open v_Cursor for select s.plan_code, s.plan_dept, s.plan_amount, s.exec_amount, p.cname as plan_name, d.cnam
如果报表逻辑非常复杂的话, 可以把报表逻辑放到存储过程里,加工一个全局临时表.前端查询的时候只查询临时表即可.只是第一次查询需要忍受加工的时间. --创建存储过程,返回SYS_REFCURSOR CREATE OR REPLACE PROCEDURE P_GET_AGENT(V_AGENT_CATE IN VARCHAR2, V_PAGE IN INTEGER, O_CURSOR OUT SYS_REFCURSOR) IS BEGIN INSERT INTO TMP_TAB_T_AGENT(AG