Home » RDBMS Server » Server Administration » rowid type and varchar2 type issue (11.1.0.7 windows xp)
rowid type and varchar2 type issue [message #528685] Wed, 26 October 2011 07:29 Go to next message
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 #528687 is a reply to message #528685] Wed, 26 October 2011 07:39 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
But can a rowid datatype contain a varchar2? Take your test to the next level.
Re: rowid type and varchar2 type issue [message #528688 is a reply to message #528685] Wed, 26 October 2011 07:42 Go to previous message
ThomasG
Messages: 3211
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.
Previous Topic: create view with parameters
Next Topic: seting *_area_size parameter
Goto Forum:
  


Current Time: Fri Mar 29 01:45:14 CDT 2024