A problem with 'update' query
Posted in 1994
shishir,
check the sqlca.sqlerrd[3] value. this will tell you the number of rows
that were updated by your update statement. here is a sample program:
database stores
main
create table testing123 ( col1 char(10))
insert into testing123 values ('test 123')
update testing123
set (col1)=('xxxx')
where col1 = 'hello world'
display status,sqlca.sqlerrd[3] # should be 0 and 0
update testing123
set (col1)=('xxxx')
where col1 = 'test 123'
display status,sqlca.sqlerrd[3] # should be 0 and 1
drop table testing123
end main
> Hi All,
>
> I have a problem regarding the UPDATE query I want to run in
> Informix-4GL. When I want to update a row in a particular table
> , and if this row does not exist, still the query returns SUCCESS
> as in STATUS=0. If the row is found, it is updates and returns
> SUCCESS. My problem is, how do I tell one state from another.
> If the update fails - because the row is not in the table - I want
> take some error recovery action.
>
> Hope someone out there can help.
>
> Thanks in advance.
>
> I would appreciate if you could get back via email:
>
> shishir@hpux4.miel.mot.com
>
> -Shishir
>
> Note: Please use the email address as indicated, and not from
> the header. The mail will never reach me! :-)
>
> ---------------------------------------------------------------
> Shishir Pathak,
> Motorola India Electronics Limited,
> Bangalore - 560 001
>
> email: shishir@hpux4.miel.mot.com
> ---------------------------------------------------------------
> Standard disclaimer applies.
> ---------------------------------------------------------------
>
--
regards,
+----------------------------------------------------------------------------+
| . . | |
| ... ... | Bob Baskett |
| ..... ..... | Software Engineer, DBA |
| .. ... .. | Business Systems Integration Group |
| . . . | Semiconductor Products Sector |
| | Mesa, AZ |
| Motorola, Inc. | |
|----------------------------------------------------------------------------|
| 'connectionLESS IS MORE' -- Data Broker |
|----------------------------------------------------------------------------|
| Duct tape is like the force. It has a light side, and a dark side, and |
| it holds the universe together ... |
| -- Carl Zwanzig |
+----------------------------------------------------------------------------+