Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2008 在Oracle中使用存储过程检索长数据类型_Visual Studio 2008_Stored Procedures_Oracle11g - Fatal编程技术网

Visual studio 2008 在Oracle中使用存储过程检索长数据类型

Visual studio 2008 在Oracle中使用存储过程检索长数据类型,visual-studio-2008,stored-procedures,oracle11g,Visual Studio 2008,Stored Procedures,Oracle11g,在Oracle数据库中检索长数据类型的数据时遇到问题。以前,当特定列是VARCHAR2类型时,它可以正常工作,但是因为我需要更多的空间来存储更大的数据,所以我决定改用LONG类型 我使用存储过程检索数据,下面的代码从C#调用存储过程: 我试图使用issueId作为主键在ISSUES表中获取包含15列的完整行,但检索具有长数据类型的列时遇到问题,具体来说,我无法从中检索数据。正如我所说,在它的类型为VARCHAR2之前,没有任何问题,代码工作得非常好。我在这里遗漏了什么,或者长数据类型有什么问题吗

在Oracle数据库中检索长数据类型的数据时遇到问题。以前,当特定列是VARCHAR2类型时,它可以正常工作,但是因为我需要更多的空间来存储更大的数据,所以我决定改用LONG类型

我使用存储过程检索数据,下面的代码从C#调用存储过程:

我试图使用issueId作为主键在ISSUES表中获取包含15列的完整行,但检索具有长数据类型的列时遇到问题,具体来说,我无法从中检索数据。正如我所说,在它的类型为VARCHAR2之前,没有任何问题,代码工作得非常好。我在这里遗漏了什么,或者长数据类型有什么问题吗?如果是,可能的解决办法是什么?如果可能,我仍然希望使用LONG数据类型而不是其他类型


另外,我使用的是Visual Studio 2008和Oracle 11g。

LONG
从8.1.5天开始就被弃用,并且有一些限制<应不惜一切代价避免代码>长

如果要存储超过4000字节(12c中为32000字节)的文本数据,则需要使用
CLOB
,而不是
LONG

internal static Issue GetIssueById(int issueId)
    {
        List<OracleParameter> p = new List<OracleParameter>();

        // params
        p.Add(new OracleParameter("p_IssueId", OracleDbType.Varchar2, issueId, ParameterDirection.Input));
        p.Add(new OracleParameter("p_Cursor", OracleDbType.RefCursor, ParameterDirection.Output));

        // perform get
        using (DataTable dt = OracleDataAccessor.ExecuteDataTable(
            ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString,
            CommandType.StoredProcedure,
            "sp_Issues_GetByIssueId",
            p.ToArray()))
        {
            if (dt.Rows.Count < 1)
            {
                // could not get new id
                throw new Exception("Could not find issue with Id: " + issueId);
            }
            else
            {
                // get new Issue
                return new Issue(dt.Rows[0]);
            }
        }
 create or replace 
Procedure sp_Issues_GetByIssueId
(
       p_IssueId IN Number,
       p_Cursor OUT Sys_RefCursor
)
IS

BEGIN

  OPEN p_Cursor FOR
  SELECT * FROM Issues i
  WHERE i.IssueId = p_IssueId;

END sp_Issues_GetByIssueId;