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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Currency not on a record - perv9.5 error ( works in Firebird)

Status
Not open for further replies.

davemeng

Technical User
Dec 27, 2006
5
US
i get that error when running this SQL statement in pervasive 9.5

the object is to return 12 records with sum sales for each month, with a different column for last year and this year such that
salesperson, month, lastYTD, CurrYTD.

SELECT ARH.BKAR_INV_SLSP, MONTH(ARH.BKAR_INV_INVDTE) AS MO,
( SELECT
SUM(ARH1.BKAR_INV_SUBTOT)
FROM BKARHINV ARH1
WHERE ARH1.BKAR_INV_SLSP=ARH.BKAR_INV_SLSP AND ( MONTH(ARH1.BKAR_INV_INVDTE) = MONTH(ARH.BKAR_INV_INVDTE) )
AND (ARH.BKAR_INV_INVDTE>= '2005-01-01' AND ARH.BKAR_INV_INVDTE<= '2005-12-31')
)AS LYTD,
( SELECT
SUM(ARH2.BKAR_INV_SUBTOT)
FROM BKARHINV ARH2
WHERE ARH2.BKAR_INV_SLSP=ARH.BKAR_INV_SLSP AND ( MONTH(ARH2.BKAR_INV_INVDTE) = MONTH(ARH.BKAR_INV_INVDTE) )
AND (ARH.BKAR_INV_INVDTE>= '2006-01-01' AND ARH.BKAR_INV_INVDTE<= '2006-12-31')
)AS CYTD
FROM BKARHINV ARH
WHERE ARH.BKAR_INV_SLSP=25 AND (ARH.BKAR_INV_INVDTE>= '2005-01-01' AND ARH.BKAR_INV_INVDTE<= '2006-12-31')
GROUP BY ARH.BKAR_INV_SLSP, MONTH(ARH.BKAR_INV_INVDTE) #

i tested this for grins in a firebird database to see if my SQL was messed up. but it worked!so i'm sure it's the difference in SQL functions.

if i understand the error, i think because it's performing the subquery, once or twice doesn't matter, but the cursor, or knowing what record the db engine is reading gets CONFUSED, or LOST.

soooooo, does any one know of a way i can work around this? i plan on using it in a Stored Procedure and it must be in Pervasive 9.5

thank you for any ideas forthcoming!

dave
 
I would suggest opening a support ticket with Pervasive if you don't get any response.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top