Hi,
I am trying to generate a message in function through RAISE NOTICE or RAISE DEBUG. Function runs fine but i can not see the out put message.
I am trying to generate a message in function through RAISE NOTICE or RAISE DEBUG. Function runs fine but i can not see the out put message.
Code:
-- Function: actacladd(text, integer, integer, text, text, text, text)
-- DROP FUNCTION actacladd(text, integer, integer, text, text, text, text);
CREATE OR REPLACE FUNCTION actacladd(text, integer, integer, text, text, text, text)
RETURNS integer AS
$BODY$
declare
v_sesid ALIAS for $1;
v_actno ALIAS for $2;
v_subsno ALIAS for $3;
v_attr ALIAS for $4;
v_value ALIAS for $5;
v_value1 ALIAS for $6;
v_devid ALIAS for $7;
v_domno int;
v_action text;
v_temp int;
v_aclno int;
begin
--RAISE NOTICE 'The Input Parameters are at and % ', current_date;
-- OR
RAISE DEBUG 'The actacladd() function began.';
if length(v_attr)=0 or length(v_devid)=0 or length(v_value)=0 or (v_attr='UPWD' and length(v_value1)=0) then
raise exception 'All values are mandatory';
return 0;
end if;
if v_attr = 'IPADDR' then
select into v_domno domno from account where actno=v_actno;
if exists(select * from actacl c,account a where c.actno=a.actno and a.domno=v_domno and c.attr='IPADDR' and c.value=v_value and c.status=0) then
raise exception 'IP Address belong to another open subscription';
return 0;
end if;
else
if exists(select * from actacl where attr=v_attr and upper(value)=upper(v_value) and status=0) then
raise exception 'ACL value belong to anothre open subscription';
return 0;
end if;
end if;
if v_attr = 'IPADDR' or v_attr = 'MACADDR'then
RAISE NOTICE 'IPADDR or MACADDR if condition';
if exists(select * from actacl where subsno=v_subsno and upper(devid)=upper(v_devid) and attr=v_attr and status=0 for update) then
raise exception 'One device cannot have more than one IP/MAC';
return 0;
end if;
end if;
RAISE NOTICE 'OutSide of Insert Statement for ACTACL';
insert into actacl(actno,subsno,svccat,attr,value,status,value1,devid)
values (v_actno,v_subsno,1,v_attr,trim(v_value),0,trim(v_value1),v_devid);
v_action:='NetID Added: '||v_value;
select into v_aclno currval('actacl_aclno_seq');
v_temp=writeactlog(v_actno,v_sesid,v_action,cast(v_aclno as character varying));
return 1;
end;
$BODY$
LANGUAGE plpgsql VOLATILE;
ALTER FUNCTION actacladd(text, integer, integer, text, text, text, text) OWNER TO radius;
Comment