Oracle Text truncate words to 64 CHARS but token limit is 64 BYTES - oracle

I'm using Oracle 19c.
I have a table with a VARCHAR2(4000) column for which I'm creating a full-text index using Oracle Text.
The SQL creating the index is as follow:
begin
ctx_ddl.create_index_set('ix_iset');
ctx_ddl.create_preference('ix_pref', 'BASIC_LEXER');
ctx_ddl.set_attribute('ix_pref', 'skipjoins', '-');
ctx_ddl.set_attribute ( 'ix_pref', 'index_stems', 'portuguese');
ctx_ddl.set_attribute ( 'ix_pref', 'index_text', 'YES');
ctx_ddl.set_attribute ( 'ix_pref', 'base_letter', 'YES');
end;
CREATE INDEX ix_tx_column ON MYTABLE(tx_column)
INDEXTYPE IS CTXSYS.CTXCAT
PARAMETERS ('index set ix_iset lexer ix_pref');
Everything works very well, but when there is a word with more than 64 chars, an error is raised:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text Error:
DRG-50857: oracle error in dreii1fsh
ORA-12899: value too large for column "CAD"."DR$IX_TX_COLUMN$I"."DR$TOKEN" (actual: 65, maximum: 64)
ORA-06512: em "CTXSYS.DRUE", line 186
ORA-06512: em "CTXSYS.CATINDEXMETHODS", line 102
29855. 00000 - "error occurred in the execution of ODCIINDEXCREATE routine"
*Cause: Failed to successfully execute the ODCIIndexCreate routine.
*Action: Check to see if the routine has been coded correctly.
I've looked into the documentation and the only reference to this limitation is this item:
2.14 Token Limitations for Oracle Text Indexes
After some research I realized that probably the Oracle-Text internal functions are truncating the words to 64 CHARS, but the token limit is 64 BYTES.
The text word causing this error have Diacritical Characters within its first 64 chars like ç ã õ é and so on... Each char are 2 bytes in size.
I tried to set NLS_LENGTH_SEMANTICS=BYTE with no success.
As long as I researched, there is no way how to change the size of the index token.
Edit:
The result of SELECT * FROM v$nls_parameters is:

Related

Cannot create multi-column text index in Oracle

I'm trying to create a multi-column full-text index in Oracle but can't get it working. Here's what I have so far:
CREATE TABLE DOCS (
DOCS_ID NUMBER(32,0) NOT NULL,
COLA NVARCHAR2(100),
COLB NVARCHAR2(100),
COLC NVARCHAR2(100)
);
CALL ctx_ddl.create_preference('DOCS_MC_DATASTORE', 'MULTI_COLUMN_DATASTORE');
CALL ctx_ddl.set_attribute('DOCS_MC_DATASTORE', 'COLUMNS', 'COLA, COLB, COLC');
CREATE INDEX DOCSINDEX ON DOCS(COLA) INDEXTYPE IS ctxsys.context parameters ('DATASTORE DOCS_MC_DATASTORE sync(on commit)');
This return the following errors:
SQL Error [29855] [99999]: ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-11135: feature not generally available
ORA-06512: at "CTXSYS.DRUE", line 186
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 338
Update
Ignore the multi-column issue, can't even get the index to work:
CREATE INDEX DOCSINDEX ON DOCS(COLA) INDEXTYPE IS ctxsys.context;
Reports the exact same error. This is Oracle Express 21. Do I need to add something to the install?
In case anyone finds this. Can't use text indexing with Unicode NVARCHAR/NCHAR/NCLOB.

Why does my SQL code tell me that paddling is not a good identifier?

I AM ON CLOUD VERSION OF ORACLE
so what I need to do is insert data from an already established table into a new table. I am a student and I pretty much copied what they told me to do, just changing the table and what i need to grab
here is my code:
INSERT INTO PADDLING
SELECT TRIP_ID, TRIP_NAME, STATE, DISTANCE,
MAX_GRP_SIZE,
SEASON
FROM TRIP
WHERE TYPE = Paddling;
and here is the error
ORA-00904: "PADDLING": invalid identifier
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200200",
line 670
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1658
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200200",
line 656
ORA-06512: at
"APEX_200200.WWV_FLOW_DYNAMIC_EXEC", line 1768
4. WHERE TYPE = Paddling;
I tried PADDLING in all uppercase, however it is lowercase in the table i am grabbing from.
You want to quote the string literal :
INSERT INTO PADDLING
SELECT TRIP_ID, TRIP_NAME, STATE, DISTANCE,
MAX_GRP_SIZE,
SEASON
FROM TRIP
WHERE TYPE = 'Paddling';
If you do not have the quotes then Oracle assumes it is an identifier, typically for a column name. To show that it is a string literal and not an identifier you need to use single quotation marks.

ORA-12899 Error Too large String for Same column but success different tables

I am updating string to column of length 35 into two tables
first table update was success but second table give ORA error ORA-12899 Error Too large String
select length('Andres Peñalver D1 Palmar Sani salt') bytes from dual;
BYTES
----------
35
select lengthb('Andres Peñalver D1 Palmar Sani salt') bytes from dual;
BYTES
----------
36
Both tables colm1 field declared as VARCHAR(35), first table update fails and second one success.
update t
set colm1='Andres Peñalver D1 Palmar Sani Salt'
where value1='123456';
update t2
set colm1='Andres Peñalver D1 Palmar Sani Salt'
where value1='123456';
ORA-12899
select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
VALUE
----------------------------------------------------------------
AL32UTF8
let me know why this behaviour for these table which is having same column type
Check the actual columns size for both the tables in all_tab_columns.
35 Char is 3 times 35 bytes, and if one table's column is defined in char other in byte(during ddl) the size is different.
Normal characters like A-Z a-z take 1 byte to store but language specific characters take 3 byte to store.
The full error message as described in the error message documentation
should give you the answer:
$ oerr ora 12899
12899, 00000, "value too large for column %s (actual: %s, maximum: %s)"
// *Cause: An attempt was made to insert or update a column with a value
// which is too wide for the width of the destination column.
// The name of the column is given, along with the actual width
// of the value, and the maximum allowed width of the column.
// Note that widths are reported in characters if character length
// semantics are in effect for the column, otherwise widths are
// reported in bytes.
// *Action: Examine the SQL statement for correctness. Check source
// and destination column data types.
// Either make the destination column wider, or use a subset
// of the source column (i.e. use substring).
This is likely linked to character length semantics.

"ORA-12401: invalid label string: " error

I am trying to run a simple update statement in Oracle to modify an Integer field of a specific row.
UPDATE Mytable
SET field1 = 2
WHERE field2 = 11111;
But I receive this error
SQL Error: ORA-12401: invalid label string:
ORA-06512: at "LBACSYS.NUMERIC_LABEL_TO_CHAR", line 1
ORA-06512: at "LBACSYS.LBAC$BU0_92924", line 1
ORA-04088: error during execution of trigger 'LBACSYS.LBAC$BU0_92924'
12401. 00000 - "invalid label string: %s"
*Cause: The policy could not convert the label string to a valid
internal label.
*Action: Correct the syntax of the label string.
Google search did not bring much results. Do you have any idea about the solution of this error?

Hashing string in Oracle

I know there's a function to obtain the hash value from a varchar in Oracle, but when I run the query to see the returned value it sends the following message.
ORA-00904: : identificador no válido
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error en la línea: 70, columna: 7
What I'm doing is the following:
select DBMS_CRYPTO.hash(utl_raw.cast_to_raw('Foo'), 3) FROM dual;
It should return the SHA-1 of the string.
That works for me
SQL> select DBMS_CRYPTO.hash(utl_raw.cast_to_raw('Foo'), 3) FROM dual;
DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW('FOO'),3)
--------------------------------------------------------------------------------
201A6B3053CC1422D2C3670B62616221D2290929
Are you sure that the user that is running this has been granted EXECUTE access on both the UTL_RAW and the DBMS_CRYPTO packages? If line 70 of your code is this SELECT statement, I'd wager that column 7 is where the DBMS_CRYPTO call starts and that you don't have access to the DBMS_CRYPTO package.

Resources