Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PL/SQL Help in validating data exists in a table.

cjpicc11Nov 29 2013 — edited Nov 30 2013

Greetings,

I am still new to PL/SQL and attempting to create a stored procedure that would allow me to check to see if a user exists in login table.  The end goal is to have a user login to an ASP.net web application and have a stored procedure validate the user exists in the user table.

To start, I just want to test the SP only from the DB.  So, I am wondering how I can set the parameter with a value to imitate an application passing a value into that parameter.

Here is my code for the SP that was compiled without error.

CREATE OR REPLACE PROCEDURE SP_LOGIN_CHK

(

  P_USRNAME IN VARCHAR2

) IS

v_login_id VARCHAR2(20);

BEGIN

  select login_id

  into v_login_id

  from login_user where v_login_id = p_usrname;

END SP_LOGIN_CHK;

Here is what I am using to execute the stored procedure...

exec sp_login_chk('Chris');

I am getting a 'No data found' error.  However, when I run this query against the database I get 1 row returned.

select login_id from login_user where login_id = 'Chris';

This post has been answered by Frank Kulash on Nov 29 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2013
Added on Nov 29 2013
3 comments
1,226 views