Skip to content
Advertisement

postgres – Passing variable to not like operator

We have tables name with Date fields, Like table_name_yyyy_mm_dd. Wanted to analyze tables older than two days using procedure and come up with below proc. But Looks like select command with not like expression is not picking up the tables older than two days, instead its picking all tables. what am i doing wrong. Please suggest.

Advertisement

Answer

Don’t enclose the variable name in single quotes. It’s also better to use format() when generating dynamic SQL

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement