Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 14th, 2004, 03:32 AM
gary noble gary noble is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 6 gary noble User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
procedure

I have to make a procedure to change a given customer's address. I am having difficulty getting it to compile. Can anyone help? Thanks

set serveroutput on
DECLARE
change boolean;
PROCEDURE change_customer_address
(customer_id IN customer.cust_id%TYPE,
address_change OUT boolean) IS
current_address customer.status%TYPE;
BEGIN
SELECT address
INTO current_address
FROM customer
WHERE cust_id = customer_id;

Reply With Quote
  #2  
Old April 14th, 2004, 06:44 AM
galith_haham galith_haham is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 64 galith_haham User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 25 m 17 sec
Reputation Power: 5
Hi,

Don't quite understand what you are trying to do - if to change the address in the db you may want to use update and not select in that case this should work:

create or replace procedure(a_id number, new_address varchar2)
is
begin
update <table_name >
set address=new_address
where id=a_id;
exception
when others then
null;
end;

if you wish to extract the address in the database replace the update with a select + into clause and the new_address should be out.

Reply With Quote
  #3  
Old April 14th, 2004, 10:39 AM
gary noble gary noble is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 6 gary noble User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still have problems

i tried this but i get the following error: create or replace procedure(a_cust_id varchar2, new_address varchar2)
*
ERROR at line 1:
ORA-04050: invalid or missing procedure, function, or package name

create or replace procedure(a_cust_id varchar2, new_address varchar2)
is
begin
update customer
set address=new_address
where id= a_cust_id;
exception
when others then
null;
end;

Reply With Quote
  #4  
Old April 15th, 2004, 02:50 AM
galith_haham galith_haham is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 64 galith_haham User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 25 m 17 sec
Reputation Power: 5
Sorry - my mistake :

Create or replace procedure aaa (...

i omited the name of the procedure.

Galit.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > procedure


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway