Greetings,
I have the following bit of code as a property in a class:
Property ProductGroupsOnOrder As %String(COLLATION = "SQLUPPER") [ Calculated, SqlComputeCode = {
set InnvoiceNumber =
{InvoiceNumber}
set prodGrpId =
""
NEW SQLCODE
&sql(
DECLARE
C1 CURSOR FOR
SELECT
DISTINCT Part->ProductGroupId
INTO
:ProdGroupId
FROM
MVFILE.INVFT_LineItems
WHERE
INVFT = :InvoiceNumber
AND
PartNumber <> 'C'
ORDER
BY Part->ProductGroupId
)
&sql(OPEN C1)
&sql(FETCH C1)
While (SQLCODE = 0) {
set
prodGrpId = prodGrpId _ ProdGroupId _ ","
&sql(FETCH
C1)
}
set {*} = prodGrpId
}, SqlComputed ];
Which when selected gives me the following error:
Error: [C:\Program Files (x86)\Synametrics Technologies\WinSQL\Winsql.exe]
[SQLCODE: <-400>:<Fatal error occurred>]
[Cache Error: <<UNDEFINED>%0Berr+1^CacheSql2 *%qsct(15,3)>]
[Location: <ServerLoop - Query Fetch>]
[%msg: <Unexpected error occurred: <UNDEFINED>%0Berr+1^CacheSql2 *%qsct(15,3)>] (State:S1000, Native Code: 190)
I took virtually the same code and put it into a routine and it does what I expect:
set InvoiceNumber = "704504"
set prodGrpId = ""
NEW SQLCODE
&sql(
DECLARE C1 CURSOR FOR
SELECT DISTINCT Part->ProductGroupId
INTO :ProdGroupId
FROM MVFILE.INVFT_LineItems
WHERE INVFT = :InvoiceNumber
AND PartNumber <> 'C'
ORDER BY Part->ProductGroupId
)
&sql(OPEN C1)
&sql(FETCH C1)
While (SQLCODE = 0) {
set prodGrpId = prodGrpId _ ProdGroupId _ ","
&sql(FETCH C1)
}
&sql(CLOSE C1)
w prodGrpId
Any idea what I'm doing wrong in the property?
James Glaser
Software/Web Development Manager
Marco
3425 East Locust Street
Davenport, IA 52803
ph: 800.BLAST.IT (800.252.7848)
ph: 563.324.2519 - ext. 289
cell: 563.508.3351
fax: 563.324.5792
> www.marcousa.com<http://www.marcousa.com/>