Query Help. Seems easy but complicated for me

Hey guys im trying to setup my application to check weather or not a user has an account made in my database.
The login uses a different authentication method then the application. As the login pulls from our intranet office database and the app uses users in a local apex db.
I need a query that will check after auth if the user has a account stored in apex db if so then the user will be redirected to page 4, if not then the user will be directed to page 7.
QUERY IM ATTEMPTING WITH NO RESULT
select count(*) from odf_user where login_name = :APP_USER.
if count(*) > 0 then (
wwv_flow_custom_auth_std.login( P_FLOW_PAGE => :APP_ID||':4');
else
www_flow_custom_auth_std.login( P_FLOW_PAGE => :APP_ID||':7');
endif;

Heres the code
declare
l_count NUMBER;
begin
select count(*) into l_count from odf_user where upper(login_name) = upper(:P101_USERNAME);
if l_count > 0 then
wwv_flow_custom_auth_std.login(
P_UNAME => v('P101_USERNAME'),
P_PASSWORD => :P101_PASSWORD,
P_SESSION_ID => v('APP_SESSION'),
P_FLOW_PAGE => :APP_ID||':4'
else
wwv_flow_custom_auth_std.login(
P_UNAME => v('P101_USERNAME'),
P_PASSWORD => :P101_PASSWORD,
P_SESSION_ID => v('APP_SESSION'),
P_FLOW_PAGE => :APP_ID||':7'
end if;
end;

Similar Messages

Maybe you are looking for

  • Table name where query variables stored

    Hi All, can any one please tell me in which data base table all the custom query variables are stored???

  • Package and applet

    I am reading about Zhiqun's Java Card book, and I wonder about the relationship between a package and an applet. Am I right in saying: 1. An applet comprises one or several packages 2. A package only belongs to one applet 3. One package is one group

  • BPEL Evaluation with WSIF

    Hi All, I have a xml document that flows through 3 systems(assume workstations) one after another similar to UNIX pipes i.e the output of one system is fed as input to the next system. There is some legacy Java code that sits on each of the systems(w

  • I lost my IPad password

    My I Pad is disabled because I lost the password.  How do I reset it

  • I installed final cut pro on my macbook pro. If I buy a new macbook pro I can move it?

    I want to buy a new macbook pro. I currently have a macbook pro in 2009. Buying a new Macwill lose all installed programs and regularly bought from Apple? For example, Final Cut ProX, Kynote, ect