-
Notifications
You must be signed in to change notification settings - Fork 849
/
Copy pathchinese_msword_file.sql
executable file
·44 lines (26 loc) · 1.37 KB
/
chinese_msword_file.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- example of a testcase on an MS Word file using Chinese characters
-- to see the characters in SQL*Plus you will need to set NLS_LANG before
-- starting SQL*Plus, eg:
-- export NLS_LANG=american_america.al32utf8
-- this example uses FILE_DATASTORE and the CHINESE_VGRAM_LEXER
-- it relies on a MSWord file /mnt/s/NLP.docx - change path and file to a
-- suitable Chinese text file
connect sys/password as sysdba
drop user chtest cascade;
create user chtest identified by chtest;
grant connect,resource,ctxapp,unlimited tablespace to chtest;
-- in 19c you would use:
grant text datastore access to chtest;
-- in 11c and earlier you would use this instead:
-- exec ctxsys.ctx_adm.set_parameter('FILE_ACCESS_ROLE', 'CTXAPP')
connect chtest/chtest
create table mydocs (id number primary key, filename varchar2(2000));
insert into mydocs values (1, '/mnt/s/NLP.docx');
exec ctx_ddl.create_preference('mylexer', 'CHINESE_VGRAM_LEXER')
create index mydocsind on mydocs(filename)
indextype is ctxsys.context
parameters( 'lexer mylexer datastore ctxsys.file_datastore' );
select * from ctx_user_index_errors;
select filename from mydocs where contains( filename, '验班') > 0;
select filename from mydocs where contains( filename, '我们运用语') > 0;
select filename from mydocs where contains( filename, '我们运用语 AND 象显示我') > 0;