Subject A problem with validation constraint
Author Anton Malinovskiy
Hello,

I have very simple insert storing procedure. But it fails with very strange
error. The text of the error:



The insert failed because a column definition includes a validation
constraints. Validation error for column EMAIL, value "*** null ***"



The column definition doesn't include any constraints at all. I've searched
the answer, but I've found only that I am not the only one, who have such
problem.





The code of the stored procedure:



>>>>>BEGIN

>>>>> IF ((:email IS NOT NULL)

>>>>> AND (EXISTS (SELECT ID FROM MG_User WHERE Email = :email))) THEN

>>>>> BEGIN

>>>>> resultCode = 2;

>>>>> END

>>>>>ELSE

>>>>> BEGIN

>>>>> IF (EXISTS (SELECT ID FROM MG_User WHERE ID = :ID)) THEN

>>>>> BEGIN

>>>>>

>>>>> SELECT RootDirectoryID, Email, FirstName, LastName,

>>>>> Company, Street, City, Country, State, Zip, Phone, Fax

>>>>> FROM MG_User

>>>>> WHERE ID = :ID

>>>>> INTO :tempRootDirectoryID, :tempEmail, :tempFirstName,
:tempLastName,

>>>>> :tempCompany, :tempStreet, :tempCity, :tempCountry,
:tempState,

>>>>> :tempZip, :tempPhone, :tempFax;

>>>>>

>>>>> IF (:rootdirectoryID IS NULL OR :rootdirectoryID = 0 ) THEN

>>>>> rootdirectoryID = RootDirectoryID;

>>>>> IF (:email IS NULL) THEN

>>>>> email = email;

>>>>> IF (:firstname IS NULL) THEN

>>>>> firstname = FirstName;

>>>>> IF (:lastname IS NULL) THEN

>>>>> lastname = LastName;

>>>>> IF (:logontime IS NULL) THEN

>>>>> logontime = LogonTime;

>>>>> IF (:logoncount IS NULL) THEN

>>>>> logoncount = LogonCount;

>>>>> IF (:company IS NULL) THEN

>>>>> company = Company;

>>>>> IF (:street IS NULL) THEN

>>>>> street = Street;

>>>>> IF (:city IS NULL) THEN

>>>>> city = City;

>>>>> IF (:country IS NULL) THEN

>>>>> country = Country;

>>>>> IF (:state IS NULL) THEN

>>>>> state = State;

>>>>> IF (:zip IS NULL) THEN

>>>>> zip = Zip;

>>>>> IF (:phone IS NULL) THEN

>>>>> phone = Phone;

>>>>> IF (:fax IS NULL) THEN

>>>>> fax = Fax;



>>>>> UPDATE MG_User

>>>>> SET RootDirectoryID = :rootdirectoryID, FirstName =
:firstname,

>>>>> Email = :email, LastName = :lastname,

>>>>> LogonTime= :logontime, LogonCount=:logoncount,

>>>>> Company = :company, Street = :street,

>>>>> City = :city, Country = :country, State = :state,

>>>>> Zip = :zip, Phone = :phone, Fax = :fax

>>>>> WHERE ID = :ID;



>>>>> resultCode = 4;

>>>>> END

>>>>> ELSE

>>>>> BEGIN

>>>>> resultCode = 3;

>>>>> END

>>>>> END

>>>>> SUSPEND;

>>>>>END



Best regards, Anton Malinovskiy





[Non-text portions of this message have been removed]