Need help with Stored Procedure (SPL)
Posted in 1998
Topics: Stored Procedures & SPL
This is a multi-part message in MIME format. ------=_NextPart_000_0067_01BD5EE4.0DE7EE60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Please I need help with this : Im trying to construct a Store Procedure that contains a dynamic QUERY = like this: let WDWHERE =3D "1 =3D 1"; let WDSQL =3D "select a.entry from t2sales a where", "trc_type <> 'R' and ", "yymm =3D '", ps_period ,"' and", WDWHERE, "and exists (select * from t6sales where yymm=3Da.yymm", "and entry=3Da.entry and line=3Da.line and ncupon=3D1", "and (loc_from=3D'SDQ' and loc_from=3D'POP'))", "order by entry"; -- prepare nuevo from WDSQL -- declare in_curs cursor for nuevo -- foreach in_curs into w_entry -- <Do Something Here> -- end foreach; but the commented sentences doesnt work, the error i got is : "Syntax = Error". Does it is permited in SPL? if not what could i do? Thanks ____________________________ Jes=FAs D=EDaz Avila Trans Solutions Systems S.A. Telf : (511) 241-0110 Fax : (511) 446-5579 E-Mail : pcsijdia@upc.edu.pe ____________________________ ------=_NextPart_000_0067_01BD5EE4.0DE7EE60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD> <META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type> <META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV>Please I need help with this :<BR><BR>Im trying to construct a = Store=20 Procedure that contains a dynamic QUERY like<BR>this:<BR><BR>let WDWHERE = =3D=20 "1 =3D 1";<BR>let WDSQL =3D "select a.entry from t2sales = a=20 where",<BR> &nb= sp; =20 "trc_type <> 'R' and=20 ",<BR> &n= bsp;=20 "yymm =3D '", ps_period ,"' and",=20 WDWHERE,<BR> &= nbsp;=20 "and exists (select * from t6sales where=20 yymm=3Da.yymm",<BR> &= nbsp; =20 "and entry=3Da.entry and line=3Da.line and=20 ncupon=3D1",<BR> &nbs= p; =20 "and (loc_from=3D'SDQ' and=20 loc_from=3D'POP'))",<BR> &n= bsp; =20 "order by entry";<BR><BR>-- prepare nuevo from WDSQL<BR>-- = declare=20 in_curs cursor for nuevo<BR>-- foreach in_curs into w_entry<BR>-- <Do = Something Here><BR>-- end foreach;<BR><BR>but the commented sentences = doesnt=20 work, the error i got is : "Syntax Error". Does it is permited = in SPL?=20 if not what could i=20 do?<BR><BR>Thanks<BR>____________________________<BR>Jesús = Díaz=20 Avila<BR>Trans Solutions Systems S.A.<BR>Telf : (511) 241-0110<BR>Fax : = (511)=20 446-5579<BR>E-Mail : <A=20 href=3D"mailto:pcsijdia@upc.edu.pe">pcsijdia@upc.edu.pe</A><BR>__________= __________________<BR> </DIV></BODY></HTML> ------=_NextPart_000_0067_01BD5EE4.0DE7EE60--