我有一个名为reg_user
的程序包我需要创建一个查询,可以选择表中的所有项目,然后将其返回到java
程序(使用jdbc
),那么我需要为了返回一个在java程序中使用的值?这是我的代码:
CREATE OR REPLACE
PACKAGE BODY reg_pack
AS
PROCEDURE addUser(
c_fname user_profile.firstname%type,
c_lname user_profile.lastname%type,
c_cnum user_profile.contactno%type,
c_dob USER_PROFILE.DOB%type,
c_address user_profile.address%type,
c_city user_profile.city%type,
c_state user_profile.state%type,
c_country user_profile.country%type,
c_email user_profile.emailid%type,
c_password user_profile.password%type,
c_usertype user_profile.usertype%type,
c_username user_profile.username%type)
IS
BEGIN
INSERT
INTO USER_PROFILE
(
userid,
firstname,
lastname,
contactno,
dob,
address,
city,
state,
country,
emailid,
password,
usertype,
username
)
VALUES
(
userid_seq.NEXTVAL,
c_fname,
c_lname,
c_cnum,
c_dob,
c_address,
c_city,
c_state,
c_country,
c_email,
c_password,
c_usertype,
c_username
);
END addUser;
PROCEDURE delUser
(
c_id user_profile.userid%type
)
IS
BEGIN
DELETE FROM USER_PROFILE WHERE user_profile.userid = c_id;
END delUser;
PROCEDURE selectUser(
c_id user_profile.userid%type)
IS
BEGIN
SELECT USERID ,
FIRSTNAME ,
LASTNAME ,
CONTACTNO ,
DOB ,
ADDRESS ,
CITY ,
STATE ,
COUNTRY ,
EMAILID ,
PASSWORD ,
USERTYPE ,
USERNAME SERID ,
FIRSTNAME ,
LASTNAME ,
CONTACTNO ,
DOB ,
ADDRESS ,
CITY ,
STATE ,
COUNTRY ,
EMAILID ,
PASSWORD ,
USERTYPE ,
USERNAME
FROM USER_PROFILE
WHERE user_profile.userid = c_id;
END selectUser;
END reg_pack;