Missing/Invalid SQL statement'E(3707):Syntax error, expected something like ';'

Database

Missing/Invalid SQL statement'E(3707):Syntax error, expected something like ';'

Hi  i need help pls.

I have the next error to execute a query to created a procedure:

SPL1027:E(L256), Missing/Invalid SQL statement'E(3707):Syntax error, expected something like ';' between a string or a Unicode character literal and the integer '1'.'.

SET StringSQL=
'
CREATE MULTISET VOLATILE TABLE notas6, NO LOG AS(
SELECT a.*, CodTipoPC, TipoPC, CodSubTipoPC, SubTipoPC
FROM notas5 a
LEFT JOIN (SELECT a.FacturaID, a.SubcripcionID, c.SubLineaProductoCD CodTipoPC, c.SubLineaProductoDesc TipoPC, c.ClasificacionProductoCD CodSubTipoPC, c.ClasificacionProductoDesc SubTipoPC
FROM notas5 a
INNER JOIN vwSuscripcionProducto b ON a.SubcripcionID = b.suscripcionid
INNER JOIN vwJerarquiaProducto c ON b.productoid=c.productoid
WHERE b.fechainicio<=a.fechafactura
--and b.fechafin>a.fechafactura
AND SublineaProductoCD IN ('1','2','3','4','5','15','31')
AND ProductoCD NOT IN ('340','384','448','449','453','454','455','966','967','968','999')
QUALIFY(ROW_NUMBER()OVER (PARTITION BY b.suscripcionid,a.facturaid ORDER BY b.fechainicio DESC))=1
) b
ON a.SubcripcionID = b.SubcripcionID AND a.facturaid = b.facturaid
)
WITH DATA
PRIMARY INDEX(cuentafacturacionid,SubcripcionID)
ON COMMIT PRESERVE ROWS;
;'

I do not understand what i must make?

Ths

2 REPLIES
Junior Contributor

Re: Missing/Invalid SQL statement'E(3707):Syntax error, expected something like ';'

Every single quote within a string must be doubled:

                   AND SublineaProductoCD IN (''1'',''2'',''3'',''4'',''5'',''15'',''31'')
AND ProductoCD NOT IN (''340'',''384'',''448'',''449'',''453'',''454'',''455'',''966'',''967'' ,''968'',''999'')

Re: Missing/Invalid SQL statement'E(3707):Syntax error, expected something like ';'

Excellent.. Ths