BLOB-Problem

General discussion forum about all databases other than SqlBase.
Reinhard

BLOB-Problem

Post by Reinhard » 25 Feb 2013, 07:24

Description in GUPTA-Help

bOk = SqlSetLongBindDatatype( nBindVarNumber, nDatatype )

Sets the column data type (Text or Long Binary) that a Long String value is bound to.
By default, Gupta binds Long Strings to the Text column data type. To write or update a Long Binary column instead, bind the Long String data to the Long Binary column data type by calling SqlSetLongBindDatatype and setting nDatatype to 23 (long binary column data). To set the binding back to the Text column data type, call this function and set nDatatype to 22 (Text column data).

If I try this, I get ORA-01461. Does anyone have a solution ?

Best regards

Reinhard

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3207
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: BLOB-Problem

Post by Dave Rabelink » 25 Feb 2013, 09:09

What is the exact definition of the column in Oracle?
Is Oracle storing text in ANSI or UNICODE?
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Sunil

Re: BLOB-Problem

Post by Sunil » 25 Feb 2013, 13:13

TO Save/Retrieve BLOB data in Oracle table , try this.

!!CB!! 136
Long String: vBinData

//insert into
!!CB!! 70
Call SqlPrepare( hSql, "insert into msg(msgbox) values (:vBinData)" )
Call SqlSetLongBindDatatype( 1,23 )
Call SqlExecute( hSql )

// to retrieve BLOB , try this.
!!CB!! 70
Call SqlPrepare( hSql, "select msgbox from smsg where controlno = :vControlNo into :vBinData" )
Call SqlSetLongBindDatatype( 1, 23 )
Call SqlExecute( hSql )
Call SqlFetchNext( hSql, nError )

in our case, this is working fine for us , write / retrieve , you can try Dave.

Regards.
Sunil

Sunil

Re: BLOB-Problem

Post by Sunil » 25 Feb 2013, 13:50

Oracle Stored in Oracle using Blob datatype in Binary format ( 8 bit ).

Regards.
Sunil

holger.mueller
Austria
Posts: 198
Joined: 28 Aug 2017, 09:36
Location: Brunn am Gebirge, Austria

Re: BLOB-Problem

Post by holger.mueller » 27 Feb 2013, 20:17

We do it like this (BLOB, Data stored in a long string), first INSERT with EMPTY_BLOB, then UPDATE with the data

For both handles you have to define the buffer
Call SqlSetParameterAll ( ghSqlDML_I_csd_blob, DBP_ORAUSELOB, 1, "1", TRUE )
Select Case SqlSetParameterAll ( ghSqlDML_I_csd_blob, DBP_LONGBUFFER, <inDBP_LONGBUFFER_BLOB>, STRING_Null, TRUE)

Call SqlSetLongBindDatatype ( 1, 23 )
If Not SqlPrepareAndExecute
(
ghSqlDML_I_csd_blob,
"INSERT INTO
csd_blob
(
csd_blob_data,
csd_blob_id,
csd_apl_id,
csd_mandt_id,
csd_blob_alias,
csd_blob_text,
csd_blob_type,
csd_prg_ext_id,
csd_blob_fl_ne,
insertuser,
insertclient,
insertdate,
updateuser,
updateclient,
updatedate,
history
)
VALUES
(
EMPTY_BLOB(),
:inDB_csd_blob_id,
:inDB_csd_apl_id,
:inDB_csd_mandt_id,
:isDB_csd_blob_alias,
:isDB_csd_blob_text,
:isDB_csd_blob_type,
:inDB_csd_prg_ext_id,
:ibDB_csd_blob_fl_ne,
:gObjectDB_csd_usr.isDB_csd_usr_alias,
:gObjectDB_csd_cl.isDB_csd_cl_alias,
SYSDATE,
:gObjectDB_csd_usr.isDB_csd_usr_alias,
:gObjectDB_csd_cl.isDB_csd_cl_alias,
SYSDATE,
0
)"
)

!!CB!! 129
Set nBufferLength = SalStrGetBufferLength ( ilsDB_csd_blob_data )
Select Case SqlSetParameterAll ( ghSqlDML_U_csd_blob, DBP_LONGBUFFER, nBufferLength + 1, STRING_Null, TRUE)
Case 0
Call gObjectSqlMan.cFcSqlDisconnect ( ghSqlDML_U_csd_blob )
Return FALSE
Break
!
Call SqlSetLongBindDatatype ( 1, 23 )
If Not SqlPrepareAndExecute
(
ghSqlDML_U_csd_blob,
"UPDATE
csd_blob
SET
csd_blob_data = :ilsDB_csd_blob_data
WHERE
csd_apl_id = :inDB_csd_apl_id AND
csd_mandt_id = :inDB_csd_mandt_id AND
csd_blob_id = :inDB_csd_blob_id"
)

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests