Home » SQL & PL/SQL » SQL & PL/SQL » stored procedure
stored procedure [message #9737] Tue, 02 December 2003 14:36 Go to next message
sab
Messages: 11
Registered: February 2003
Junior Member
hi
i need to create a stored procedure
which will change an email address in a record
to a set email which will be in the format below
user_id@hotmail.com
all the records have a unique user_id i need to join this with @hotmail.com to set the new email

please can you help
Re: stored procedure [message #9739 is a reply to message #9737] Tue, 02 December 2003 14:46 Go to previous messageGo to next message
sverch
Messages: 582
Registered: December 2000
Senior Member
UPDATE your_table SET email_address =
user_id||'@hotmail.com';
Re: stored procedure [message #9740 is a reply to message #9739] Tue, 02 December 2003 14:52 Go to previous messageGo to next message
sab
Messages: 11
Registered: February 2003
Junior Member
thanks for replying
i have to create a stored prcedure and i have to use the member functions i have already created

MEMBER FUNCTION getemail RETURN varchar2,
MEMBER FUNCTION setemail(self in out student_type, em varchar2) RETURN number,

MEMBER FUNCTION getemail RETURN varchar2 IS
BEGIN
RETURN SELF.contact.email;
END;

MEMBER FUNCTION setemail(SELF IN OUT student_type, em varchar2) RETURN number IS
BEGIN
SELF.contact.email:=em;
RETURN 1;
END;

thanks
Re: stored procedure [message #9741 is a reply to message #9740] Tue, 02 December 2003 14:56 Go to previous messageGo to next message
sverch
Messages: 582
Registered: December 2000
Senior Member
Why do you need function if you can do it in one very simple SQL?
Re: stored procedure [message #9742 is a reply to message #9741] Tue, 02 December 2003 15:01 Go to previous messageGo to next message
sab
Messages: 11
Registered: February 2003
Junior Member
hello sverxh
its part of an assignment i trying to complete

the question i have to answer is
'the use of member functions can also be mediated by the use of stored procedures.
reset a students email, write a stored procedure to take a students name and email address that then updates the object instance using the setemail method

thanks
Re: stored procedure [message #9744 is a reply to message #9742] Tue, 02 December 2003 15:22 Go to previous message
sverch
Messages: 582
Registered: December 2000
Senior Member
If it is a homework go to
http://asktom.oracle.com/pls/ask/f?p=4950:8:383290::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:583023218156,
Previous Topic: INSERT problem
Next Topic: Urgent
Goto Forum:
  


Current Time: Fri Apr 26 11:56:16 CDT 2024