Using dbms_output.get_line in VB.NET

后端 未结 3 1136
心在旅途
心在旅途 2021-01-29 03:47

I have some stored procedures to execute that use dbms_output.put_line() to put data into the output buffer.

I know I need to use dbms_output.get_line

3条回答
  •  天涯浪人
    2021-01-29 04:21

    In C# I am using the next method:

        private string GetDbmsOutputLine()
        {
            OracleCommand command = new OracleCommand
            {
                Connection = ,
                CommandText = "begin dbms_output.get_line(:line, :status); end;",
                CommandType = CommandType.Text
            };
    
            OracleParameter lineParameter = new OracleParameter("line",  
                OracleType.VarChar);
            lineParameter.Size = 32000;
            lineParameter.Direction = ParameterDirection.Output;
            command.Parameters.Add(lineParameter);
    
            OracleParameter statusParameter = new OracleParameter("status",  
                OracleType.Int32);
            statusParameter.Direction = ParameterDirection.Output;
            command.Parameters.Add(statusParameter);
    
            command.ExecuteNonQuery();
    
            if (command.Parameters["line"].Value is DBNull)
                return null;
    
            string line = command.Parameters["line"].Value as string;
    
            return line;
        }
    

提交回复
热议问题