From: Brian Candler Date: 2007-06-28T18:17:24+09:00 Subject: Re: how to get data from database as string > Thank you for your response, Brian. Actually what i am trying to do is > that use the string value I get from DB as an argument in another > statement. eg: > > conn = OCI8.new('user', 'pwd', 'testingDB.com') > cursor=conn.exec("Select name > From empl > Where ssn=123456789") r = cursor.fetch # fetch just one row > cursor.close > conn.logoff > > myLogin1 = Login.new myLogin1.setup("http://www.testing.com/", r[0], "pwd") That's one solution. Useful for debugging is 'puts r.inspect', or 'p r' for short, to see what r actually contains. Or you might write: cursor = conn.exec("Select username, password from foo where id=1234") username, password = *cursor.fetch cursor.close myLogin1.setup("http://www.testing.com/", username, password) Or: cursor = conn.exec("Select username, password from foo where id=1234") row = cursor.fetch_hash cursor.close myLogin1.setup("http://www.testing.com/", row['USERNAME'], row['PASSWORD']) Brian.