1

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.

Dr. Debasish Jana
  • 6,980
  • 4
  • 30
  • 69
  • You mean [rowidtochar](http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions157.htm#SQLRF06101) and [chartorowid](http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions025.htm#SQLRF00615)? Or something specific to C/Pro\*C? – Alex Poole Feb 04 '16 at 13:43
  • do you mean to use ROWIDTOCHAR(ROWID) instead of ROWID? – Dr. Debasish Jana Feb 04 '16 at 13:46

1 Answers1

2

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);
Alex Poole
  • 183,384
  • 11
  • 179
  • 318