<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - Zmiana wartości podczas select "w locie"]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=1453&amp;type=atom"/>
	<updated>2013-02-08T07:40:43Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=1453</id>
		<entry>
			<title type="html"><![CDATA[Odp: Zmiana wartości podczas select "w locie"]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3889#p3889"/>
			<content type="html"><![CDATA[Super - działa - o to mi chodziło :-)]]></content>
			<author>
				<name><![CDATA[tomek]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1459</uri>
			</author>
			<updated>2013-02-08T07:40:43Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3889#p3889</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Zmiana wartości podczas select "w locie"]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3888#p3888"/>
			<content type="html"><![CDATA[Ad 1 Musisz reagować na wartość null i zamienić ją na pusty ciąg można to zrobić tak:
select 'asd' || coalesce(null,'') || '123'
lub uzywając funkcji case odpowiednik IF
select 'asd' || case when pole is null then '' else pole end || '123' from (select null::varchar as pole) d

Ad 2 tu masz drugi sposób zastosowania funkcji case

select 'Widzę ' || case pole when 1 then 'jednego kota' 
                             when 2 then 'dwa koty'
                             when 3 then 'trzy koty'
                             when 4 then 'cztery koty'
                             when 5 then 'pięć kotów'
                             when 6 then 'sześć kotów'
                             when 7 then 'siedem kotów'
                             when 8 then 'osiem kotów'
                             when 9 then 'dziewięć kotów'
                             else 'dużo kotów' end||' i burka w łatki' as pole_tekstowe
        ,pole
 from generate_series(1,10,1) pole]]></content>
			<author>
				<name><![CDATA[c_michal]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=627</uri>
			</author>
			<updated>2013-02-07T20:16:36Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3888#p3888</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Odp: Zmiana wartości podczas select "w locie"]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3887#p3887"/>
			<content type="html"><![CDATA[Jak zauważyłeś null to nie to samo co ''. Nie za bardzo rozumiem po co Ci ta konkatenacja z nullem.]]></content>
			<author>
				<name><![CDATA[rski]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=26</uri>
			</author>
			<updated>2013-02-07T18:39:50Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3887#p3887</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Zmiana wartości podczas select "w locie"]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=3879#p3879"/>
			<content type="html"><![CDATA[1)  -----------------------------------------------

[code]select 'asd' || '' || '123'[/code]
-> ok, mam wiersz: 'asd123'

ale:
[code]select 'asd' || null || '123'[/code]
-> nie mam ani jednego wiersza

próbowałem:
[code]select 'asd' || text(null) || '123'[/code]
-> ale też nie mam wiersza.

Jest jakiś sposób żeby to zrobić?

1)  -----------------------------------------------


2)  -----------------------------------------------

Czy można w jakiś sposób:
[code]select coś_tam 2;[/code]
abym w wyniku dostał wiersz z dwójką zamienioną na string np:
-> "dwa koty"

2)  -----------------------------------------------]]></content>
			<author>
				<name><![CDATA[tomek]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1459</uri>
			</author>
			<updated>2013-02-07T14:38:00Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=3879#p3879</id>
		</entry>
</feed>
