| From: | Sergey Karin <sergey(dot)karin(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | NULL values and string |
| Date: | 2006-02-02 10:44:35 |
| Message-ID: | b78883bf0602020244s4e1e0e96o@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tino Wildenhain | 2006-02-02 10:59:04 | Re: NULL values and string |
| Previous Message | David Goodenough | 2006-02-02 10:36:54 | Re: Primary keys for companies and people |