CREATE OR REPLACE FUNCTION rules_broken(ordref bigint)
RETURNS character varying AS
rulesbroken character varying;
ordsource character varying;
FOR rules IN SELECT rul_id,rul_sql FROM sd_stp_rules ORDER BY rul_id LOOP
EXECUTE rules.rul_sql || ' AND ord_id =' || ordref;
If found then
rulesbroken:=rulesbroken || rules.rul_id || ';';
In my table sd_STP_rules.rul_sql I had simple selects e.g.
SELECT COUNT(*) FROM d_order WHERE ....
This bombs. I read that I should use a PERFORM statement but again this bombs.
Anybody have a clue of the correct syntax of the PERFOM statement.
I have been trying PERFORM Select Count(*) FROM d_order WHERE ....
and also PERFORM Count(*) FROM d_order WHERE ....
but no joy
any help here would be much appreciated ...