Thursday, August 13, 2009

Oracle OLE property OraDatabase.LastServerErrText message capturing issue in VB 6.0

Hi,
I have an application which uses Oracle 9i and Visual Basic 6.0 (Front end). I am passing a user defined text message by using raise_application_error (-20700, error_desc) from Oracle 9i to Visual Basic 6.0. Here, Oracle may send up to 10000 characters to Visual Basic front end. I am capturing oracle error message (raised by raise_application_error procedure) in Visual Basic in below way i.e.
My Question:
-- Session creationSet OraSession = CreateObject ("OracleInProcServer.XOraSession")Set OraDatabase = OraSession.dbopendatabase(UserID.sOraSecDB, "XXXXX/XXXXX", 0&)

.
.
Public Sub Validate (dbConnection As Object, TSRPData As datTSRP_Record)
On Error GoTo ErrorGoTo StartError:sysError.HandleOracleError Err.Number, dbConnection
Resume throw_up
throw_up:
On Error GoTo 0
sysError.Raise
Start:
.
.
'Invoke Stored Procedure to validate the VCA of the Timed SRP
sSQL = "begin PA_ATD_ATS.PR_VALIDATE_TSRP (:pnTim_Srp_Id); end;"
.dbexecutesql sSQL
.
.
End Sub
After running above procedure PR_VALIDATE_TSRP, raise_application_error procedure will returns the error text message which is captured by user defined method "HandleOracleError"
Public Sub HandleOracleError (ErrNum As Variant, OraDatabase As Object)

If ErrNum = 440 Then
'OLE Error - i.e. Oracle Objects
ErrorovnSysErrorNumber = OraDatabase.LastServer
ErrovsSysErrorText = OraDatabase.LastServerErrText
End If
End Sub
In the above user defined method, OraDatabase.LastServerErrText captures only 532 characters. If raise_application_error returns more than 532 characters in the sense, OraDatabase.LastServerErrText captures only 532 characters and rest of characters are truncated. Please remember above coding is working fine. My only issue is that error truncation i.e OraDatabase.LastServerErrText not capturing more than 532 characters, and when I try in debug mode, if I try to print Err.description value after running PA_ATD_ATS.PR_VALIDATE_TSRP , it's also not capturing more than 532 characters. I guess OLE error object's LastServerErrText property NOT able to capture more than 532 characters. When I look at the LastServerErrText in oracle documentation , I don't see any limit is specified for method OraDatabase.LastServerErrText (
http://download.oracle.com/docs/cd/B19306_01/win.102/b14309/serprop.htm#CHDIBDGF )Is there any limit OLD object LastServerErrText can capture only this much characters ( 532 characters)?, and Please guide me how i can make the adjustment to capture more than 532 characters by using same OLE object method. My user looking to see at least 10,000 characters, he does not want to see that error message truncation.
Regards,
Thambi
I have got the reply from Guru of that forum as below :

Hi,
I tested 11g, and see 511 as the max. I'd assume this is an undocumented limitation of LastServerErrText, as I wasn't able to find it in the docs. Although it seems odd to me that you'd want to return that much data in an error message, if you have a requirement for that you might consider storing the data in a table instead, and querying the table after receiving notification of the problem.
Hope it helps
Greg
My final reply is:
Yes, I created error table and loaded the error message into it. It does work. Thanks a lot for your help but I am still surprised that oradatabase.LastServerErrText property is not allowing more than 532 characters
Regards,
Thambi

No comments:

Post a Comment