RE: PL/SQL Procedure Need Help seriously

"Calhoun, Bob" <[email protected]> Wed, 23 Apr 2003 13:32:05 -0400
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-957357-2003.04.23-18.28.27--gcdod-oracle#[email protected]>
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 protected].