What about:

 create function set_emp_id() returns void as $$
 begin
    drop table if exists emp_1_id;
    select emp_id into temp emp_1_id from secureview.tbl_employee where
username = current_user;
 end; 
 $$ language plpgsql;

 create function get_emp_id() returns int as $$
    return select emp_id from emp_1_id;
 $$ language plpgsql stable;

Call set_emp_id once on connection, then use get_emp_id thereafter. Would
that be any faster? (This is what Erik meant by " a temp table is pretty
much a session variable" in his earlier message.)

 -- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to