Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when creating a cursor

Status
Not open for further replies.

Niki_S

Programmer
Jun 4, 2021
232
0
0
LK
Code:
create cursor ReportCursor(cBatchNo c(20) NULL,nPoDtlID n(10,2) NULL,cBatchNo c(20) NULL,nBatchInvId n(10,2) NULL)

I used this and when I run this it says Field name is a duplicate or invalid.
Why is that?
 
Yes, you have two cBatchNo fields, that's not possible, field names must differ.

Chriss
 
Thank you chriss, I stupidly missed that [bigsmile]
 
Can you please give me a solution for this too?
Code:
SELECT Batch_no
SCAN
TEXT TO stra NOSHOW
SELECT cBatchNo,nPoDtlID,cPoLine,nBatchInvId,nSuplID,cSuplName,cPaymentCurr,nInvValue,nConvRate,cTag FROM MAS.dbo.vAcp_All_InvDtl WHERE  nPoDtlID=?Batch_no.nPoDtlID  AND cBatchNo NOT in (select cBatchNo from MAS.dbo.Acp_FinalPayment)
ENDTEXT

Use In Select('tempOutstanding')

SELECT Batch_no 
SCAN 
	SQLEXEC(hndOps,stra,'_TempO') 
  If NOT Used('tempOutstanding')
     Select * From  _TempO Into Cursor tempOutstanding READWRITE 
  Else
     SELECT tempOutstanding
     APPEND FROM DBF('_TempO') 
  Endif
ENDSCAN 
ENDSCAN

This is my code and when I use this code it takes more time to get my output. How can I get my output in less time?
Thank you.
 
Have you tested your query in the IDE for whichever server product you're using to see how fast it runs there? That is, is the issue in the query itself or in how you're processing the result when you get it back?

Assuming it's the server, use whatever tools it has for performance tuning to improve your query.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top