Re: execute SPL in 4gl
Posted in 1998
jjdai07@my-dejanews.com wrote: > > Hi, > > Thanks in advance ! > My question is I create a Stored Procedure on online 5 . > this procedure need 4 input arguments and return 1 value . > In my 4gl , I prepared the statement and execute it , > but the c4gl told me error . > can you tell me why . > > My code : > > LET procedure_str = " EXECUTE PROCEDURE " , > " get_tts( ? , ? , ? , ? ) INTO ? " > PREPARE procedure_state FROM procedure_str > LET s_dow=WEEKDAY(s_sdtpu) > EXECUTE procedure_state USING s_sorig,s_sdest,s_dow,s_sprod INTO tts > > Compile Error is > LET procedure_str = " EXECUTE PROCEDURE " , > " get_tts( ? , ? , ? , ? ) INTO ? " > PREPARE procedure_state FROM procedure_str > LET s_dow=WEEKDAY(s_sdtpu) > EXECUTE procedure_state USING s_sorig,s_sdest,s_dow,s_sprod INTO tts > |_______________________________________________________________________^ > | > | A grammatical error has been found on line 310, character 73. > | The construct is not understandable in its context. > | See error number -4373. > Unfortunately, you need to do something more complex as 4GL (versions before 7.2) do not understand EXECUTE PROCEDURE ... INTO. The manual is not very clear on this :-(. Do this: LET procedure_str = " EXECUTE PROCEDURE " , " get_tts( ? , ? , ? , ? )" PREPARE procedure_state FROM procedure_str DECLARE cursor_state FROM procedure_state OPEN cursor_state USING s_sorig, s_sdest, s_dow, s_sprod FETCH cursor_state INTO tts CLOSE cursor_state FREE procedure_state FREE cursor_state Phew! -- Peter Lancashire Information Systems Specialist, Bayer plc Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK Tel: +44-1635-562258, Fax: +44-1635-562281 --- If all else fails, read the instructions. All opinions are my own and not those of Bayer plc. My Internet plumbing does not allow me to mail and post news together. Sorry. --- Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/