swarna np wrote:
> Hi All,
> 
> I am using Oracle as by DBMS and Python for front end.
> 
> I am having a problem with 'Raw' data type of Oracle, it is as follows:
> 
> 1. When I fetch a column whose type is 'Raw' it's being formatted.
> For ex:  The value in the DB is : FEEDEE007F91500D9638994600A3C50C'
> But the python prints it
> as:''\xfe\xed\xee\x00\x7f\x91P\r\x968\x99F\x00\xa3\xc5\x0c'
> 
> I want to use the same value in my select statement later.
> I am not sure how to get back the original raw value from the formatted
> string by Python.
> 
> Can you please help me out?
> 
> Thanks,
> Swarna
> 
> ------------------------------------------------------------------------
> Here’s a new way to find what you're looking for - Yahoo! Answers
> <http://us.rd.yahoo.com/mail/in/yanswers/*http://in.answers.yahoo.com/>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32

That is the value.  Since binary data doesn't print well, Python  prints
the hex representation of each of the characters and puts \x in front of
them so you will know that the string doesn't contain those characters
but the hex they represent. Your database printed the hex representation
but didn't give you any visual queue that would let you tell the difference
between hex and ASCII characters.  You are just "supposed to know" that
a raw column contains binary data.

database   'FE  ED  EE  00  7F  91 500D   968  99 46  00  A3  C5  0C'
Python   '\xfe\xed\xee\x00\x7f\x91 P\r  \x968\x99 F \x00\xa3\xc5\x0c'

These are the same binary strings and are therefore completely
equivalent.  They represent exactly the same 1's and 0's in
a raw column in the database.

-Larry

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to