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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Question for you Oracle Guru's -- conversion of SQL to Ora

Re: Question for you Oracle Guru's -- conversion of SQL to Ora

From: Niall Litchfield <niall.litchfield_at_dial.pipex.com>
Date: Wed, 22 Dec 2004 06:38:59 -0000
Message-ID: <41c91680$0$16583$cc9e4d1f@news-text.dial.pipex.com>


"bagieta" <bagieta21_at_poczta.onet.pl> wrote in message news:cqa3el$ch0$1_at_opal.icpnet.pl...
> I'm not a Oracle guru, but I use rowid sometimes and can tell you about it
> that what I know.
>
>
>> table. I know RowId exists in Oracle but I have forgotten how to use
>> it, i.e. do I have to maintain a sequence in pl/sql to use it?
>
> No you don't have to use any sequence.
> You can use rowid in query just like identity:
>
> MSSQL - select @@identity, t.* from table t
> ORACLE - select rowid, t.* from table t
>
> you can do now something like
>
> update table
> set
> col1 = :col1,
> col2 = :col2
> where
> rowid = :old_rowid
>
> Remember that rowid is unique for the given query (it is not like oid in
> postgresql - unique for any table tuple). So when you finish your
> transaction and then call SELECT once again then the rowid value will be
> different.

Not *will* be different. *might* be different. Rowid is effectively a pointer to the physical location of the row. If the row *moves* then its rowid will change, if it doesn't it won't. http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10743/datatype.htm#sthref3893

sequences are the mechanism for achieving the equivalent of identity (ie a guaranteed unique key).

-- 
Niall Litchfield
Oracle DBA
http://www.niall.litchfield.dial.pipex.com
Received on Wed Dec 22 2004 - 00:38:59 CST

Original text of this message

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