PROMPT create or replace procedure get_rfid_privs

create or replace procedure get_rfid_privs
(       
        p_login_name           in   tagtrak_users.loginname%TYPE,
        p_tagtrak_password     in   tagtrak_users.tagtrak_password%TYPE,
        p_priv1                out  char,
        p_priv2                out  char,
        p_priv3                out  char,
        p_priv4                out  char,
        p_priv5                out  char,
        p_priv6                out  char,
        p_priv7                out  char,
        p_priv8                out  char,
        p_priv9                out  char,
        p_priv10               out  char,
        p_priv11               out  char,
        p_priv12               out  char,
        p_priv13               out  char,
        p_priv14               out  char,
        p_priv15               out  char,
        p_priv16               out  char,
        p_priv17               out  char,
        p_priv18               out  char,
        p_priv19               out  char,
        p_priv20               out  char,
        p_priv21               out  char,
        p_priv22               out  char,
        p_priv23               out  char,
        p_priv24               out  char,
        p_priv25               out  char,
        p_priv26               out  char,
        p_priv27               out  char,
        p_priv28               out  char,
        p_priv29               out  char,
        p_priv30               out  char,
        p_priv31               out  char,
        p_priv32               out  char,
        p_priv33               out  char,
        p_priv34               out  char,
        p_priv35               out  char,
        p_priv36               out  char,
        p_priv37               out  char,
        p_priv38               out  char,
        p_priv39               out  char,
        p_priv40               out  char,
        p_priv41               out  char,
        p_priv42               out  char,
        p_priv43               out  char,
        p_priv44               out  char,
        p_priv45               out  char,
        p_priv46               out  char,
        p_priv47               out  char,
        p_priv48               out  char,
        p_priv49               out  char,
        p_priv50               out  char,
        p_priv51               out  char,
        p_priv52               out  char,
        p_priv53               out  char,
        p_priv54               out  char,
        p_priv55               out  char,
        p_priv56               out  char,
        p_priv57               out  char,
        p_priv58               out  char,
        p_priv59               out  char,
        p_priv60               out  char,
        p_priv61               out  char,
        p_priv62               out  char,
        retval                 out  number
) is 

        gname           char(15);               /* user_group name */
        acode           char(5);                /* agent code */
        encr_password   char(15);
        retcode         number(10);


begin


        retcode := 0;

        p_priv1  := '';
        p_priv2  := '';
        p_priv3  := '';
        p_priv4  := '';
        p_priv5  := '';
        p_priv6  := '';
        p_priv7  := '';
        p_priv8  := '';
        p_priv9  := '';
        p_priv10 := '';
        p_priv11        := '';
        p_priv12        := '';
        p_priv13        := '';
        p_priv14        := '';
        p_priv15        := '';
        p_priv16        := '';
        p_priv17        := '';
        p_priv18        := '';
        p_priv19        := '';
        p_priv20        := '';
        p_priv21        := '';
        p_priv22        := '';
        p_priv23        := '';
        p_priv24        := '';
        p_priv25        := '';
        p_priv26        := '';
        p_priv27        := '';
        p_priv28        := '';
        p_priv29        := '';
        p_priv30        := '';
        p_priv31        := '';
        p_priv32        := '';
        p_priv33        := '';
        p_priv34        := '';
        p_priv35        := '';
        p_priv36        := '';
        p_priv37        := '';
        p_priv38        := '';
        p_priv39        := '';
        p_priv40        := '';
        p_priv41        := '';
        p_priv42        := '';
        p_priv43        := '';
        p_priv44        := '';
        p_priv45        := '';
        p_priv46        := '';
        p_priv47        := '';
        p_priv48        := '';
        p_priv49        := '';
        p_priv50        := '';
        p_priv51        := '';
        p_priv52        := '';
        p_priv53        := '';
        p_priv54        := '';
        p_priv55        := '';
        p_priv56        := '';
        p_priv57        := '';
        p_priv58        := '';
        p_priv59        := '';
        p_priv60        := '';
        p_priv61        := '';
        p_priv62        := '';

        encr_password   := '';


        encr_password := user_authentication.encrypt_password (rtrim(p_tagtrak_password));

               begin
                 
                 select  nvl(group_name, '-'),
                         nvl(agent_code, '-')
                   into  gname,
                         acode
                   from  tagtrak_users
                  where  loginname          = p_login_name 
                    and  tagtrak_password   = encr_password;

               exception
        
                      when no_data_found  then
                       null;
               end;
               




              begin


                select
                                        nvl(priv1, ' '),
                                        nvl(priv2, ' '),
                                        nvl(priv3, ' '),
                                        nvl(priv4, ' '),
                                        nvl(priv5, ' '),
                                        nvl(priv6, ' '),
                                        nvl(priv7, ' '),
                                        nvl(priv8, ' '),
                                        nvl(priv9, ' '),
                                        nvl(priv10, ' '),
                                        nvl(priv11, ' '),
                                        nvl(priv12, ' '),
                                        nvl(priv13, ' '),
                                        nvl(priv14, ' '),
                                        nvl(priv15, ' '),
                                        nvl(priv16, ' '),
                                        nvl(priv17, ' '),
                                        nvl(priv18, ' '),
                                        nvl(priv19, ' '),
                                        nvl(priv20, ' '),
                                        nvl(priv21, ' '),
                                        nvl(priv22, ' '),
                                        nvl(priv23, ' '),
                                        nvl(priv24, ' '),
                                        nvl(priv25, ' '),
                                        nvl(priv26, ' '),
                                        nvl(priv27, ' '),
                                        nvl(priv28, ' '),
                                        nvl(priv29, ' '),
                                        nvl(priv30, ' '),
                                        nvl(priv31, ' '),
                                        nvl(priv32, ' '),
                                        nvl(priv33, ' '),
                                        nvl(priv34, ' '),
                                        nvl(priv35, ' '),
                                        nvl(priv36, ' '),
                                        nvl(priv37, ' '),
                                        nvl(priv38, ' '),
                                        nvl(priv39, ' '),
                                        nvl(priv40, ' '),
                                        nvl(priv41, ' '),
                                        nvl(priv42, ' '),
                                        nvl(priv43, ' '),
                                        nvl(priv44, ' '),
                                        nvl(priv45, ' '),
                                        nvl(priv46, ' '),
                                        nvl(priv47, ' '),
                                        nvl(priv48, ' '),
                                        nvl(priv49, ' '),
                                        nvl(priv50, ' '),
                                        nvl(priv51, ' '),
                                        nvl(priv52, ' '),
                                        nvl(priv53, ' '),
                                        nvl(priv54, ' '),
                                        nvl(priv55, ' '),
                                        nvl(priv56, ' '),
                                        nvl(priv57, ' '),
                                        nvl(priv58, ' '),
                                        nvl(priv59, ' '),
                                        nvl(priv60, ' '),
                                        nvl(priv61, ' '),
                                        nvl(priv62, ' ')
                                into
                                        p_priv1,
                                        p_priv2,
                                        p_priv3,
                                        p_priv4,
                                        p_priv5,
                                        p_priv6,
                                        p_priv7,
                                        p_priv8,
                                        p_priv9,
                                        p_priv10,
                                        p_priv11,
                                        p_priv12,
                                        p_priv13,
                                        p_priv14,
                                        p_priv15,
                                        p_priv16,
                                        p_priv17,
                                        p_priv18,
                                        p_priv19,
                                        p_priv20,
                                        p_priv21,
                                        p_priv22,
                                        p_priv23,
                                        p_priv24,
                                        p_priv25,
                                        p_priv26,
                                        p_priv27,
                                        p_priv28,
                                        p_priv29,
                                        p_priv30,
                                        p_priv31,
                                        p_priv32,
                                        p_priv33,
                                        p_priv34,
                                        p_priv35,
                                        p_priv36,
                                        p_priv37,
                                        p_priv38,
                                        p_priv39,
                                        p_priv40,
                                        p_priv41,
                                        p_priv42,
                                        p_priv43,
                                        p_priv44,
                                        p_priv45,
                                        p_priv46,
                                        p_priv47,
                                        p_priv48,
                                        p_priv49,
                                        p_priv50,
                                        p_priv51,
                                        p_priv52,
                                        p_priv53,
                                        p_priv54,
                                        p_priv55,
                                        p_priv56,
                                        p_priv57,
                                        p_priv58,
                                        p_priv59,
                                        p_priv60,
                                        p_priv61,
                                        p_priv62
                                from
                                        user_group
                                where
                                        group_name = gname and
                                        agent_code = acode;


                          exception
     
                                 when no_data_found then

                                    retcode := -1027;
                          end;


  retval := retcode;


end;
/
