RE: PL/SQL Procedure Need Help seriously

[email protected] Wed, 23 Apr 2003 14:01:20 -0400
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-957386-2003.04.23-18.57.00--gcdod-oracle#[email protected]>
Leonard,

Could you please point me to the documentation that states that a procedure
is not meant to return a calculated value.

So are you saying that if you need more then one calculated value returned
you would create two functions instead of one procedure??

- Ivan



                                                                                                                                       
                      "Leonard Anukam"                                                                                                 
                      <leonardanukam@ho        To:       "Oracle" <[email protected]>                                                
                      tmail.com>               cc:                                                                                     
                                               Subject:  [oracle] RE: PL/SQL Procedure Need Help seriously                             
                      04/23/2003 01:57                                                                                                 
                      PM                                                                                                               
                      Please respond to                                                                                                
                      "Oracle"                                                                                                         
                                                                                                                                       
                                                                                                                                       





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:[email protected]]
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 %%email.unsub%%.






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