SesarDB

Home Tables Schemas Diagrams Foreign Keys Indexes
sesar_update_igsn_count(usercode character varying) - Procedure
Name sesar_update_igsn_count(usercode character varying)
Comment
Src
CREATE OR REPLACE FUNCTION sesar_update_igsn_count(usercode character varying) 
  RETURNS bigint AS 
$$
DECLARE
  total_samples int8;
BEGIN
  select count(*) as cnt 
    into total_samples 
    from sample 
   where igsn_prefix = userCode and archive_date is null;
  RAISE NOTICE 'Total samples for %s is %d', userCode , total_samples; 
 
   update sesar_user_code set igsn_count = total_samples where user_code = userCode;
 return total_samples;   
 END;

$$
  LANGUAGE plpgsql VOLATILE 
  COST 100;