如何使用匿名pl/sql块

百战天王 2010-04-22 10:49:24
比如这样一句
declare
vDEST_LOB blob;
n number;
Begin
select a.image into vDEST_LOB from tb_image a where a.id='123';
n:= DBMS_LOB.GetLength(vDEST_LOB);
end;

在CommandText里怎么设置参数,才能传出n?

...全文
106 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
百战天王 2010-04-23
  • 打赏
  • 举报
回复
在CommandText里怎么设置参数,才能传出语句里的结果n:= DBMS_LOB.GetLength(vDEST_LOB);
yuanhuiqiao 2010-04-23
  • 打赏
  • 举报
回复

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim oracleConnection1 As OracleConnection = New System.Data.OracleClient.OracleConnection()
oracleConnection1.ConnectionString = "user id=sb;data source=sbprod;password=sb"
Dim Procedure As String = "yourProcedure"
Dim dacommand As New System.Data.OracleClient.OracleCommand(Procedure, oracleConnection1)
oracleConnection1.Open()
dacommand.CommandType = CommandType.StoredProcedure

Dim inputParameter As New OracleParameter("vDEST_LOB", OracleType.Blob, 4)
inputParameter.Direction = ParameterDirection.Input
dacommand.Parameters.Add(inputParameter)
'inputParameter.Value = yourValue;
Dim outputParameter As New OracleParameter("n", OracleType.Number, 4)
outputParameter.Direction = ParameterDirection.Output
outputParameter.Value = "2"
dacommand.Parameters.Add(outputParameter)
dacommand.ExecuteNonQuery()

oracleConnection1.Close()
Catch
Throw
End Try
End Sub
zsuswy 2010-04-23
  • 打赏
  • 举报
回复
设置输出参数, outputparameter
百战天王 2010-04-23
  • 打赏
  • 举报
回复
顶一下
皇城龙三 2010-04-22
  • 打赏
  • 举报
回复
public   static   int   ExecuteNonQuery(string   commandText){   
private SqlCommand command = new SqlCommand();
command.Connection=new SqlConnection(connectionString);
if(command.Connection.State ==System.Data.ConnectionState.Closed)
{
command.Connection.Open();
}
command.CommandText = commandText;
int result=-1;
try{
result=command.ExecuteNonQuery(); }
catch (Exception e)
{
throw e;
}
finally
{
command.Connection.Close();
}
return result;
}

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧