| From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> | 
|---|---|
| To: | "paulo matadr" <saddoness(at)yahoo(dot)com(dot)br> | 
| Cc: | GENERAL <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: converter pgplsql funcion | 
| Date: | 2008-11-21 13:05:02 | 
| Message-ID: | 162867790811210505x6d391790ye9121a9b71e4226b@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Hello
create or replace function clean_string(_p_dado varchar)
returns varchar as $$
declare
  _v_clean_string varchar := _p_dado;
  _c varchar;
begin
  for _c in select caracter from caracters loop
    _v_clean_string := replace(_c_clean_string, _c);
  end loop;
  return _c;
end;
$$ language plpgsql immutable strict;
regards
Pavel Stehule
p.s. look on translate function, maybe it should help
http://www.postgresql.org/docs/8.3/interactive/functions-string.html
regards
Pavel Stehule
2008/11/21 paulo matadr <saddoness(at)yahoo(dot)com(dot)br>:
> I work with oracle and have poor experience in pg/plsql.
> anybody can  help me  with translate from   pl/sql in pg/plsql in code
> below:
>
> CREATE OR REPLACE FUNCTION clean_string(p_dado varchar2) RETURN varchar2
> IS
>   v_clean_string varchar(4000);
> BEGIN
>     v_clean_string := p_dado;
>      for r in (select caracter from caracteres) loop
>           select replace(v_clean_string,r.caracter,'')
>          into v_clean_string
>          from dual;
>     end loop;
>     return v_clean_string;
> END;
> /
>
> need funcion in pg/plsql
> thanks for help
>
>
> ________________________________
> Veja quais são os assuntos do momento no Yahoo! + Buscados: Top 10 -
> Celebridades - Música - Esportes
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michal Szymanski | 2008-11-21 13:12:47 | Re: Using Postgres to store high volume streams of sensor readings | 
| Previous Message | Ciprian Dorin Craciun | 2008-11-21 13:03:42 | Re: Using Postgres to store high volume streams of sensor readings |