Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    16

    Unanswered: variable base substring

    Hi all,

    I am trying to write a procedure to decode a message, but I'm running into a problem when I'm doing substring based on variable holding the start position or variable holding the length. I'm doing the following:

    CREATE PROCEDURE (code VARCHAR(100))
    DEFINE xi INTEGER;
    DEFINE tag CHAR(4);
    LET xi = 1;
    LET tag = ex_emv_params[xi,4];
    END PROCEDURE

    When I run it I get a syntax error (-201) on the LET tag = ex_emv_params[xi,4]; line (where xi is present). If I change the xi to 1 it works....
    Anyone knows work around?

    Thanks,

    Tal

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780
    Hi,

    Please test:

    CREATE PROCEDURE (code VARCHAR(100))
    RETURNING varchar(4);
    DEFINE xi INTEGER;
    DEFINE tag CHAR(4);
    LET xi = 1;
    LET tag = substr(ex_emv_params,xi,4);
    RETURN tag
    END PROCEDURE

    Gustavo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •