Set column value to default when field is blank

Hi Team,
Currently, I am working on task where I need to update column value to default (set as NULL) when no value is added into it.
So the task is that when user inputs no value/ keep blank and GUID then we need to pass the validation and save it in db. But in this case if value is blank we need to update column with default value which is NULL.
I used $bean->db->query() in my logic hook but somehow suitecrm is retaining previous value in the table column.

Please suggest.

That depends on which kind of logic_hook you’re trying, on which module, etc.

You have to watch out for code that runs after your code. This can be other logic hooks that are already scheduled to run, or sometimes it’s your own code that triggers new logic_hooks (typically when saving a bean).