1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Does Oracle field contain all letters from a string?

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 1, 2024 às 06:42.

  1. Stack

    Stack Membro Participativo

    There is a VARCHAR2 field in an Oracle table. It can contain combinations of letters in any order:

    • BOWLD
    • DLBWO
    • OWB
    • BW

    etc.

    Then I have another string as SQL query parameter. It also contains similar letters.

    I would like to detect whether the field contains ALL letters from the parameter or not.

    Example:

    Field Parameter Result
    BLWOD WB True
    OBLD BD True
    OBLD BDW False


    If it were just one letter in the parameter, I could simply use the LIKE clause:

    SELECT MyObjID FROM MyTable WHERE ColorField LIKE :ColorParam


    But what to do when I have to split the :ColorParam into letters and do multiple evaluations at a single time?

    Continue reading...

Compartilhe esta Página