Link to home
Start Free TrialLog in
Avatar of Deepa S
Deepa S

asked on

Foxpro memo to Oracle Blob

I have a foxpro v9 memo field and i want to update that in oracle table blob field
Below sample code

--Open foxpro table
lcAlias = Sample.dbf
Use Sample.dbf

-- read memo field
lcBin = &lcAlias..blobdata

--convert to Blob
pcBin =  CAST(lcBin as Blob)

--Connect oracle
odb = sqlstringconnect("Driver={Oracle in OraClient11g_home1};Dbq=XXXXX;")
lcSQLString = "UPDATE oracletable SET m_blob = " + pcBin + " where id = 1;"
lresult=sqlexec(odb, lcSQLString, "Result")
IF lresult>0 THEN
   messagebox("yes")
ELSE
  *-- Collect error info
  AERROR(laErr)
  *-- Display error info on the screen
  DISPLAY MEMORY LIKE laErr
  *-- or save the error info into text file
  LIST MEMORY LIKE laErr TO FILE SQLError.txt
ENDIF
=SQLDisconnect(odb)

Am getting below error message - might be becoz i didnt pass the single quotes for pcBin
[Oracle][ODBC][Ora]ORA-00972: identifier is too long

If i put quotes for pcBin, foxpro prg hang at sqlexec
lcSQLString = "UPDATE oracletable SET m_blob = '"+ pcBin +"' where id = 1;"
lresult=sqlexec(odb, lcSQLString, "Result")

Tried below code, then also it freeze
lcBin = &lcAlias..blobdata
CURSORSETPROP("MapBinary",.T.,0)
lcSQLString = "UPDATE oracletable SET m_blob = '"+ lcBin +"' where id = 1;"
lresult=sqlexec(odb, lcSQLString, "Result")
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Deepa S,

did you test the solution? Does it work for you? Do you need any other assistance?

Thanks
Pavel
Hi Deepa S,

we are still waiting for your response.

Thanks
Passing the long literals as ?variable works reliably in many different environments and Oracle does not mean exception here.