Home > database >  In PL/SQL function with a return value how call in c #?
In PL/SQL function with a return value how call in c #?

Time:09-27

In PL/SQL function and its parameters are as follows:
PACKAGE: U1BP pxf000bdzrf
The FUNCTION getEcCheckBDW31 (
P_co VARCHAR2, IN==& gt; The company
P_empid VARCHAR2, IN==& gt; Staff code
P_boffid VARCHAR2, IN==& gt; Poor fake code
P_frday VARCHAR2, IN==& gt; Leave a day
P_frhh VARCHAR2, IN==& gt; Leave when
P_today VARCHAR2, IN==& gt; Leave to effect,
P_tohh VARCHAR2, IN==& gt; Leave to effect when
P_dys NUMBER, IN==& gt; Days
P_hrs NUMBER, IN==& gt; Count
P_nl VARCHAR2, IN==& gt; NL record, N is normal, L said delete
P_odupz VARCHAR2, IN==& gt; Attendance factory
P_odudp VARCHAR2, IN==& gt; Attendance department
P_ajmk VARCHAR2, IN==& gt; Adjust the note
P_boffidclass VARCHAR2) IN==& gt; Poor fake code categories, fixed for BOFFID
RETURN VARCHAR2 OUT==& gt; The error message returned


I wrote the corresponding c # code is as follows:
Public static void ChaiJiaDan (int flag, string strName, params Object [] ¶s) introduced into ERP//the main table method, takes two parameters, the first is the documentation provided by the ERP stored procedure
{
Constring [0]="server=BHHG; Uid=u1bs2; The PWD=u1bs2 ";
Constring [1]="server=bhzy; Uid=u1bs2; The PWD=u1bs2 ";
Constring [2]="server=BHFD; Uid=u1bs2; The PWD=u1bs2 ";
Constring [3]="server=BHGJ; Uid=u1bs2; The PWD=u1bs2 ";
//receive the second parameter is an array, the array is the corresponding form field inside the
Using (OracleConnection conn=new OracleConnection (constring [flag]))//database connection string
{

OracleCommand CMD=new OracleCommand (strName, conn);//create a statement execution object
OracleParameter para=new OracleParameter [] []
{
New OracleParameter (" p_co, "OracleType VarChar),//the following fields for ERP to receive, be consistent with the document
New OracleParameter (" p_empid, "OracleType VarChar),
New OracleParameter (" p_boffid, "OracleType VarChar),
New OracleParameter (" p_frday, "OracleType VarChar),
New OracleParameter (" p_frhh, "OracleType VarChar),

New OracleParameter (" p_today, "OracleType VarChar),
New OracleParameter (" p_tohh, "OracleType VarChar),
New OracleParameter (" p_dys, "OracleType. Number),
New OracleParameter (" p_hrs, "OracleType. Number),
New OracleParameter (" p_nl, "OracleType VarChar),

New OracleParameter (" p_odupz, "OracleType VarChar),
New OracleParameter (" p_odudp, "OracleType VarChar),
New OracleParameter (" p_ajmk, "OracleType VarChar),
New OracleParameter (" p_boffidclass, "OracleType VarChar)


};

For (int I=0; i <¶s. Length; I++)
{

Para [I]. [I] Value=https://bbs.csdn.net/topics/paras.

}

CMD. The Parameters. AddRange (para);

OracleParameter res=new OracleParameter (" wrk_message, "OracleType VarChar, 100);
Res. Direction=ParameterDirection. ReturnValue;
Cmd.Com mandType=CommandType. StoredProcedure;
conn.Open();
CMD. ExecuteNonQuery ();//implement the ERP operation
String temp=res. Value. The ToString ();

If (temp!="")//determine whether operation success
{
Throw new Exception (the string. Format (" not performed successfully, error code is {0} ", temp));
}
Conn. Close ();
}

}

Execution is always an error! Say "is not a procedure or function undefined"
Pray god to help solve!

CodePudding user response:

A function call, want to use

The select fn (parameters 1, 2,,,) from dual

Write a function name directly, like to execute a stored procedure,

CodePudding user response:

The building Lord, your main method calls, with the lack of getEcCheckBDW31
  • Related