Home » SQL & PL/SQL » SQL & PL/SQL » PL/SQL any on help me 4 thissss
PL/SQL any on help me 4 thissss [message #435004] Sun, 13 December 2009 11:31 Go to next message
m.waqask
Messages: 4
Registered: December 2009
Location: KARACHI
Junior Member
No Message Body
Re: PL/SQL any on help me 4 thissss [message #435006 is a reply to message #435004] Sun, 13 December 2009 11:39 Go to previous messageGo to next message
m.waqask
Messages: 4
Registered: December 2009
Location: KARACHI
Junior Member
m.waqask wrote on Sun, 13 December 2009 22:31



i have some problem in this assignment ....

DECLARE
AGE DATE:=TO_DATE('&ENTER_DOB');
RES NUMBER:=0;

BEGIN
if to_char(age,'Mon')='Jan' then
&d('YOUR STAR IS JAN STAR');
ELSIF
to_char(age,'Mon')='Feb' then
&d('YOUR STAR IS FEB STAR');
ELSIF
to_char(age,'Mon')='Mar' then
&d('YOUR STAR IS MAR STAR');
ELSIF
to_char(age,'Mon')='Apr' then
&d('YOUR STAR IS APR STAR');
ELSIF
to_char(age,'Mon')='May' then
&d('YOUR STAR IS MAY STAR');
ELSIF
to_char(age,'Mon')='Jun' then
&d('YOUR STAR IS JUN STAR');
ELSIF
to_char(age,'Mon')='Jul' then
&d('YOUR STAR IS JULY STAR');
ELSIF
to_char(age,'Mon')='Aug' then
&d('YOUR STAR IS AUG STAR');
ELSIF
to_char(age,'Mon')='Sep' then
&d('YOUR STAR IS SEP STAR');
ELSIF
to_char(age,'Mon')='Oct' then
&d('YOUR STAR IS OCT STAR');
ELSIF
to_char(age,'Mon')='Nov' then
&d('YOUR STAR IS NOV STAR');
ELSIF
to_char(age,'Mon')='Dec' then
&d('YOUR STAR IS DEC STAR');
END IF ;
SELECT ROUND((SYSDATE-AGE)/365,0) INTO RES FROM DUAL;
&d(' YOU AGE IS '|| RES);
END;
/


it would show the output like this

Enter value for enter_dob: 14-AUG-1987
YOUR STAR IS AUG STAR
YOU AGE IS 22

PL/SQL procedure successfully completed.


BUT NOW I WANT TO RESULT LIKE THIS

INPUT THE ANY DATE:
OUTPUT LOOK LIKE
YOUR DAY OF BIRTH IS <DAY NAME> AND YOU ARE 99 OLD
YOUR ZODIAC SIGN IS <ZODIAC> SIGN
Re: PL/SQL any on help me 4 thissss [message #435008 is a reply to message #435006] Sun, 13 December 2009 11:44 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
my date of birth is 07-08-09.
how many days old am I?
Re: PL/SQL any on help me 4 thissss [message #435009 is a reply to message #435006] Sun, 13 December 2009 11:55 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What is "&d"?

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Regards
Michel
Re: PL/SQL any on help me 4 thissss [message #435063 is a reply to message #435008] Mon, 14 December 2009 01:56 Go to previous messageGo to next message
m.waqask
Messages: 4
Registered: December 2009
Location: KARACHI
Junior Member
BlackSwan wrote on Sun, 13 December 2009 22:44
my date of birth is 07-08-09.
how many days old am I?



yes my date of birht and how old i`m but not days
show my zodiac sign as well
Re: PL/SQL any on help me 4 thissss [message #435064 is a reply to message #435009] Mon, 14 December 2009 02:01 Go to previous messageGo to next message
m.waqask
Messages: 4
Registered: December 2009
Location: KARACHI
Junior Member
Michel Cadot wrote on Sun, 13 December 2009 22:55
What is "&d"?

Please read Forum Guide[/url], especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Regards
Michel



i defined D as D=DBMS_OUTPUT.PUT_LINE

Re: PL/SQL any on help me 4 thissss [message #435066 is a reply to message #435063] Mon, 14 December 2009 02:40 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
m.waqask wrote on Mon, 14 December 2009 08:56
BlackSwan wrote on Sun, 13 December 2009 22:44
my date of birth is 07-08-09.
how many days old am I?



yes my date of birht and how old i`m but not days
show my zodiac sign as well

You didn't answer BlackSwan question.
How old is she?

By the way, a year is NOT 365 days.
Here's some clues: How to get the difference between 2 dates in format years/months/days

Regards
Michel

Previous Topic: XMLTYPE : CAST(MULTISET....) help ^^
Next Topic: identify negative values
Goto Forum:
  


Current Time: Sun Dec 04 12:39:23 CST 2016

Total time taken to generate the page: 0.03868 seconds