I've got a project where I have two tables that are linked together on an inventory code. Big deal. There is the inventory table, containing qty_onhand and qty_onorder. Then there is the order_items table, containing inven_code and qty. I have the inven_code in the order_items table set to cascade on update of inventory and I have a trigger that on insert/update/delete to order_items the inventory tables qty_onhand and qty_onorder values are updated appropriately. This is a pain in the ass. Because if the inventory code changes then order_items() is called, it all works brilliantly but I can't keep helping to think that maybe there's an easier way. Am I just amusing myself by thinking that? I've wracked my brains but I can't seem to figure out a way around the qty_onorder field, could I use a view somehow for that? But, I have to be able to find items in that same list where there are no parts on order (left outer-join). Anyway I've attached the function I've written so maybe anyone who is interested can give me pointers, use it themselves instead of taking the time it took me to figure out PLpgsql, or tell me I'm braindead because there is a *much* easier way to do this. Thanks -- creaky halls
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера