Re: Updatear un substring

From: Silvio Quadri <silvioq(at)gmail(dot)com>
To: "masc68(at)gmail(dot)com" <masc68(at)gmail(dot)com>
Cc: pgsql-es-ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Updatear un substring
Date: 2010-11-24 19:12:58
Message-ID: AANLkTinZG0EHWSUvmt08Cu6ArJA3Uzo1hDa8oiC6nZ1o@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

El día 24 de noviembre de 2010 15:42, masc68(at)gmail(dot)com
<masc68(at)gmail(dot)com> escribió:
> HOla lista,
>
> tengo una duda, estroy tratando de hacer un update de la sigueinte forma:
>
> UPDATE "eMarketing_estord"
>  SET  SUBSTRING(est_orden,3,1) = '1'
>    WHERE co_orden = 'POS0000036';
>
> pero me sal el siguiente error:
>
> ERROR:  syntax error at or near "("
> LINE 1: UPDATE "eMarketing_estord" SET SUBSTRING(est_orden,3,1) = 1
>
>
> Acaso no se puede hacer un update así ?????

Definitivamente no! ¿Hay algún dialecto SQL que lo soporte?

Tenés que hacerlo así.
est_orden = substring( est_orden, 1, 2 ) || '1' || substring( est_orden, 4, 99 )

Silvio

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Espartano 2010-11-24 19:14:20 Problema con log de postgresq 7.3
Previous Message masc68@gmail.com 2010-11-24 18:42:16 Updatear un substring