Re: [SQL] how can I replace all instances of a pattern

2013-03-26 Thread James Sharrett
Thanks Ken! I missed that option going through the documentation. > -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] how can I replace all instances of a pattern

2013-03-26 Thread Steve Crawford
On 03/26/2013 06:08 AM, James Sharrett wrote: I'm trying remove all instances of non-alphanumeric or underscore characters from a query result for further use. This is part of a function I'm writing that is in plpgsql Examples: Original value 'My text1' 'My text 2' 'My-text-3'

Re: [SQL] how can I replace all instances of a pattern

2013-03-26 Thread k...@rice.edu
On Tue, Mar 26, 2013 at 09:13:39AM -0400, James Sharrett wrote: > Sorry, caught a typo. Mytext1 is correctly replaced because only one > instance of the character (space) is in the string. > > This deals with the correct characters but only does the first instance of > the character so the output

Re: [SQL] how can I replace all instances of a pattern

2013-03-26 Thread James Sharrett
Sorry, caught a typo. Mytext1 is correctly replaced because only one instance of the character (space) is in the string. This deals with the correct characters but only does the first instance of the character so the output is: 'Mytext1' 'Mytext 2' (wrong) 'Mytext-3' (wrong) 'M

[SQL] how can I replace all instances of a pattern

2013-03-26 Thread James Sharrett
I'm trying remove all instances of non-alphanumeric or underscore characters from a query result for further use. This is part of a function I'm writing that is in plpgsql Examples: Original value 'My text1' 'My text 2' 'My-text-3' 'My_text4' 'My!text5' Desired 'Myt

Re: [SQL] From with case

2013-03-26 Thread Pavel Stehule
2013/3/26 Pavel Stehule : > Hello > > 2013/3/26 Ben Morrow : >> Quoth pavel.steh...@gmail.com (Pavel Stehule): >>> Dne 25.3.2013 23:51 "Ben Morrow" napsal(a): >>> > >>> > I would use a view for this: >>> > >>> > create view vale_any as >>> > select 'P'::text "type", v.adiant, v.desc_per, v

Re: [SQL] From with case

2013-03-26 Thread Pavel Stehule
Hello 2013/3/26 Ben Morrow : > Quoth pavel.steh...@gmail.com (Pavel Stehule): >> Dne 25.3.2013 23:51 "Ben Morrow" napsal(a): >> > >> > I would use a view for this: >> > >> > create view vale_any as >> > select 'P'::text "type", v.adiant, v.desc_per, v.cod >> > from valepag v >> >