logo       
Google Custom Search
    AddThis Social Bookmark Button

RE: PL/SQL Procedure Need Help seriously: msg#00028

Subject: RE: PL/SQL Procedure Need Help seriously
You better use function to return a value. Procedure is not meant to return a 
calculated values, but to displace information
Leonard
As water reflects a face so do a man's heart reflects the man 



From: "Calhoun, Bob" 
Reply-To: "Oracle" 
To: "Oracle" 
Subject: [oracle] RE: PL/SQL Procedure Need Help seriously 
Date: Wed, 23 Apr 2003 13:32:05 -0400 

this variation works 

create or replace procedure calc_age 
( birth_date in date) 
is 
g_age number; 
BEGIN 
dbms_output.enable; 
g_age := round((sysdate - birth_date)/365,0); 
dbms_output.put_line( g_age); 
END; 
/ 

SQL> set serveroutput on 
SQL> exec calc_age('14-nov-1984') 
SQL> 18 
SQL> exec calc_age('01-jul-1979') 
SQL> 24 


-----Original Message----- 
From: koh sze jie [mailto:admin@xxxxxxxxxxx] 
Sent: Wednesday, April 23, 2003 2:30 PM 
To: Oracle 
Subject: [oracle] PL/SQL Procedure Need Help seriously 


this is my procedure whereby you input a date value into the procedure to 
calculate ur age. 

variable g_age number 
create or replace procedure cal_age 
( mybirthdate in date 
myage out number ) 
is 
begin 
myage := (sysdate - mybirthdate)/365 
:g_age := myage; 
end; 
print g_age 

Here is my problem 
how do i input a date value into my procedure.. 

i tried 
execute cal_age('14-NOV-84'); 
but it return an error and i know it wrong as well. 
but i cant embed a to_date function within the parenthesis. 

so any1 please help ? 


--- 
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to %%email.unsub%%. 


--- 
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to %%email.unsub%%. 
Add photos to your messages with  MSN 8.  Get 2 months FREE*.

---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to leave-oracle-1796914O@xxxxxxxxxxxxx




Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>