Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple SQL question

Re: Simple SQL question

From: <csimona_at_my-deja.com>
Date: Tue, 22 Feb 2000 13:56:23 GMT
Message-ID: <88u4i5$u2t$1@nnrp1.deja.com>


In article <cKRq4.353$CL6.3080_at_dfiatx1-snr1.gtei.net>,   "Rookie" <Rookie.Programmer_at_gte.net> wrote:
> I would like to use a procedure for a simple select statement, so
that it
> can be called by the same name each time anywhere from an
application. I
> would like to use something like this:
>
> CREATE OR REPLACE PROCEDURE GET_USER
> (
> USERNAME IN VARCHAR2,
> USERPASSWORD IN VARCHAR2,
> USERID OUT NUMBER
> )
>
> AS
>
> BEGIN
>
> SELECT TBL_USERS.USER_ID
> INTO USERID
> FROM TBL_USERS
> WHERE TBL_USERS.USER_NAME = USERNAME
> AND TBL_USERS.USER_PASSWORD = USERPASSWORD;
>
> END;
>
> Where each time the procedure get_user gets called from a java
application,
> the user id will get returned when the username and the userpassword
is
> given as parameters.
>
> Please help. Thanks in advance!
>
>

Try someting like this:
create GET_User

   @user_name varchar,
   @user_password varchar,
   @user_id int output

AS
set @user_id = (SELECT USER_ID
                FROM tbl_USERS
                WHERE USER_NAME=@user_name AND USER_PASSWORD =
@user_password)

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Feb 22 2000 - 07:56:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US