From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | David Acevedo Salazar <dgacevedo(at)yahoo(dot)es> |
Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Ayuda con Update + Select |
Date: | 2007-06-28 01:35:02 |
Message-ID: | 20070628013502.GD561@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
David Acevedo Salazar escribió:
> -- Actualiza ID del Año
> l_sql := 'UPDATE I_Ppto_Venta ' ||
> ' SET C_Year_ID = (SELECT b.C_Year_ID ' ||
> ' FROM ov_presupuesto a, c_year b ' ||
> ' WHERE a.OV_Presupuesto_ID =
> I_Ppto_Venta.OV_Presupuesto_ID ' ||
> ' AND a.C_Year_ID =
> b.C_Year_ID ' ||
> ' AND b.Year =
> o.YearName) ' ||
> ' WHERE COALESCE(I_IsImported, ''Y'') = ''Y'' ' ||
> ' AND I_ErrorMsg IS NULL ';
> EXECUTE l_sql;
Aparte de la variable distinta que señala Jaime, yo te recomendaria
evitarte el problema de las comillas, que aquí se ven muy dudosas.
Prueba así:
l_sql = $sql$ UPDATE I_Ppto_Venta
SET C_Year_ID = (SELECT b.C_Year_ID
FROM ov_presupuesto a, c_year b
WHERE a.OV_Presupuesto_ID = I_Ppto_Venta.OV_Presupuesto_ID
AND a.C_Year_ID = b.C_Year_ID
AND b.Year = o.YearName)
WHERE COALESCE(I_IsImported, 'Y') = 'Y'
AND I_ErrorMsg IS NULL $sql$;
EXECUTE l_sql;
--
Alvaro Herrera http://www.flickr.com/photos/alvherre/
"That sort of implies that there are Emacs keystrokes which aren't obscure.
I've been using it daily for 2 years now and have yet to discover any key
sequence which makes any sense." (Paul Thomas)
From | Date | Subject | |
---|---|---|---|
Next Message | Gabriel Hermes Colina Zambra | 2007-06-28 02:29:39 | Re: OT , Obtener ID (PK) dese código VB6 con odbc |
Previous Message | Alvaro Herrera | 2007-06-28 01:07:03 | Re: OT , Obtener ID (PK) dese código VB6 con odbc |