create or replace procedure Select_User
( ID in varchar2,
  Pass in varchar2)
as 
begin
 select USER_ID,USER_PASSWORD,USER_FUNDS
 from USERINFO where USER_ID=ID and USER_PASSWORD=Pass;
end;
我写了上面一个存储过程,在sql Plus里面执行时,从说程序有错误,
然后,我用了EXECUTE Select_UserInfo('222','52');
还是报了很多错误,请问我的存储过程的写法正确吗?

解决方案 »

  1.   

    你不能用sqlserver的写法在oracle里使用的,返回结果集需要定义动态游标
      

  2.   

    语法sqlserver和oracle是有区别的!
      

  3.   

    using (OracleConnection con = DataConnection.GetConnection())
                {
                    OracleParameter oparm = new OracleParameter("P_CURSOR", OracleType.Cursor);
                    oparm.Direction = ParameterDirection.Output;
                    DataSet ds;
                    ds = OracleHelper.ExecuteDataset(con, CommandType.StoredProcedure, "sys_DepartmentCategoryGetAll",oparm);
                    con.Close();
                    return ds.Tables[0];
                }
      

  4.   

    ORACLE存储过程中SELECT 语句要与INTO联合使用,也就是在存储过程中只能够给集合或变量赋值
      

  5.   

    过程里的查询的结果集只能是一个值,如果多值则必须要有相应的变量来接收.

    create ... 
    is 
    i varchar(20);
    begin
    select a.id into v_id from yourtable a;
    end;
    建议你还是找本书看看