Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> interesting ...

interesting ...

From: bunyamin karadeniz <bunyamink_at_havelsan.com.tr>
Date: Mon, 18 Sep 2000 14:23:10 +0300
Message-Id: <10683.122364@fatcity.com>


This is a multi-part message in MIME format.

------=_NextPart_000_00EC_01C0217B.F8DA6450 Content-Type: text/plain;

        charset="iso-8859-9"
Content-Transfer-Encoding: quoted-printable

 I have a stored procedure =20

PROCEDURE den1 (a IN number) as
b number;=20
begin=20

    b :=3D a;=20
    dbms_output.put_line(b*5);
end;

And I use accept command of sql plus.=20

 ACCEPT datehired DATE FORMAT 'dd/mm/yy' DEFAULT '11/11/1111' PROMPT = 'enter the date:' ;
I enter 11/12/99 when asks me to enter the date .

Wrote define and seen that datehired parameter is char.

And then I executed the den1 procedure by passing the datehired = parameter (which is date ) by=20
 EXEC den1(&datehired);=20

And did not give an error although it had shown that ( when =FD wrote = define) it is a char parameter and I wanted to pass a char to a number = ..

Result is interesting .

,0462962962962962962962962962962962962963 which is equal to 11/12/99.

Why ????
Why did the procedure take the char '11/12/99' as a number 11/12/99 ?? =20



Bunyamin K. Karadeniz
Enformasyon Teknolojileri Dir.
Veri Taban=FD Grubu tel : 2873565/1681
HAVELSAN=20

------=_NextPart_000_00EC_01C0217B.F8DA6450 Content-Type: text/html;

        charset="iso-8859-9"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-9" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#a6caf0>
<DIV><FONT face=3DArial size=3D2>&nbsp;I have a stored procedure&nbsp; =
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>PROCEDURE den1 (a IN number) as<BR>b =
number;=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>begin </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; &nbsp; b :=3D a; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; &nbsp;=20

dbms_output.put_line(b*5);</FONT></DIV>

<DIV><FONT face=3DArial size=3D2>end;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>And I use accept command of sql plus. =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;ACCEPT =
datehired&nbsp;DATE&nbsp;FORMAT=20
'dd/mm/yy'&nbsp;DEFAULT '11/11/1111'&nbsp;PROMPT 'enter the date:'=20 ;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I enter 11/12/99 when asks me to enter =
the date=20
.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Wrote define and seen that datehired =
parameter is=20
char.</FONT></DIV>

<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>And then&nbsp;I&nbsp; executed the den1 =
procedure=20
by passing the datehired parameter (which is date ) = by&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial=20

size=3D2>&nbsp;EXEC&nbsp;den1(&amp;datehired);&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>And did not give an error although it =
had shown=20
that ( when =FD wrote define) it is a char parameter and I wanted to = pass a char=20
to a number ..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Result is interesting .</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial=20

size=3D2>,0462962962962962962962962962962962962963&nbsp;&nbsp;&nbsp; = which is=20
equal to 11/12/99.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Why ????</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Why did the&nbsp;procedure take the =
char=20
'11/12/99'&nbsp; as a number 11/12/99&nbsp; ??</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;<BR></DIV></FONT>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>**********************************************<BR>Bunyamin K.=20
Karadeniz<BR>Enformasyon Teknolojileri Dir.<BR>Veri Taban=FD Grubu tel : =

2873565/1681<BR>HAVELSAN=20 Received on Mon Sep 18 2000 - 06:23:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US