NULL values and string

Поиск
Список
Период
Сортировка
От Sergey Karin
Тема NULL values and string
Дата
Msg-id b78883bf0602020244s4e1e0e96o@mail.gmail.com
обсуждение исходный текст
Ответы Re: NULL values and string  (Tino Wildenhain <tino@wildenhain.de>)
Re: NULL values and string  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Hi, List!

I'm using PG8.1.

Are there any abilities to represent NULL values as string?

I'm doing something like this:

create function func(int4) returns varchar as'
declare
    num_value alias for $1;
    string_value varchar;
begin
  
   string_value := \'input value = \' || num_value;
   return string_value;

end
'language 'plpgsql';


If I einvoke my function with NULL argument, it return NULL. But I want 'input value = NULL'.
Of course, I can check input value like this:

if(num_value isnull) then
   string_value := \'input value = NULL\';
else
   string_value := \'input_value = \' || num_value;
end if;

But it is not laconic...


Sergey Karin

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: storing XML and querying
Следующее
От: Tino Wildenhain
Дата:
Сообщение: Re: NULL values and string