Re: [SQL] problem using regexp_replace

2010-01-12 Thread gherzig
> On 2010-01-11, gher...@fmed.uba.ar wrote: > >> So, i come with this: >> SELECT regexp_replace( >> formato, E'{([^.]*)\.([a-zA-Z0-9]*)}, >> valores_sustitucion(ARRAY[E'\\1'::varchar,E'\\2'::varchar]), >> 'g') >> from table where id =1; > > select valores_sustitucion(ARRAY[E'\

Re: [SQL] problem using regexp_replace

2010-01-12 Thread Jasen Betts
On 2010-01-11, gher...@fmed.uba.ar wrote: > So, i come with this: > SELECT regexp_replace( > formato, E'{([^.]*)\.([a-zA-Z0-9]*)}, > valores_sustitucion(ARRAY[E'\\1'::varchar,E'\\2'::varchar]), > 'g') > from table where id =1; select valores_sustitucion(ARRAY[E'\\1'::varchar

Re: [SQL] problem using regexp_replace

2010-01-11 Thread gherzig
> On 2010-01-11, gher...@fmed.uba.ar wrote: > >> CREATE FUNCTION valores_sustitucion(valor_ingresado varchar[]) >> returns varchar >> as >> $$ >> select case >> $1[1] when 'Action_1' then >> (select descripcion from load_by_cod($1[2])) >> >>when 'Action_2' then (select descripcion from p

Re: [SQL] problem using regexp_replace

2010-01-11 Thread Jasen Betts
On 2010-01-11, gher...@fmed.uba.ar wrote: > CREATE FUNCTION valores_sustitucion(valor_ingresado varchar[]) > returns varchar > as > $$ > select case > $1[1] when 'Action_1' then > (select descripcion from load_by_cod($1[2])) > >when 'Action_2' then (select descripcion from pay_by_view($

[SQL] problem using regexp_replace

2010-01-10 Thread gherzig
Hi all. Im having a hard time here. Really have no idea what is wrong here. Facing a special case of text substitution, i have to parse a column like this one: SELECT formato from table where id=1; {Action_1.842}{Action_2.921}[truncated] The numbers at the rigth of the period identifies an argum