Oracle PL/SQL Procedure for user login check

create or replace procedure login_check(v_username varchar2,v_password varchar2)
uname varchar2(20);
pass varchar2(20);
ctime varchar2(40);
ltime timestamp :=systimestamp;
  select to_char(systimestamp,'hh24')  into ctime from dual;
  select username,password into uname,pass from LOGIN where LOWER(username)=LOWER(v_username) and LOWER(password)=LOWER(v_password);
if (lower(uname)=lower(v_username) and lower(pass)=lower(v_password))
if ctime between 1 and 12 then
 dbms_output.put_line(' Good Morning ' ||  v_username ||' : '|| to_char(systimestamp,'hh:mi'));
elsif ctime between '12' and '17' then
 dbms_output.put_line(' Good AfterNoon '|| v_username ||' : '|| to_char(systimestamp,'hh:mi'));
dbms_output.put_line(' Good evening '|| v_username ||' : '|| to_char(systimestamp,'hh:mi'));
end if;
end if;
 dbms_output.put_line('invalid username/password');
end login_check;

People who read this post also read :


You're not hashing the password? You're doing it wrong!

Not even sure I understand the puporse of using this procedure? Once you are logged into the database, you are in.

not hashing pass -

I guess just using it as authentication system for an app - not the dbase.

def should hash the pass

Ok, so if your app has its own user accounts separate from the db accounts, you'd still be well advised to use Oracle's model. When the account is created (and remember, as far as Oracle is concerned, this isn't an account, it is just application data in an application table), combine the password with the username, hash that string, and store the result as the 'password'. When a user needs to authenticate, again combine the username with the password they provide, hash that result, then compare that hash with what is stored.

Hi all,
can any1 please help me to write a procedure for checking password of the java struts application build with oracle database.

how to execute the store procedure in oracle database table

Post a Comment


Twitter Delicious Facebook Digg Stumbleupon Favorites More