首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

带参数存储过程怎么测试?

2014-01-28 
带参数存储过程怎么测试?PROCEDURE GET_COURTEAC(v_xyh VARCHAR2,v_kch VARCHAR2, v_cur_courteac OUT T_CU

带参数存储过程怎么测试?

PROCEDURE GET_COURTEAC(v_xyh VARCHAR2,v_kch VARCHAR2, v_cur_courteac OUT T_CURSOR)
IS
str_sql VARCHAR2(400);
BEGIN
str_sql:='SELECT A.KCH,A.KCM,B.KXH,B.BM FROM CODE_KCB A, CODE_BJB B WHERE A.JSH=B.BMH AND A.KKXSH='||v_xyh;
str_sql:=str_sql||' AND B.KXH='''||v_kxh||'''' ;
OPEN v_cur_courteac FOR str_sql;
END GET_COURTEAC;
新建存储过程后,怎样测试是否正确,在PL/SQL 或SQLPLUS中,请给一下简单的示例

另外,但返回值的过程,如何在程序(c#等)中调用,如 return stt;这种语句的存储过程

------解决方法--------------------------------------------------------
找个第三方工具比如PL/SQL Developer,可以进行调试
------解决方法--------------------------------------------------------
不用工具的话用sql*plus就这样慢慢调试
SQL> create or replace PROCEDURE GET_COURTEAC(v_xyh VARCHAR2,v_kch VARCHAR2, v_cur_courteac OUT T_CU
RSOR)
2 IS
3 str_sql VARCHAR2(400);
4 BEGIN
5 str_sql:='SELECT A.KCH,A.KCM,B.KXH,B.BM FROM CODE_KCB A, CODE_BJB B WHERE A.JSH=B.BMH AND
A.KKXSH='||v_xyh;
6 str_sql:=str_sql||' AND B.KXH='''||v_kxh||'''' ;
7 OPEN v_cur_courteac FOR str_sql;
8 END GET_COURTEAC;
9 /

Warning: Procedure created with compilation errors.

SQL> show error
Errors for PROCEDURE GET_COURTEAC:

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PL/SQL: Compilation unit analysis terminated
1/74 PLS-00201: identifier 'T_CURSOR' must be declared
SQL>
------解决方法--------------------------------------------------------
PL/SQL 中用TEST

        

热点排行