L
L
LazariusPaskalius2020-07-08 13:59:51
PostgreSQL
LazariusPaskalius, 2020-07-08 13:59:51

Is there a symbol for "any"?

Good afternoon, let's say I have a 4-parameter select query, but I don't know how many parameters I will have when I run the query, can I specify a "special character" like name='any' to make this parameter did not affect the results of the sample?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Adamos, 2020-07-08
@LazariusPaskalius

You can write name LIKE '%'
Only here it is important not to forget to put a candelabra next to it and stretch out your arms.

D
d-stream, 2020-07-08
@d-stream

classic:

...
where 
(@param1 is null or [email protected])
and
(@param2 is null or [email protected])
...
and
(@paramN is null or [email protected])

well, or wherever you like @paramM is null or fieldM like @paramM

M
MaLuTkA_UA, 2020-07-14
@MaLuTkA_UA

For such purposes, they came up with the coalesce function ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question