I have a function which combine multiple parameters in a string if they're not null or empty. On specific parameters I use the % character for LIKE conditions. My problem is the format function which try to perform a transformation on it like if it was a parameter. How can I avoid this ?
I have 10+ tests on parameters and multiple LIKE. In the example below the second FORMAT function try to convert the % in TEST%
_nom_personne_like := 'TEST%';
_type_activite_personne := 'SOMETHING';
IF _nom_personne_like != '' THEN
_query := _query || ' AND personne_planning.nom_personne LIKE %L ';
_query := FORMAT(_query,_nom_personne_like);
END IF;
IF _type_activite_personne != '' THEN
_query := _query || ' AND personne_planning.type_activite = %L ';
_query := FORMAT(_query,_type_activite_personne);
END IF;`
The message returned by the server is : Conversion type specifier « ' » unrecognized I have already try to double the %, it doesn't work.