|Subject||RE: [firebird-support] Executing an insert procedure|
> Hi all.as helen says - but just a note on logic, you are assuming the presence of
> I'm trying to implement a stored procedure to perform updates on Debian
> Linux packaged FB1.5. Full text of procedure below:
> CREATE PROCEDURE UPDATE_ZIPCODE (ID INTEGER, ZIPCODE CHARACTER (10),
> STATE CHARACTER (2), CITY VARCHAR (30))
> RETURNS (NEWID INTEGER)
> IF (id IS NOT NULL) THEN
> UPDATE ZIPCODES SET zipcode=:zipcode, state=:state, city=:city WHERE
> newid = GEN_ID(gen_zipcode_id,1);
> INSERT INTO ZIPCODES (id, zipcode, city, state)
> VALUES (:newid, :zipcode, :city, :state);
> END !!
id just because it's being passed to the procedure.
A better logic would be to select for id and see if the record exists before
trying to update it. It may not exist, but updating where id does not exist
will be silent. YOu wont know if anything at all has happened.