Solved

Reading Blob by crystal report

Posted on 2008-10-26
2
2,284 Views
Last Modified: 2013-11-16
Hi experts,

I'm upgrading JDE from Xe to 8.12 and found that the spec of F00165 has been changed. Text attachment was stored as long string in rtf format but now has become blob. I'm using crystal report to get the text attachment but now it doesn't work. Can anyone enlighten me how to do it with blob?
0
Comment
Question by:kennysflau
  • 2
2 Comments
 
LVL 47

Accepted Solution

by:
schwertner earned 500 total points
Comment Utility
Read this:

http://www.jdelist.com/ubb/showflat.php?Cat=0&Board=Crystalreports&Number=123971&page=0&view=collapsed&sb=7&o=&fpart=1



The view looks like this:

------------------------------------------------------
connect PRODDTA/XXXXXX@XXXXXX;
CREATE OR REPLACE VIEW f00165_view(
NameObject_GDOBNM ,
GenericTextKey_GDTXKY ,
SeqNo_GDMOSEQN ,
MediaObjType_GDGTMOTYPE ,
LanguagePreference_GDLNGP ,
UpdatedByUser_GDUSER ,
DateUpdated_GDUPMJ ,
TimeOfDay_GDTDAY ,
ObjectTypeName_GDGTITNM ,
QueueName_GDQUNAM ,
FileName_GDGTFILENM ,
MediaObjectVariableLeng_GDTXVC)
AS SELECT
GDOBNM,
GDTXKY,
GDMOSEQN,
GDGTMOTYPE,
GDLNGP,
GDUSER,
JDE2Date(GDUPMJ),
GDTDAY,
GDGTITNM,
GDQUNAM,
GDGTFILENM,
JDETextFix(ROWID)
FROM F00165
WHERE GDGTMOTYPE = 0
WITH READ ONLY;
---------------------------------------------------------------------

Note that there are 2 Oracle Function Calls in this select.
The first one, JDE2DATE, just converts the JDE Julian Date to a standard date.
The second, JDETextFix(ROWID), does data type conversion on the BLOB data field. Here's the function I wrote to do this:
---------------------------------------------------------------------
CREATE OR REPLACE FUNCTION "PRODDTA"."JDETEXTFIX" (p_rowid in
ROWID) RETURN VARCHAR2
IS
v_textout VARCHAR2(4000);
v_lob BLOB;
v_buffer RAW(8192);
v_offset INTEGER := 1;
v_textlen BINARY_INTEGER := 8192;
v_rawlen NUMBER;
v_from_set RAW(2);
v_to_set RAW(1);
v_output RAW(8192);
BEGIN
SELECT gdtxft INTO v_lob
FROM F00165 where ROWID = p_rowid;
DBMS_LOB.READ (v_lob, v_textlen, v_offset,v_buffer);
v_textout := ' ';
v_from_set := HEXTORAW('7D00');
v_to_set := HEXTORAW('7D');
v_output := UTL_RAW.TRANSLATE (v_buffer, v_from_set, v_to_set);
v_rawlen := UTL_RAW.LENGTH (v_output);
if (v_rawlen > 4000) then
v_rawlen := 4000;
end if;
if (v_rawlen > 0) then
v_textout := UTL_RAW.CAST_TO_VARCHAR2 (UTL_RAW.SUBSTR(v_output,1,v_rawlen));
end if;
RETURN (v_textout);
EXCEPTION WHEN NO_DATA_FOUND THEN
RETURN (v_textout);
END;
0
 
LVL 47

Expert Comment

by:schwertner
Comment Utility
Thank you very much!
Good luck!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to take different types of Oracle backups using RMAN.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now