postgresql - CASE types integer and text cannot be matched Postgres -


declare         pop  character varying;     begin        execute 'select case(select exists(select count(case_reported) qwe week = '' weekk  '' , code = ''  codee ''  , case_type= '' case_type '' having count(case_reported) > 0 ) )           when true               (select case(count(case_reported))                          when 1                                                                (select case(case_reported)                                        when 1                                              1::varchar                                        when 0                                              ''zr''::varchar                                        end                                  qwe week = '' weekk  '' , code = '' codee '' , case_type= '' case_type '')                              else                                   count(case_reported)::text                          end                      qwe week = '' weekk  '' , code = '' codee '' , case_type= '' case_type '')                    else 0 end' pop;     return pop;     end; 

error: case types integer , text cannot matched.

pop,week,code of type character varying , case_type of text

declare         pop  character varying;     begin        execute 'select case(select exists(select count(case_reported) qwe week = '' weekk  '' , code = ''  codee ''  , case_type= '' case_type '' having count(case_reported) > 0 ) )           when true               (select case(count(case_reported))                          when 1                                                                (select case(case_reported)                                        when 1                                              1::text                                        when 0                                              ''zr''::text                                        end                                  qwe week = '' weekk  '' , code = '' codee '' , case_type= '' case_type '')                              else                                   count(case_reported)::text                          end                      qwe week = '' weekk  '' , code = '' codee '' , case_type= '' case_type '')                    else 0::text end' pop;     return pop;     end; 

this solved error


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -