Difference between revisions of "Public.getmanagedservicecountfornode (function)"

From dbscript Online Help
Jump to: navigation, search
Line 2: Line 2:
  
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
|-
+
|- valign="top"
 
| '''Function
 
| '''Function
 
| public.getmanagedservicecountfornode
 
| public.getmanagedservicecountfornode
|-
 
 
|}
 
|}
 
  
 
=== Source ===
 
=== Source ===
Line 45: Line 43:
 
| '''Referenced Object
 
| '''Referenced Object
  
|-
+
|- valign="top"
 
| Select
 
| Select
 
| Table
 
| Table
 
| [[public.ifservices_(table)|public.ifservices]]
 
| [[public.ifservices_(table)|public.ifservices]]
  
|-
+
|- valign="top"
 
| Select
 
| Select
 
| Table
 
| Table
Line 64: Line 62:
 
| '''Referencing Object
 
| '''Referencing Object
  
|-
+
|- valign="top"
 
| Execute
 
| Execute
 
| Function
 
| Function

Revision as of 23:38, 24 June 2010

wikibot

Function public.getmanagedservicecountfornode

Source

CREATE OR REPLACE FUNCTION public.getmanagedservicecountfornode(integer)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
   DECLARE
        nid ALIAS FOR $1;
        orec RECORD;
        counter float8;
   BEGIN
        counter = 0;
         FOR orec IN SELECT distinct ifservices.nodeid, ifservices.serviceid, ifservices.ipaddr
                FROM ipinterface, ifservices
                WHERE ifservices.nodeid = nid
                        AND ipinterface.nodeid = nid
                        AND ipinterface.ismanaged = 'M'
                        AND ifservices.ipaddr = ipinterface.ipaddr
                        AND ifservices.status = 'A'
        LOOP
                BEGIN
                         counter := counter + 1;
                END;
        END LOOP;
        RETURN counter;
   END;
$function$

References

Dependency Type Object Type Referenced Object
Select Table public.ifservices
Select Table public.ipinterface

Dependencies

Reference Type Object Type Referencing Object
Execute Function public.getmanagepercentavailnodewindow