Re: SUMMARY: subscripts in stored procedures.
Posted in 1998
varchar exists since at least 4.1 according to my 4.1 manual.
dsl@one.net wrote:
>
> Many responses, only one solution, courtesy of
> >From: "John H. Frantz" <john@rl.is>
>
> unfortunately, in my 5.03 Informix, varchars havent been invented yet.
>
> >
> >June Tong provided the following clever solution which is in the FAQ
> >(http://www.iiug.org/techinfo/faq):
> >
> >--
> >-- Procedure: GetCharAt()
> >-- Get a character from a string at a specified position.
> >--
> >DROP PROCEDURE GetCharAt;
> >CREATE PROCEDURE GetCharAt(str VARCHAR(255), pos INTEGER)
> > RETURNING VARCHAR(1);> > DEFINE i INTEGER;
> >
> > IF pos > 1 THEN
> > FOR i = 2 TO pos
> > LET str = str[2,255];
> > END FOR;
> > END IF
> > RETURN str[1,1];
> >END PROCEDURE;
> >
> >----------------------------------------------------------------------
> >John H. Frantz Power-4gl: Extending Informix-4gl
> >john@rl.is http://www.rl.is/~john/pow4gl.html
> >
> >