Informix under Window NT
Posted in 2000
Topics: Installation, Setup & Upgrades, Stored Procedures & SPL, Data Types & Schema Design
Hello:
I'm working with Informix Dymanic Server 7.31 TC2 under Windows NT 4.0
platform. (The informix version I've down loaded from the internet)
I have this table
CREATE TABLE moneda
(monedaid serial,
desc varchar(75),
abreviatura char(5),
clavedivisa char(3),
statusid smallint)
I have a stored procedure like this:
CREATE PROCEDURE updmoneda (monedaid integer, desc varchar(75), abreviatura
char(5), clavedivisa char(3), statusid smallint)
UPDATE moneda SET descripcion = desc, abreviatura= abreviatura, clavedivisa=
clavedivisa, statusid= statusid WHERE monedaid = monedaid;
END PROCEDURE;
My problem is that when I execute the stored procedure insted o updating
only the row that matches the Where clause, it upgrades the hole table.
Could this be because I don't have a Final version of the product from
Informix? or, I'm doing somthin wrong?
If any one can help.. I'll appreciate.
Thanks
Elsa Perales
Grupo Internacional de Tecnologia Sa de CV
eperales@gint.com.mx
Hi!
Change your WHERE to:
WHERE moneda.moneaid = moneaid;
and try to avoid naming variables the same as column names or you
will have problems again.
HTH
Michael
Elsa Perales wrote:
> Hello:
>
> I'm working with Informix Dymanic Server 7.31 TC2 under Windows NT 4.0
> platform. (The informix version I've down loaded from the internet)
>
> I have this table
>
> CREATE TABLE moneda
> (monedaid serial,
> desc varchar(75),
> abreviatura char(5),
> clavedivisa char(3),
> statusid smallint)>
> I have a stored procedure like this:
>
> CREATE PROCEDURE updmoneda (monedaid integer, desc varchar(75), abreviatura
> char(5), clavedivisa char(3), statusid smallint)>
> UPDATE moneda SET descripcion = desc, abreviatura= abreviatura, clavedivisa=
> clavedivisa, statusid= statusid WHERE monedaid = monedaid;>
> END PROCEDURE;
>
> My problem is that when I execute the stored procedure insted o updating
> only the row that matches the Where clause, it upgrades the hole table.
> Could this be because I don't have a Final version of the product from
> Informix? or, I'm doing somthin wrong?
>
> If any one can help.. I'll appreciate.
> Thanks
>
> Elsa Perales
> Grupo Internacional de Tecnologia Sa de CV
> eperales@gint.com.mx
Hullo Elsa,
I think there may be a small error in your script (I too
have updated whole tables by mistake).
The thing is that your parameter has the same name as the
column. The SQL updates every row where the serial ref
equals itself - i.e. all of them.
If you change the name of the input parameter to something
like p_monedaid it should start working.
Andrew.
Elsa Perales <eperales@gint.com.mx> wrote in message
news:85ddvv$mel$1@news.mty.itesm.mx...
> Hello:
>
> I'm working with Informix Dymanic Server 7.31 TC2 under
Windows NT 4.0
> platform. (The informix version I've down loaded from the
internet)
>
> I have this table
>
> CREATE TABLE moneda
> (monedaid serial,
> desc varchar(75),
> abreviatura char(5),
> clavedivisa char(3),
> statusid smallint)>
> I have a stored procedure like this:
>
> CREATE PROCEDURE updmoneda (monedaid integer, descvarchar(75), abreviatura
> char(5), clavedivisa char(3), statusid smallint)
>
> UPDATE moneda SET descripcion = desc, abreviatura=
abreviatura, clavedivisa=
> clavedivisa, statusid= statusid WHERE monedaid = monedaid;>
> END PROCEDURE;
>
> My problem is that when I execute the stored procedure
insted o updating
> only the row that matches the Where clause, it upgrades
the hole table.
> Could this be because I don't have a Final version of the
product from
> Informix? or, I'm doing somthin wrong?
>
> If any one can help.. I'll appreciate.
> Thanks
>
>
> Elsa Perales
> Grupo Internacional de Tecnologia Sa de CV
> eperales@gint.com.mx
>
>
>