Oracle (interMedia) Text Scripts

Demo thesaurus functionalities

set serveroutput on declare ths_exists number := 0; begin — Create a DEFAULT thesaurus if it doesn’t already exists select 1 into ths_exists from CTX_USER_THESAURI where THS_NAME = ‘DEFAULT’; if ths_exists = 0 then ctx_thes.create_thesaurus(‘DEFAULT’, FALSE); end if; — Relate COLOR and COLOUR… ctx_thes.create_relation(‘DEFAULT’,’colour’,’SYN’,’color’); — Relate ORGANISE with ORGANIZE… ctx_thes.create_relation(‘DEFAULT’,’organise’,’SYN’,’organize’); end; / — Create a…

Load operating system files into Oracle database tables

set serveroutput on — Create a table to load file into… drop table cv_emp; create table cv_emp(id number, cv clob); — Create a directory pointing to the files we need to load… create or replace directory CV_TEXT as ‘/tmp/’; declare v_text_loc CLOB; v_file_loc BFILE; v_file_len number; v_file_name varchar2(30) := ‘mycv.txt’; begin insert into cv_emp values(1,…

Demo the creation and maintenance of text indexes

connect scott/tiger exec CTX_OUTPUT.START_LOG(‘/tmp/frank’); — Create a table and populate with values… drop table emp_cv; create table emp_cv (id number, cv clob); insert into emp_cv values (1, ‘My CV, Frank Naude’); commit; — Create a CTX index… create index cv_ind on emp_cv(cv) indextype is ctxsys.context; — Insert more values into table… insert into emp_cv values…

Install Oracle Context on a database

connect SYS AS SYSDBA — Run drdsys.sql to remove peviously installed CTX components @?/ctx/admin/dr0dsys — Run drcsys.sql with args USERNAME DEFAULT_TABLESPACE TEMPORARY_TABLESPACE @?/ctx/admin/dr0csys.sql ctxsys users temp connect ctxsys/ctxsys — Run dr0inst.sql, with arg – your CTX library (this one is for HP-UX) @?/ctx/admin/dr0inst /app/oracle/product/8.1.7-32b/ctx/lib/libctxx8.sl — Run drdefXX.sql to install language, XX = {us, uk, …}…