I am trying to take a picture from URL and insert it on a table. My code as follows:
pic = Image.open(urllib.request.urlopen( picurl ))
stream = io.BytesIO()
pic.save(stream, format="PNG")
pichex = stream.getvalue()
cursor.execute( "INSERT INTO GENELOC( GENE_CODE, CYT_LOC , CYT_POS , CHRM_CODE , CHRM_ARM_CODE , BP_START , BP_END , GENE_PICT ) VALUES( :1 , :2 , :3 , :4 , :5 , :6 , :7 , utl_raw.cast_to_raw(:8) )",(genecode, cytloc, cytpos, chrmcode, chrmarmcode, bpst, bpend, pichex ))
con.commit()
and when I try this I get this error message:
cx_Oracle.DatabaseError: ORA-01461: can bind a LONG value only for insert into a LONG column
GENE_PICT column is a BLOB column. Thanks for any help.
UTL_RAW.CAST_TO_RAW? See e.g. stackoverflow.com/questions/50679128/…CAST_TO_RAWcomplaining that its argument is a BLOB, not a VARCHAR2.