레코드 세트를 리턴하는 Oracle 함수가 있습니다. Oracle 함수에 매개 변수를 도입했습니다. 이로 인해 프런트 엔드 코드가 엉망이되었습니다.Oracle 패키지에서 매개 변수 사용. ODP .NET
여기가 내 프런트 엔드 코드입니다.
OracleCommand od = oc.CreateCommand();
od.CommandType = System.Data.CommandType.Text;
od.CommandText = " select * from table(pkg_fetchPOInfo.getPORowsTable(:1,:2))";
//od.CommandText = "pkg_fetchPOInfo.getPORowsTable";
//od.CommandType = System.Data.CommandType.TableDirect;
OracleParameter op1 = new OracleParameter();
op1.ParameterName = "1";
op1.OracleDbType = OracleDbType.Varchar2;
op1.Direction = System.Data.ParameterDirection.Input;
op1.Size = 6;
op1.Value = strPONumber;
od.Parameters.Add(op1);
OracleParameter op2 = new OracleParameter();
op2.ParameterName = "2";
op2.OracleDbType = OracleDbType.Varchar2;
op2.Direction = System.Data.ParameterDirection.Input;
op2.Size = 3;
op2.Value = "US";
od.Parameters.Add(op2);
프런트 엔드 SQLPLUS에서 쿼리를 실행하면 레코드 세트를 얻습니다. 이 코드는 패키지 및 프런트 엔드 코드에서 매개 변수를 제거하면 작동합니다.
select * from table (pkg_fetchPOInfo.getPORowsTable ('1007446', 'US'))); SQLPLUS에서 작동합니다.
select * from table (pkg_fetchPOInfo.getPORowsTable()); - 두 곳에서 작동합니다.
매개 변수를 잘못 지정 했습니까?
한가지 더 : 내가 바인딩 매개 변수를 사용하지 않는 경우, 그것은이 함께 작동합니다 발견 암호. 문자열 형식 SQL = "테이블에서 선택 * (pkg_fetchPOInfo.getPORowsTable ('"+ strPONumber + "', 'US'))"; od.CommandType = System.Data.CommandType.Text; od.CommandText = formSQL; – abhi
'haywire'에 대해 더 자세히 설명하면 도움이 될 것입니다. –