Pro C - Using a IND VAR in UPDATE to change a NULL to DATA

From: Colgate-Palmolive <ksacher_at_worldnet.att.net>
Date: 1998/05/02
Message-ID: <6ie0lp$6ni_at_bgtnsc03.worldnet.att.net>#1/1


Hello!

I am unable to update a field in a table that has a NULL value with data using indicator variables. I am using 2.1 ProC.

I read data from a flat file and populate variables. I check each variable for blanks. If the entire field is blank, I set the appropriate ind variable to -1. Otherwise I set the ind variable to 0.

If it is necessary to Update the table ( in this case a field WAS null and will now get a value) the following is performed.

EXEC SQL UPDATE SAP_MATERIAL_MASTER
SET
SAP_MATERIAL_TYPE_CODE=:ov_sap_material_type_code:ov_sap_material_type_code_ ind
WHERE
SAP_MATERIAL_NUMBER:ov_sap_material_number:ov_sap_material_number_ind.

The update appears to be performed, but the value is not entered into the table, and the field remains blank as it was before the UPDATE! No error messages appear to be generated. When I run the program again, the updates are performed all over again since the UPDATE did not actually occur. If I remove the indicator variable from the SET line it updates, but this is not an option has there may be a case when a NULL needs to be inserted. I will need the ind var to do this.

The host fields are trimmed of ending blanks during a strcmp with the fetched variable. The field I am attempting to update is a foreign key field, and I have checked the data to insure it is exactly as it appears in it's table. I can update the table by 'hardcoding' the data into the field without the ind variable.

Any suggestions? I am baffled!! Received on Sat May 02 1998 - 00:00:00 CEST

Original text of this message