Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle and RTF data
On Mon, 21 Jul 2003 18:13:33 +0200, "S. Radic" <s.radic_at_wanadoo.nl> wrote:
>When a text object is stored with rtf characters in
>data field how do you get the text to display without the rtf characters
>displaying. Is there a function in Oracle to do this?
Yes, Oracle Text can do this.
http://download-west.oracle.com/docs/cd/B10501_01/text.920/a96518/cdocpkg.htm#12729
You need a context index with the INSO filter on the RTF document column in order to use it.
e.g.
create table RTFDOCUMENT
(
ID NUMBER not null, DOC CLOB not null,
[insert an RTF document with id=1 using dbms_lob.loadclobfromfile or whatever]
SQL> create index rtfdocument_tx1 on rtfdocument (doc) indextype is ctxsys.context parameters ('filter ctxsys.INSO_FILTER');
Index created
SQL> declare
2 v_doc clob; 3 v_plain clob; 4 r number; 5 begin 6 select id, doc 7 into r, v_doc 8 from rtfdocument 9 where id = 1 for update; 10 11 dbms_lob.createtemporary(v_plain, true); 12 dbms_lob.append(v_plain, v_doc); 13 14 ctx_doc.filter('RTFDOCUMENT_TX1', to_char(r), v_plain, plaintext =>true);
PL/SQL procedure successfully completed
SQL> commit;
Commit complete
[plain_doc now contains a plain text version of the RTF document].
It seems a bit over-enthusiastic with newlines, but it certainly works.
-- Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk) Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)Received on Mon Jul 21 2003 - 15:26:52 CDT