Only 3.9% of viewers are subscribing to my channel 😓.
I request you to please give click on Subscribe button.
It really helps me grow 😢.
(
my_values numeric
);
CREATE OR REPLACE FUNCTION public.test_func(p_values numeric[])
RETURNS text
LANGUAGE 'plpgsql'
COST 100
VOLATILE
AS $BODY$
declare
v_array_length numeric(10,0) := 0;
v_msg character varying(100) := null;
begin
v_array_length := array_length(p_values,1);
if (v_array_length > 0) then
for i in 1..v_array_length loop
insert into public.testing (my_values) values (p_values[i]);
end loop;
v_msg := 'Array Processed Successfully With Length'||v_array_length;
else
v_msg := 'Array having no values';
end if;
return v_msg;
end;
$BODY$;
SELECT public.test_func('{123,34}'::numeric[]); -- 1
SELECT public.test_func('{123,34}'); -- 2
SELECT public.test_func('{}'); -- 3
select * from public.testing;
No comments:
Post a Comment