当我用laravel的数组参数调用postgresql函数时,我在laravel中出错。
这是我的功能:
CREATE OR REPLACE FUNCTION public.get_eprop_break_data(
IN integer[],
IN integer[],
IN integer[],
IN integer[])
RETURNS TABLE(year_budget character, comp_id integer, comp_name character varying, comp_code character varying, div_id integer, div_name character varying, brandcode character varying, brandname character varying, brandid integer, kategoryid integer, activityid integer, activityname character varying, kategoryname character varying, produkid integer, produkname character varying, budget_str_det_id integer) AS
$BODY$
DECLARE
in_division_id ALIAS FOR $1;
in_brand_id ALIAS FOR $2;
in_activity_id ALIAS FOR $4;
in_produk_id ALIAS FOR $3;
BEGIN
return Query (
select budget_year ,
company_id ,
company_name ,
company_code ,
division_id,
division_name ,
brand_code ,
brand_name ,
brand_id ,
kategory_id ,
activity_id ,
activity_name ,
kategory_name ,
produk_id ,
produk_name ,
budget_str_detail_id from eprop_budget_breakdown_mv where division_id = ANY(in_division_id) And brand_id = ANY(in_brand_id) and produk_id = ANY(in_produk_id) and activity_id = ANY(in_activity_id));
END
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
ROWS 1000;
这就是我从laravel调用函数的方式
$TestGetFunc = DB::select('select * from get_eprop_break_data(?,?,?,?)',[$division_id,$det_prop_brand,$det_prop_activity,$det_prop_varian]);
这是错误:
Array to String Conversion
我一直在搜索此错误,但没有运气。请..帮助我解决此错误。
非常感谢您的帮助。
最好的问候,
点