I have a simple update procedure. So, i wish to update only fields they are not null values. How can i do it?
PROCEDURE UpdateCustomerInfo(
CustomerID IN NUMBER,
CustomerType IN VARCHAR2,
CustomerName IN VARCHAR2,
CustomerGender IN VARCHAR2,
CustomerBirthday IN DATE)
AS
BEGIN
UPDATE CUSTOMER_INFO
SET CUSTOMER_TYPE =CustomerType,
CUSTOMER_NAME =CustomerName,
CUSTOMER_GENDER =CustomerGender,
CUSTOMER_BIRTHDAY =CustomerBirthday
WHERE CUSTOMER_ID = CustomerID;
COMMIT;
END CUSTOMER_INFO
Anyone can help me?
Thanks
CUSTOMER_BIRTHDAYin the table is NULL and aCustomerBirthdayof January 12, 1986 is passed in, you don't want to update the table? That seems odd. Perhaps you mean that you only want to change the data if the parameter values passed in to your procedure call are non-NULL? I'm also confused as to why yourCustomerBirthdayis aTIMESTAMPrather than aDATE-- it seems unlikely that you're really asking a customer to provide their birth date to the millisecond.