Procedure MariaDb input parameter for where clause

Certified Senior Developer

Trying to move the logic from query entity connecting to VW to Proc with input parameter and was able to create a Procedure on Maria DB . Challenge is trying to recreate includes operator logic for an column on proc using LIKE operator

but not able to achieve it 100%

currently got to an extend as below , there are multiple input paramter on WHERE clause and one below

AND ( input_parameter IS NULL OR input_parameter = '' OR REPLACE (LOWER(COLUMN_NAME),' ' , '')  LIKE REPLACE (LOWER(input_parameter),' ' , '') )

additional checks made

From Appian while passing the input parameter have also converted the input parameter to lower case and have appended %% before and after the string

Input parameter definition have set charset as per the column definition.

Still issue is value with alphanumeric value ending with number fails Ex: %abc1234_def4%. No result (actual record exists), but %abc1234_def% gives results 

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to ganeshbabuj

    In Appian, you only need to escape underscores
    Do not make any change to DB side and give a try.
    Let me know if that works for you.

    concat(
      "%",
      substitute(lower("abc1234_def4"), "_", "\_"),
      "%"
    )


    If this will not work give a try to make changes in DB as(Keep Above Appian Code as is for this)

    AND ( input_parameter IS NULL OR input_parameter = '' OR 
          REPLACE(LOWER(COLUMN_NAME), ' ', '') LIKE 
          REPLACE(LOWER(input_parameter), ' ', '') ESCAPE '\\' )


    If this doesn't work either, your data likely has trailing characters (spaces/tabs) after "4". Please verify the actual data structure.