Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Insert Excel table request output into Oracle table BLOB

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Insert Excel table request output into Oracle table BLOB
 Login/Join
 
Member
posted
Has anyone a working example of how to insert an Excel document as a BLOB in an Oracle table?

This message has been edited. Last edited by: Kerry,
 
Posts: 5 | Location: IBI - Chicago Consulting | Registered: February 08, 2005Report This Post
Expert
posted Hide Post
Would this question be better suited to an Oracle forum ?

WF does not handle BLOBs very well.

Iway could probably do it.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
<JG>
posted
Based on this simple table

 
CREATE TABLE blobtable_BLOB
(
  ATTACHMENT_ID    NUMBER,
  ATTACHMENT_NAME  VARCHAR2(255 BYTE),
  ATTACHMENT       BLOB
);

 


Create a package in oracle

 
CREATE OR REPLACE PACKAGE          blobload AS
   PROCEDURE blob_BLOB_LOAD(
PATTACHMENT_ID IN NUMBER,
PATTACHMENT_NAME IN VARCHAR2);
   END;
/

CREATE OR REPLACE PACKAGE BODY          blobload AS
   PROCEDURE blob_BLOB_LOAD(
PATTACHMENT_ID NUMBER,
PATTACHMENT_NAME VARCHAR2) IS

src_file BFILE;
dst_file BLOB;
lgh_file BINARY_INTEGER;
BEGIN
src_file := bfilename('blobUPLOAD', PATTACHMENT_NAME);

-- insert a NULL record to lock
 INSERT INTO blobtable_BLOB
 (ATTACHMENT_ID,ATTACHMENT)
 VALUES (PATTACHMENT_ID,EMPTY_BLOB())
 RETURNING ATTACHMENT INTO dst_file;

-- UPDATE blobtable_BLOB
-- SET ATTACHMENT  = EMPTY_BLOB()
-- WHERE ATTACHMENT_ID = PATTACHMENT_ID 
-- RETURNING ATTACHMENT INTO dst_file;

-- lock record
SELECT ATTACHMENT
INTO dst_file
FROM blobtable_BLOB
WHERE ATTACHMENT_ID = PATTACHMENT_ID
FOR UPDATE;

-- open the file
dbms_lob.fileopen(src_file, dbms_lob.file_readonly);

-- determine length
lgh_file := dbms_lob.getlength(src_file);

-- read the file
dbms_lob.loadfromfile(dst_file, src_file, lgh_file);

-- update the blob field
UPDATE blobtable_BLOB
SET ATTACHMENT = dst_file , ATTACHMENT_NAME  =  PATTACHMENT_NAME
WHERE ATTACHMENT_ID = PATTACHMENT_ID;
-- close file
dbms_lob.fileclose(src_file);
END blob_BLOB_LOAD;
   END blobload;
/

 


To load the image, excel or anything via WF

 
SQL SQLORA 
EX oracleuserid.blobload.blob_BLOB_LOAD('index in table blobtable_BLOB,' ','fully qualified filename); 
END 
-RUN  

This message has been edited. Last edited by: <JG>,
 
Report This Post
Virtuoso
posted Hide Post
Bill, for JG's solution to work (nice one by the way) keep in mind that the Excel (or whatever binary) file must be accessible to the Oracle server (either locally or through sharing services such as NFS, Samba, ...).

Since you want to initiate the load from WebFOCUS I am assuming that you probably will have a WebFOCUS process creating a HOLD/SAVE file in Excel format to later be uploaded into Oracle so, unless both the WF Reporting Server and the Oracle Server "live" in the same box you'll have to make additional arrangements so your HOLD file gets transferred to some location Oracle can "see". One such thing could be, for example, scheduling your report through Report Caster and choosing FTP to distribute the final file. Just an idea!



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Insert Excel table request output into Oracle table BLOB

Copyright © 1996-2020 Information Builders