rowid type and varchar2 type issue [message #528685] |
Wed, 26 October 2011 07:29 |
andy huang
Messages: 498 Registered: July 2011
|
Senior Member |
|
|
Dear all,
Rowid type is one of data types in oracle,is it equal to the varchar2,the flowing test show varchar2 type can contain rowid type.
SQL> Declare
2 L_Rowid1 Varchar2(18);
3 L_Rowid2 Rowid;
4 Begin
5
6 Select Rowid Into L_Rowid1 From Dual;
7 Dbms_Output.Put_Line('----Varchar2 Type-----');
8 Dbms_Output.Put_Line(L_Rowid1);
9
10 Select Rowid Into L_Rowid2 From Dual;
11 Dbms_Output.Put_Line('----Rowid Type-----');
12 Dbms_Output.Put_Line(L_Rowid2);
13 End;
14
15 /
----Varchar2 Type-----
AAAAB0AABAAAAOhAAA
----Rowid Type-----
AAAAB0AABAAAAOhAAA
|
|
|
|
Re: rowid type and varchar2 type issue [message #528688 is a reply to message #528685] |
Wed, 26 October 2011 07:42 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
Your logic is flawed. By that logic the date datatype would also be equal to the varchar2 datatype, which it isn't :
SQL> Declare
2 L_Date1 Varchar2(18);
3 L_Date2 Date;
4 Begin
5
6 Select sysdate Into L_Date1 From Dual;
7 Dbms_Output.Put_Line('----Varchar2 Type-----');
8 Dbms_Output.Put_Line(L_Date1);
9
10 Select sysdate Into L_Date2 From Dual;
11 Dbms_Output.Put_Line('----Date Type-----');
12 Dbms_Output.Put_Line(L_Date2);
13 End;
14 /
----Varchar2 Type-----
26-OCT-11
----Date Type-----
26-OCT-11
PL/SQL procedure successfully completed.
Just because a rowid can be CONVERTED to a varchar2 doesn't mean the data types are equal.
|
|
|