NULL concatenation

Поиск
Список
Период
Сортировка
От Sridhar N Bamandlapally
Тема NULL concatenation
Дата
Msg-id CAGuFTBXvRur3GeSAk_hNOiMdKcLAtqrpxh8PEBXGpSUxygphWw@mail.gmail.com
обсуждение исходный текст
Ответы Re: [HACKERS] NULL concatenation  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: NULL concatenation  (Tim Clarke <tim.clarke@manifest.co.uk>)
Re: NULL concatenation  (Adam Pearson <adam.pearson@realisticgames.co.uk>)
Список pgsql-general
Hi

In migration, am facing issue with NULL concatenation in plpgsql, 
by concatenating NULL between any where/position to Text / Varchar, the total string result is setting value to NULL


In Oracle:

declare
    txt1 VARCHAR2(100) := 'ABCD';
    txt2 VARCHAR2(100) := NULL;
    txt3 VARCHAR2(100) := 'EFGH';
    txt VARCHAR2(100) := NULL;
begin
  txt:= txt1 || txt2 || txt3;
  dbms_output.put_line (txt);
end;
/

abcdefgh   ===>return value



In Postgres

do $$
declare
    txt1 text := 'ABCD';
    txt2 text := NULL;
    txt3 text := 'EFGH';
    txt text := NULL;
begin
    txt:= txt1 || txt2 || txt3;
    raise notice '%', txt;
end$$ language plpgsql;

NOTICE:  <NULL>  ===> return value


SQL-Server also does same like Oracle

Is there any way alternate we have for same behavior in PostgreSQL

Please

Thanks
Sridhar
OpenText

В списке pgsql-general по дате отправления:

Предыдущее
От: Andreas Joseph Krogh
Дата:
Сообщение: Re: index on ILIKE/LIKE - PostgreSQL 9.2
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: [HACKERS] NULL concatenation