近日遇到客户反映在Business Operation中使用SQL Outbound Adapter调用Oracle存储过程时,无法获取CLOB完整的返回内容。借此在这里介绍下该如何调用,话不多说,直接上代码。
注意,以下代码片段直接应用于Business Operation中,
set pIn = 4
set pIn(1) = "aaaa"
set pIn(1,"IOType") = 1 // 1:input , 4:output
set pIn(1,"SqlType") = 12 // 12: varchar
set pIn(2,"IOType") = 4
set pIn(2,"SqlType") = 4 // 4: integer
set pIn(3,"IOType") = 4
set pIn(3,"SqlType") = 12
set pIn(4,"IOType") = 4
set pIn(4,"SqlType") = 2005 // CLOB
set pIn(4,"LOB") = 1
set tQuery = "{ call test_hc(?,?,?,?) }" /// the first one parameter is input parameter, the last three are all output parameters.
set tSC = ..Adapter.ExecuteProcedureParmArray(.tRS,.pOut,tQuery,"iooo",.pIn)
set cnt = pOut.Count()
// you will get this stream data
if cnt >1
{
for i=1:1:cnt
{
set ov = pOut.GetAt(i))
$$$TRACE("pOut("_i_")="_ov)
/// the third one is the CLOB output.
if (i = 3)
{
while 'ov.AtEnd
{
$$$TRACE(ov.Read())
}
}
}
}