Storing Oracle DB table's ROWID as a character array

159 Views Asked by At

I would like to retrieve ROWID of a table from Oracle DB and store in memory as a character array for later use. For example, I run the following query:

SELECT ROWID, MARKS FROM MTB WHERE EID='123';

Then using Pro*C, I would like to store this ROWID as a character array rrr to use later as:

UPDATE MTB SET MARKS = 80 WHERE ROWID='<rrr>'

Please help and point to appropriate documentation of Pro*C usage to convert a ROWID to an array of character strings.

1

There are 1 best solutions below

0
On BEST ANSWER

You can use the ROWIDTOCHAR and CHARTOROWID functions:

SELECT ROWIDTOCHAR(ROWID), MARKS INTO :rrr, :marks FROM MTB WHERE EID='123';

And then

UPDATE MTB SET MARKS = 80 WHERE ROWID=CHARTOROWID(:rrr);