Re: [HACKERS] NULL concatenation
От | Sridhar N Bamandlapally |
---|---|
Тема | Re: [HACKERS] NULL concatenation |
Дата | |
Msg-id | CAGuFTBVKmcFBV9gXaR-0qKsam4GP_GA4MsyBV_YZwaQwmYzWmg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] NULL concatenation (Pavel Stehule <pavel.stehule@gmail.com>) |
Список | pgsql-general |
Thanks Pavel
Great !!
I was thinking both || and CANCAT does same
Thanks again
-
Sridhar
OpenText
On Thu, May 12, 2016 at 2:22 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
Hi2016-05-12 10:47 GMT+02:00 Sridhar N Bamandlapally <sridhar.bn1@gmail.com>:HiIn 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 NULLIn Oracle:declaretxt1 VARCHAR2(100) := 'ABCD';txt2 VARCHAR2(100) := NULL;txt3 VARCHAR2(100) := 'EFGH';txt VARCHAR2(100) := NULL;begintxt:= txt1 || txt2 || txt3;dbms_output.put_line (txt);end;/abcdefgh ===>return valueIn Postgresdo $$declaretxt1 text := 'ABCD';txt2 text := NULL;txt3 text := 'EFGH';txt text := NULL;begintxt:= txt1 || txt2 || txt3;raise notice '%', txt;end$$ language plpgsql;NOTICE: <NULL> ===> return valueSQL-Server also does same like OracleIs there any way alternate we have for same behavior in PostgreSQLuse function concat http://www.postgresql.org/docs/9.5/static/functions-string.html
postgres=# select concat('AHOJ', NULL,'XXX');
concat
---------
AHOJXXX
(1 row)RegardsPavelPleaseThanksSridharOpenText
В списке pgsql-general по дате отправления: