Using Oracle Sys_GUID() to create primary keys...Can it work?

Posts   
 
    
geckoman7
User
Posts: 6
Joined: 23-Feb-2005
# Posted on: 31-Aug-2005 23:35:38   

I am trying to make use of the new .NET 2.0 Membership/Role architecture. The design seems to prefer using a guid as a primary key value for a table. Seems to make sense, but I not sure about using a RAW datatype. Does anyone know if LLBLGen can make use of a RAW datatype. Can you query it? Compare it? Is there a good work around? Say, maybe using a varchar?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 01-Sep-2005 10:18:55   

RAW is a bin blob if I'm not mistaken (my oracle docs are on the oracle box which isn't booted up now). I never ran into Sys_GUID before, but after some googling, it seems to return RAW(16), which is perfectly usable for a guid, I never knew that! RAW is a type you won't run into that much.

Though as with NEWID() (the sqlserver equivalent): these functions aren't supported by LLBLGen Pro, as the value they generate isn't easily read back. So you set the field of the entity in .NET code to a new GUID value, (in your case at the moment you have to grab the bytearray of the guid) then save the entity.

Though a warning is in order: RAW is threated by Oracle as VARCHAR2, though with binary values. I read several threads where seasoned Oracle DBA's warn for this and suggest to avoid RAW. I can only agree. Consider a CHAR(32) field instead.

Frans Bouma | Lead developer LLBLGen Pro