Highlighted
Absent Member.
Absent Member.
332 views

Retrieve data of datatype CLOB from database using UFT

Hi,

I am struck with the below scenario using UFT.

I am able to connect to database and able to retrieve the data from database using UFT. But for one table which is having the datatype as CLOB, UFT is throwing error as "datatype not macth". Please let me know if it is possible to retrieve the data which is having the CLOB datatype if yes, let me know the logic or provide the code to retrieve the data.

Tried with below code:

Public Function cfn_FetchCLOBData( ByVal strQuery )

    Dim Conn

    Dim rs

    Set Conn = CreateObject("ADODB.Connection")

    Conn.Open "DSN=NRST;uid=nrs;pwd=nrs"

    Set rs= Conn.Execute(strQuery) 

    garrCLOBData=Split(cfn_ReadCLOB(rs.Fields(0)),vbLF) // throwing error and unable to call the function

    rs.Close

    Set rs = Nothing

    Conn.Close

    Set Conn = Nothing

 

    If Err.Number = 0 Then

         cfn_FetchCLOBData=True

    Else

          cfn_FetchCLOBData=False

    End If    

End Function

 

Public function cfn_ReadCLOB ( ByVal prsTemp)

   Dim intBlockSize

   Dim strTemp

   Dim strData

   intBlockSize=16384

   Do

       strTemp =prsTemp.GetChunk(intBlockSize)

       If IsNull(strTemp) Then Exit Do

       strData = strData & strTemp  

       Loop While Len (strTemp) = intBlockSize

       cfn_ReadCLOB=strData

End Function

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.