该函数要完成的功能:
根据传入的六个参数去判断组成一个sql字符串,在已查询出来的结果里循环拿到最终的结果,输出out参数定义的值得集合。
CREATE OR REPLACE FUNCTION get_dynstore(
IN stock_id integer, -- 仓库ID
IN product_code character varying, --产品编码
IN useful_date integer, -- 天数
IN i_state integer, -- 库存状态
IN q_state integer, -- 质量状态
IN is_batch boolean, -- 是否分批号
OUT qtys numeric, -- 库存数量
OUT lqty numeric, -- 锁定数量
OUT uqty numeric, -- 可用数量
OUT p_id integer, -- 产品ID
OUT stock_loc_id integer, -- 库位
OUT v_quality_id integer, -- 质量状态
OUT v_inventory_id integer, --存货状态
OUT p_tmpl_id numeric, -- 物料模板表product_template的记录ID
OUT name_tem character varying, -- 物料名称
OUT def_