var myApp = myApp || {};
myApp.arrayObj = {
indexOf: function(myArray, searchTerm, property) {
for (var i = 0; i < myArray.length; i++) {
if (myArray[i][property] === searchTerm) return i;
}
return -1;
},
indexAllOf: function(myArray, searchTerm, property) {
var ai = [];
for (var i = 0; i < myArray.length; i++) {
if (myArray[i][property] === searchTerm) ai.push(i);
}
return ai;
},
lookup: function(myArray, searchTerm, property, firstOnly) {
var found = [];
var i = myArray.length;
while (i--) {
if (myArray[i][property] === searchTerm) {
found.push(myArray[i]);
if (firstOnly) break; //if only the first
}
}
return found;
},
lookupAll: function(myArray, searchTerm, property) {
return this.lookup(myArray, searchTerm, property, false);
},
remove: function(myArray, searchTerm, property, firstOnly) {
for (var i = myArray.length - 1; i >= 0; i--) {
if (myArray[i][property] === searchTerm) {
myArray.splice(i, 1);
if (firstOnly) break; //if only the first term has to be removed
}
}
},
removeByIndex: function(myArray, index) {
myArray.splice(index, 1);
}
};
以上代码连接到Oracle DB。执行Database.PackageName.StoredProcedure,即&#39; DB.JOB_REFRESH.ADD_MODIFIED&#39;并返回行以生成数据集&#39; ds&#39;。
这是PLSQL过程的一部分,它有一个游标输出参数,这个游标返回所有必须存储在数据集中的行&#39;。&#39;
Resource totalData = new Resource (ModelConstants.VIEWS, "Total Data"
DataSet dsParameters = DatabaseAccess.initParametersDataSet();
DataTable params = dsParameters.Tables["Parameter"];
DatabaseAccess.addParameter(ref params, "C_RECORDSET", ParameterDirection.Output, DatabaseAccess.TYPE_CURSOR);
DatabaseAccess.addParameter(ref params, Name, ParameterDirection.Input, DatabaseAccess.TYPE_VARCHAR, 30, Name.ToString());
DatabaseAccess.addParameter(ref params, Sql, ParameterDirection.Input, DatabaseAccess.TYPE_CLOB, 40, Sql.ToString());
DatabaseAccess.addParameter(ref params, Path, ParameterDirection.Input, DatabaseAccess.TYPE_VARCHAR, 1000, Path.ToString());
DatabaseAccess.addParameter(ref params, Empid, ParameterDirection.Input, DatabaseAccess.TYPE_VARCHAR, 20, Empid.ToString());
DataSet ds = mdbQry.get_cursor("DB.JOB_REFRESH.ADD_MODIFIED", dsParameters);
该程序已成功编译,并且没有任何问题。
我希望游标C_RECORDSET返回过程中的行。从Visual Studio调用此过程时,它应返回一个显示在数据网格上的有效数据集。
当我尝试在Visual Studio上执行时,当我在数据集中插入断点时,我得到以下错误&#39; ds&#39;:
PROCEDURE ADD_MODIFIED
(
I_NAME IN JOBS.NAME%TYPE,
I_SQL IN JOBS.SQL%TYPE,
I_PATH IN JOBS.PATH%TYPE,
I_EMP_ID IN JOBS.EMP_ID%TYPE,
C_RECORDSET OUT SYS_REFCURSOR
)
IS
BEGIN
OPEN C_RECORDSET FOR
SELECT NAME, STATUS FROM JOBS ORDER BY MORDER;
END;
END ADD_MODIFIED;
当我在PLSQL中执行相同的过程时,我收到以下错误:
Unable to retrieve data from the database. ORA-06550: line 1, column
15: PLS-00201: identifier 'DB.JOB_REFRESH' must be declared
ORA-06550: line 1, column 7: PL/SQL: Statement ignored
我是新手,所以请提供输入并指导我如何纠正这些错误并在&#39; ds&#39;中生成正确的数据集。