Store Procedure - fieldnames error

Dear all,

I have the following SP (Oracle)

PROCEDURE Obtener_Agente(

p_nIdePol Poliza.IdePol%TYPE,

p_rAgente OUT rCursor) IS

BEGIN

OPEN p_rAgente FOR

SELECT /* <013013-1> Costo = 9 */ p.IdePol IdePol, p.NumPol NumPol, pi.CodInter CodInter,

  t.NomCorTer NomCorTer

FROM Poliza p, Part_Inter_pol pi, Intermediario i, Tercero t

WHERE p.IdePol = p_nIdePol

  AND p.IdePol = pi.IdePol

  AND pi.CodInter = i.CodInter

  AND i.TipoId = t.TipoId

  AND i.NumId = t.NumId

  AND i.DvId = t.DvId;

EXCEPTION

WHEN OTHERS THEN

RAISE_APPLICATION_ERROR(-20100,SQLERRM);

END Obtener_Agente;

What I want to do is execute this sp using LS. So I do this:

Sub Initialize

Dim input_fieldlist As New LCFieldList

Dim output_parms As New LCFieldlist



Dim in_field_int As New LCField (1, LCTYPE_INT)



Dim out1 As New LCField (1, LCTYPE_INT)

Dim out2 As New LCField (1, LCTYPE_TEXT)

Dim out3 As New LCField (1, LCTYPE_TEXT)

Dim out4 As New LCField (1, LCTYPE_TEXT)



Dim out As Double			



Call SetupLSX	



If Not comunicadoLSX Then

    	Print "Error en la conexión al Oracle"

	Exit Sub

End If



ConnLSX.Procedure = "PR_WEBSIN_CONS.Obtener_Agente"	

ConnLSX.Fieldnames = "IdePol, NumPol, CodInter, NomCorTer"





'set the input parameters of the stored procedure...			

Set in_field_int = input_fieldlist.Append ("p_nIdePol", LCTYPE_INT)

in_field_int.Value = 402071





'with the input parameters set, call the stored procedure...

'the declared output_parms fieldlist will hold the output parameters of the stored procedure...

out = ConnLSX.Call (input_fieldlist, 1, output_parms)

'fetch parameter(s) into the output_parms fieldlist...

out = ConnLSX.Fetch (output_parms)



'retrieve the parameter(s) from the output_parms fieldlist...

Set out1 = output_parms.GetField (1)

Set out2 = output_parms.GetField (2)



'use the output parameter value(s) in your script...

Print "Output parameter 1 is " & out1.Value(0)	

Print "Output parameter 2 is " & out2.Text(0)	

Errores:

Print "Error" & Str(Err) & ": " & Error$ & " on line " & Cstr(Erl)	

Exit Sub	

End Sub


But in the statement:

ConnLSX.Fieldnames = “IdePol, NumPol, CodInter, NomCorTer”

I get an error:

Error 12809: Error: Invalid field ‘IdePol’, Connector ‘oracle’, Mehtod -Call

→ IdePol IS one of the names of the Select instruction in the SP…So what is wrong?

My question is :

Is it a problem of the statement?

How do I retrieve what the SP returns, a cursor in my case?

I would really appreciate any suggestion.

kind of desperate

regards

Olga

Subject: RE: Store Procedure - fieldnames error

I don’t see an obvious problem, but I have some observations:

The error is occurring on the call to Call method, not on the line you said. While it might be the cause of the problem, it’s not where the error occurs.

There doesn’t seem to be any reason to use the Fieldnames property here, since you’re retrieving all the fields of the procedure output anyway. Try leaving the line off.

Subject: RE: Store Procedure - fieldnames error

Dear Andre,I put that line away…but now I have the following: “Agent done”…it seams that now it works, but I how do I retrieve the data after the Call method? I used Fetch method, but it doesn’t work either.

Please, anybody help me…I beg u all

Olga

The code:

Dim  fldLstRecord As  LCFieldList	

Dim sql As String

Dim total As Variant

Dim result As Integer		

Dim cadena As String

Dim count As Long

Dim lcflResult_l As New LCFieldList

Dim input_fieldlist As New LCFieldList

Dim output_parms As New LCFieldlist

Dim iCounter_l As Double

Dim lcfParameter_l As LCField

Dim lcflParameters_l As New LCFieldList



Dim out1 As New LCField (1, LCTYPE_INT) '---



Call SetupLSX	







Set lcfParameter_l=lcflParameters_l.Append("p_nIdePol", LCTYPE_INT)

lcfParameter_l.Value=402071

ConnLSX.Procedure = "PR_WEBSIN_CONS.Obtener_Agente"



iCounter_l = ConnLSX.Call(lcflParameters_l, 1, lcflResult_l)			

iCounter_l = ConnLSX.Fetch (lcflResult_l)  

Set out1 = lcflResult_l.GetField (1)  

Print out1.Value 

ConnLSX.disconnect

Subject: RE: Store Procedure - fieldnames error

You’re getting some kind of error. You don’t show your error trapping code, but I thought you must have some since you knew the error number for the error you were getting before.

I see a problem in this line: Print out1.Value since LCField.Value returns an array. There may be other errors. Read this article to see how to report those errors.