When To Create an Index
Hi,
First pardon my generic question, but I am posting this after much frustration. When you create an index on a table, which thought process you follow? I mean instead of blindly throwing index on every column in where clause, how do you decide as whether to create index or not, type of index, composite index or not etc. Please do the favor and describe in simple words.
Thanks a million.
EdStevens wrote:
Antonio Navarro wrote:
Usually, a index is better where it return the same data more faster than a full scan
HTH"All else being equal"
But all else is never equal.
don't forget that every index you create causes additional overhead for every insert/update/delete statement on that table. So among other considerations you need to balance the negative impact of the index on DML statements vs. the sometimes positive impact on queries.Which means the only simple answer to the generic question on when to create an index is that there are no simple answers: http://jonathanlewis.wordpress.com/2010/05/11/philosophy-10/
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
A general reminder about "Forum Etiquette / Reward Points": http://forums.oracle.com/forums/ann.jspa?annID=718
If you never mark your questions as answered people will eventually decide that it's not worth trying to answer you because they will never know whether or not their answer has been of any use, or whether you even bothered to read it.
It is also important to mark answers that you thought helpful - again it lets other people know that you appreciate their help, but it also acts as a pointer for other people when they are researching the same question, moreover it means that when you mark a bad or wrong answer as helpful someone may be prompted to tell you (and the rest of the forum) what's so bad or wrong about the answer you found helpful.
Similar Messages
-
What is the "No database index" means when you Creating Secondary Indexes?
HI,
I'm Creating Secondary Indexes in the maintenance screen of the table(se11)
There are three options under "Non-unique Index":
1.Index on all database systems
2.For selected database systems
3.No database index
My questions is :
What do u mean by "No Database Index" and when is it used.
Can anybody plz tell me what's the difference of this three options ?
Here is what i found in the help:
No database index: The index is not created in the database. If you
choose this option for an index that already exists in the database,
it is deleted when you activate this option.Hi,
It is clear from the help documentation,
Here see what the help document says:
Create the index in the database (selection)
Whether an index improves or worsens performance often depends on the database system. You can therefore set whether an index defined in the ABAP Dictionary should be created in the database.
This makes it easier to install a platform-specific customer system.
You can set this option as follows:
1. Index in all database systems: The index is always created in the database.
2. In selected database systems: The index is created depending on the database system used. In this option, you must specify the databases in which the indexes are to be created. You can do this either on an inclusive (list of systems on which it should be created) or an exclusinve (list of systems on which it should not be created) basis. In either case, you can list up to four different database systems.
3. No database index:: The index is not created in the database. If you set this option for an index that already exists in the database, it is deleted when you activate the table in the ABAP Dictionary.
Note: Unique indexes have an extra function, and must therefore always be created in the database. The database system prevents entries or index fields being duplicated. Since programs may rely on this database function, you cannot delete unique indexes from the database.
Hope it helps you,
Regards,
Abhijit G. Borkar -
Problem when i create an index
Hello,
I'm a beginner on KM, and i have a simple problem (i think... ).
I want to create an index on Simple Web Repository (with 2 Web Adresses created) and i have the error : " The repository needs the properties service to be attached to a classification index ". So, i'm going to check "Simple Web Repository" configuration and i can see there is the 'properties' service in "Repository Services"...
Think it's nothing, but, i'm lost...Solution : Restart Servlet engine....
Sorry -
How to create secondry index on database table
how to create secondry index on database table
Hi
By trx SE11:
- Choose your table and press CHANGE ICON, so INDEX
When you create an index you should consider if your index is contained in another index.
If the fields of your index are:
- FIELD1, FLIED2, FIELD3
...it'll be triggered only if the select is:
SELECT * FROM <TABLE> WHERE FIELD1
AND FIELD2
AND FIELD3
A select like this
SELECT * FROM <TABLE> WHERE FIELD1
AND FIELD3
AND FIELD2
doesn't use your index.
Max -
Error when creating spatial index in 10g
Hello.
I have a problen when I try to create a spatial index. The strange thing is that the same commands always works fine in some machines, but if always fails in others. I tryed in diferent versiones of Oracle, but I have the error in al of them. The versions I have tryed are:
- 10.2.0.1
- 10.2.0.4
The operating systems are:
Windows XP professional 32 bits
Windows 2003 Server 32 bits
These are the steps i make:
1) Create a Table with a SDO_GEOMETRY column (GEOMETRY)
2) Load data with SQLLDR (I hve tryed different SRID's, and all fail)
So far everything is ok
3) Create the INDEX
When I execute the CREATE INDEX command CREATE INDEX MADRID_SX ON MADRID (GEOMETRY) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
I obtain the error:
ERROR en linea 1:+
ORA-29855: se ha producido un error en la ejecucion de la rutina+
ODCIINDEXCREATE+
ORA-13282: fallo al inicializar la transformacion de coordenadas+
ORA-06512: en "MDSYS.SDO_INDEX_METHOD_10I", line 10+
I too have noticed that if I execute the next command, I have an error:
SELECT MDSYS.sdo_cs.transform(sdo_geometry(2001,8192,sdo_point_type(13.6,52.4,null),null,null),25830) from dual;
ERROR en linea 1:+
ORA-13282: fallo al inicializar la transformacion de coordenadas+
ORA-06512: en "MDSYS.SDO_CS", linea 75+
ORA-06512: en "MDSYS.SDO_CS", linea 112+
ORA-06512: en "MDSYS.SDO_CS", linea 2678+
And if I execute the next command, I too have another error:
SELECT SDO_CS.VALIDATE_WKT(25830) FROM DUAL;
FALSE (169)*
Any ideas? Could it be related with something inside the machines, user privileges, etc.?
Thanks in advance.I have found that the problem is to use a SRID of AUTH_NAME column in MDSYS.CS_SRS table without the value "Oracle." in it.
If I use an Oracle’s SRID, everything works fine. If I use an EPSG’s SRID, fails.
For example, this command uses an Oracle SRID (8192) and one from the EPSG (25830), and fails:
SELECT MDSYS.sdo_cs.transform(sdo_geometry(2001,8192,sdo_point_type(13.6,52.4,null),null,null),25830) from dual;
ERROR en linea 1:
ORA-13282: fallo al inicializar la transformacion de coordenadas
ORA-06512: en "MDSYS.SDO_CS", linea 79
ORA-06512: en "MDSYS.SDO_CS", linea 116
ORA-06512: en "MDSYS.SDO_CS", linea 2690
However, if I use two Oracle SRID (8192 and 83030), it works.
SELECT MDSYS.sdo_cs.transform(sdo_geometry(2001,8192,sdo_point_type(13.6,52.4,null),null,null),83030) from dual;
SDO_GEOMETRY(2001, 83030, SDO_POINT_TYPE(1625183.71, 5936269.06, NULL), NULL, NULL
Therefore, the problem seems to be to use a non Oracle SRID. -
Numeric character problems when creating spatial index
Hi,
We have run into a problem when trying to create spatial indexes. The problem seems to be that an mdsys-procedure tries to use a number with a comma as decimal symbol in an update statement
Error message:
ERROR at line 1:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-13249: internal error in Spatial index: [mdidxrbd]
ORA-13249: Error in Spatial index: index build failed
ORA-13249: Stmt-Execute Failure: begin mdsys.prvt_idx.execute_update(NULL,NULL,'set sdo_rtree_quality = 1,00000000 where UPPER(sdo_index_owner) = UPPER(''BK'') AND UPPER(sdo_index_name)=UPPER(''TEST_RTREE_IDX'') AND UPPER(sdo_index_table)=UPPER(''MDRT_8120$'')',NULL); end;
ORA-29400: data cartridge error
ORA-01747: invalid user.table.column, table.column, or column specification
ORA-06512: at "MDSYS.PRVT_IDX", line 17
ORA-06512: at line 1
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 7
ORA-06512: at line 1
Our problem seems to be identical to the one discussed in this thread: create RTREE falied on 9.2.0.4
Regional settings, language versions etc:
Client:
OS: Windows 2000
Regional options (OS): Swedish, Sweden
Sqlplus (console and windows versions): v 9.2.0.1.0
Registry: NLS_LANG =SWEDISH_SWEDEN.WE8MSWIN1252
Server:
OS: Windows Server 2003
Regional options (OS): Swedish, Sweden
Oracle: v 9.2.0.3.0
Registry: NLS_LANG =SWEDISH_SWEDEN.WE8MSWIN1252
We have also tried building the indexes after overriding these settings by setting the environment variables NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1 on both the client- and the server computer. This gives exactly the same error. We have tried setting NLS_NUMERIC_CHARACTERS to '.,' instead of ',.', but this does not help either.
We haven't tried changing the NLS_LANG registry entry on the server, because this is a production server at a customer's site that hosts several other databases, so we would prefer not to have to restart it if we can avoid it. However, as we understand it, the environment variable NLS_LANG should override the registry setting anyway, right?
We first experienced the problem when trying to build indexes on imported data. To verify that the problem was not with the data, we wrote a simple test script that:
1)Creates a table
2)Creates metadata
3)Inserts a simple geometry
4)Tries to create an index
The error message above is from running this script. We have verified that the script
works ok on another database server.
Below are the values of some of the language parameters right before running the script
(we have tried many other settings with the same result).
parameter...........................db................................instance...............session
NLS_CHARACTERSET.......WE8MSWIN1252..................................................
NLS_LANGUAGE...............AMERICAN...................AMERICAN...........AMERICAN
NLS_NCHAR_CH...............AL16UTF16 ..........................................................
NLS_NCHAR_CONV... ......FALSE..........................FALSE..................FALSE..
NLS_NUMERIC_CH...---------.,---------------------------------------------------------------.,
NLS_TERRITORY..............AMERICA......................AMERICA..............AMERICA
The guy who started the thread referenced above solved the problem, but we haven't been able to get it working by changing registry entries and session parameters.
The question is: Which setting will make the number in 'set sdo_rtree_quality = 1,00000000...' be generated with a . instead of a , as decimal symbol?Ok, so here is my plan to solve this:
1) Change the default user locale (the language under "standards and formats") to English for the account under which the Oracle server runs.
2) Reboot (or is there an easier way to make Oracle reload the settings?)
This should make the index creation work. It may break something else however, so to avoid this I can set the user locale back to Swedish afterwards .
You can subsequently change the setting and update the sdo_rtree_quality in
the metadata and it should work fine. Do you mean I have to update the sdo_rtree_quality in some way to make it work after I have changed the default user locale back to Swedish? How do I do this?
Thanks a million both of you! -
Error when creating BIA INDEX FOR CUBE
Hi
I am trying to create BIA index for a cube and I am getting error
"An error occurred. Choose "Continue" to start again from the beginning" in the second step. Could any body explain what this error mean and How to correct it.
and when I press BIA Moniter tab I am getting following message.
An error occurred. Choose "Continue" to start again from the beginning
"BIA Monitor Is Called for First Time
The RFC destination for the BI accelerator is not yet specified in the
system. Without the relevant entry in RSADMINA, the BIA monitor cannot
be executed. Do you want to enter the RFC destination now?"
Thanks in Advance
Sarath
Edited by: sarath kumar on Aug 21, 2008 9:42 AMHi,
Is there any way i can check bi accelerator installed or not for our bi server.I contacted basis team but they do not have any idea regarding this. but I heard from my ex colleage it is installed. and Reports from one cube is running very fast compared to recently created cube.
Thanks
Sarath -
Rights issue when creating context index.
Hi,
We have two users, "app" and "appsys" . with most permissions granted through roles.
"app" has just enough permissions for the application to run. No update/delete/etc on most tables, just select and (on a select few) insert rights.
"appsys" is the "crew" user, with enough rights for basic day-to-day administration and most upgrade scripts that come with new code releases.
Other than that, it's a pretty much default EE 11.2.0.1.0.
Therefore, my first preference was to have 'appsys' create the desired text index for use by 'app':
CREATE INDEX app.table_text_ix ON app.table (xml)
INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS('SYNC (EVERY "TRUNC(SYSDATE + 1) + 03/24") TRANSACTIONAL');
Have also tried the bare:
CREATE INDEX app.table_text_ix ON app.table (xml)
INDEXTYPE IS CTXSYS.CONTEXT;
Both give the same result:
Error at Command Line:1 Column:19
Error report:
SQL Error: ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-50857: oracle error in drvxtab.create_index_tables
ORA-01031: insufficient privileges
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 366
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.
When using user app (temporarily granting relevant privileges):
ERROR at line 1:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-50857: oracle error in drvddl.IndexCreate
ORA-27486: insufficient privileges
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 366
I've tried granting just about anything but the kitchen sink to either user, both direct and indirect, but it still won't let me. Even SYS seems to be missing something.
Or rather, I seem to be missing something. But what? I've read a few prior threads about this issue and tried most suggestions: still no go.
Things I've GRANTed, as per documentation:
- CTXAPP role
- execute on ctxsys.ctx_ddl
- RESOURCE
- CONNECT
Other privileges it already had OR that I've tried granting:
EXECUTE ANY PROCEDURE
CREATE SESSION
UNLIMITED TABLESPACE
CREATE TABLE
CREATE ANY TABLE
ALTER ANY TABLE
DROP ANY TABLE
CREATE CLUSTER
CREATE ANY INDEX
ALTER ANY INDEX
DROP ANY INDEX
CREATE SEQUENCE
CREATE PROCEDURE
CREATE ANY PROCEDURE
CREATE ANY JOBB
CREATE TRIGGER
CREATE ANY TRIGGER
CREATE TYPE
CREATE OPERATOR
CREATE INDEXTYPE
Have also tried the grant select on sys.all_users to public; solution from a previous thread.
So... I'm lost... what am I missing?I don't know if what you have posted is pseudo-code or what you actually ran. Table is not a valid name for a table. It is best to post a copy and paste of an actual run from SQL*Plus, including line numbers and errors. I suggest that you start with a very simple example, avoiding reserve names like table and xml, just creating a simple text index on a table with a varchar2 column, as the same user that owns the table, checking everything along the way. Once you get that working, then you can add the other things one at a time. I have provided a script for you to run and post the results of below, followed by a run of the script on my system to show what you should get.
-- script for you to run from SQL*Plus and post a copy and paste of the results of:
-- version:
SELECT * FROM v$version
-- check that ctxsys user exists:
SELECT username
FROM all_users
WHERE username = 'CTXSYS'
-- check that Oracle Text is installed properly:
SELECT *
FROM dba_registry
WHERE comp_id = 'CONTEXT'
-- create test user:
CREATE USER test IDENTIFIED BY test
-- grant privileges:
GRANT CONNECT, RESOURCE, CTXAPP TO test
-- connect:
CONNECT test/test
-- create table:
CREATE TABLE test.test_tab
(test_col VARCHAR2 (9))
-- insert test data:
INSERT INTO test.test_tab (test_col)
VALUES ('test data')
-- check that test data was inserted:
SELECT * FROM test.test_tab
-- create index:
CREATE INDEX test.test_idx
ON test.test_tab (test_col)
INDEXTYPE IS CTXSYS.CONTEXT
-- check for errors:
SELECT * FROM ctx_user_index_errors
-- check that index and domain index tables were created:
COLUMN object_name FORMAT A30
SELECT object_name, object_type
FROM user_objects
WHERE object_name LIKE '%TEST%'
-- check that tokens were created:
SELECT token_text FROM test.dr$test_idx$i
-- test query:
SELECT * FROM test.test_tab
WHERE CONTAINS (test_col, 'test data') > 0
/-- example of the results you should get:
SCOTT@orcl_11gR2> -- version:
SCOTT@orcl_11gR2> SELECT * FROM v$version
2 /
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
5 rows selected.
SCOTT@orcl_11gR2> -- check that ctxsys user exists:
SCOTT@orcl_11gR2> SELECT username
2 FROM all_users
3 WHERE username = 'CTXSYS'
4 /
USERNAME
CTXSYS
1 row selected.
SCOTT@orcl_11gR2> -- check that Oracle Text is installed properly:
SCOTT@orcl_11gR2> SELECT *
2 FROM dba_registry
3 WHERE comp_id = 'CONTEXT'
4 /
COMP_ID
COMP_NAME
VERSION STATUS
MODIFIED NAMESPACE
CONTROL SCHEMA
PROCEDURE STARTUP
PARENT_ID
OTHER_SCHEMAS
CONTEXT
Oracle Text
11.2.0.1.0 VALID
30-MAR-2010 11:06:15 SERVER
SYS CTXSYS
VALIDATE_CONTEXT
1 row selected.
SCOTT@orcl_11gR2> -- create test user:
SCOTT@orcl_11gR2> CREATE USER test IDENTIFIED BY test
2 /
User created.
SCOTT@orcl_11gR2> -- grant privileges:
SCOTT@orcl_11gR2> GRANT CONNECT, RESOURCE, CTXAPP TO test
2 /
Grant succeeded.
SCOTT@orcl_11gR2> -- connect:
SCOTT@orcl_11gR2> CONNECT test/test
Connected.
TEST@orcl_11gR2> -- create table:
TEST@orcl_11gR2> CREATE TABLE test.test_tab
2 (test_col VARCHAR2 (9))
3 /
Table created.
TEST@orcl_11gR2> -- insert test data:
TEST@orcl_11gR2> INSERT INTO test.test_tab (test_col)
2 VALUES ('test data')
3 /
1 row created.
TEST@orcl_11gR2> -- check that test data was inserted:
TEST@orcl_11gR2> SELECT * FROM test.test_tab
2 /
TEST_COL
test data
1 row selected.
TEST@orcl_11gR2> -- create index:
TEST@orcl_11gR2> CREATE INDEX test.test_idx
2 ON test.test_tab (test_col)
3 INDEXTYPE IS CTXSYS.CONTEXT
4 /
Index created.
TEST@orcl_11gR2> -- check for errors:
TEST@orcl_11gR2> SELECT * FROM ctx_user_index_errors
2 /
no rows selected
TEST@orcl_11gR2> -- check that index and domain index tables were created:
TEST@orcl_11gR2> COLUMN object_name FORMAT A30
TEST@orcl_11gR2> SELECT object_name, object_type
2 FROM user_objects
3 WHERE object_name LIKE '%TEST%'
4 /
OBJECT_NAME OBJECT_TYPE
DR$TEST_IDX$I TABLE
DR$TEST_IDX$K TABLE
DR$TEST_IDX$N TABLE
DR$TEST_IDX$R TABLE
DR$TEST_IDX$X INDEX
TEST_IDX INDEX
TEST_TAB TABLE
7 rows selected.
TEST@orcl_11gR2> -- check that tokens were created:
TEST@orcl_11gR2> SELECT token_text FROM test.dr$test_idx$i
2 /
TOKEN_TEXT
DATA
TEST
2 rows selected.
TEST@orcl_11gR2> -- test query:
TEST@orcl_11gR2> SELECT * FROM test.test_tab
2 WHERE CONTAINS (test_col, 'test data') > 0
3 /
TEST_COL
test data
1 row selected.
TEST@orcl_11gR2> -
ORA-06502: when creating a index
Hi,
i'm trying to create an index on a partitionned table, but i'm getting this error :
CREATE INDEX IDX_NDI_WTSCDRHISTO ON WTS_CDRHISTO(SUBSTR(NDI, GREATEST(LENGTH(NDI)-8,1))) Compress Local (
PARTITION WTS_CDRHISTO_2009070412 NOLOGGING COMPRESS TABLESPACE INDX_CDRHISTO_7 PCTFREE 0 INITRANS 2,
PARTITION WTS_CDRHISTO_2009070413 NOLOGGING COMPRESS TABLESPACE INDX_CDRHISTO_7 PCTFREE 0 INITRANS 2,
PARTITION WTS_CDRHISTO_2009070414 NOLOGGING COMPRESS TABLESPACE INDX_CDRHISTO_7 PCTFREE 0 INITRANS 2,
PARTITION WTS_CDRHISTO_2009070414 NOLOGGING COMPRESS TABLESPACE INDX_CDRHISTO_7 PCTFREE 0 INITRANS 2,
PARTITION WTS_CDRHISTO_2010070800 NOLOGGING COMPRESS TABLESPACE INDX_CDRHISTO_7 PCTFREE 0 INITRANS 2
PARALLEL 16;
the error code is : ORA-06502: PL/SQL: numeric or value error: character string buffer too small ???!!!!!!
Anyone can help me ?
Thks in advancePost the section of code that is causing problem along with statements before and after the section as well.
For now, I can take a guess that you are trying to assign this entire statement as a string to a character variable. If so, then that variable length definition is too small to hold this entire string. In PL/SQL you can define VARCHAR2 to a maximum of 32767. -
When to create index on partitioned table ?
Hi,
The original table TEST1 contain one index called INDX_HIREDATE on field HIREDATE
CREATE TABLE TEST1(
COD NUMBER PRIMARY KEY,
HIREDATE DATE);
CREATE INDEX INDX_HIREDATE ON TEST1 (HIREDATE);
I created a example partitioned table as below:
CREATE TABLE TEST2_PART(
COD NUMBER PRIMARY KEY,
HIREDATE DATE)
PARTITION BY RANGE (HIREDATE)(
PARTITION P2003 VALUES LESS THAN (TO_DATE('01/01/2004','DD/MM/YYYY')),
PARTITION P2004 VALUES LESS THAN (TO_DATE('01/01/2005','DD/MM/YYYY')),
PARTITION P3000 VALUES LESS THAN (MAXVALUE));
INSERT /*+ APPEND */ INTO TEST2 SELECT * FROM TEST1;
Questions:
Need i to create the index on TEST2 table the same way done on the TEST1 table?
ex: CREATE INDEX INDX_HIREDATE ON TEST2 (HIREDATE);
or have i need to create the global/local index on each partition?
The Primary Key index is a global for partitions??
What is the best way?
ThanksIndex creation on partitioned tables is similar to the non-partitioned tables. There is no special syntax unless you need to create LOCAL indexes. For creating local indexes, add LOCAL key word at the end of the "create index...." command.
To create local primary key index you may need to use different syntax the one used in your create table command. Refer to SQL Reference manual for actual syntax. (remember manuals are the best place for getting quick answers). All the manuals are available online (at otn.oracle.com). -
Creating an index in InDesign CS3 - is there any way to limit where and for what it looks?
I'm creating an index for a 300-page book using InDesign CS3 on both a PC with Windows XP home and a MacPro with OS X Leopard (I take this book back and forth between these two computers). I have created this as a book (.indb) file so I can use the Index panel with the book option checked to include all of the book chapters.
There are two things I was wondering how to do, if they can be done at all.
1 - I want the index to look for entries in the main pages only, not in the master pages.
2 - I'd like to be able to do only attributed text. For example, I'd like the index to find only the word people when it is bold and italic, and not all of the other places it may occur. Can I do this with a style also, paragraph and/or character?
Thanks so much,
MarcyRead http://help.adobe.com/en_US/InDesign/6.0/WS8721440D-5F68-4fd6-8115-CA3BEDACF001a.html (the online Help on indexes) -- it will probably answer a few questions.
One I do know immediately is your question on "picking up" stuff from master pages and only with formatting. InDesign does not make an index for you -- you have to (oh! manual labor!) mark the words that should appear in the index yourself. So just don't mark them on master pages, or when not bold and/or italic. You might be wondering about that little button "Mark all instances", well, it does what it say, and in your case you do not want to mark all instances.
The Capitalization issue is, AFAICR, somewhere in the Help; and so is your singular/plural stuff. The latter one is easy solved: if you mark a word to be indexed, ID asks you in a friendly dialog how it should be included, and that defaults to the current selected phrase, but you are free to edit the text in that dialog. ID does not mark the word or phrase; it inserts an invisible marker inside the to-be-indexed word that contains all information you enter in the Add Index Entry dialog, and it uses that to determine what page number to add. (That invisible marker is visible with "Show Invisible Characters", and can be cut, pasted and deleted at will -- so to remove a water melon, find the marker, and delete it.) -
ORA-22275 error when running a USER_DATASTORE index on CLOB column
Running Oracle 9.2.0.8
Getting the following errors thrown for every row in the table when creating the index:
DRG-12604: execution of user datastore procedure has failed
DRG-50857: oracle error in drsinopen
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 347
ORA-06512: at "CRT_DEV.MULTI_INDEX_EN_PRC", line 27
ORA-06512: at "CTXSYS.CTXSYS_MULTI_INDEX_EN_PRC", line 7
ORA-06512:
Index scripts:
ctx_ddl.create_preference( 'crt_user_datastore_en', 'user_datastore' );
ctx_ddl.set_attribute( 'crt_user_datastore_en', 'procedure', 'ctxsys_multi_index_en_prc' );
ctx_ddl.set_attribute('crt_user_datastore_en', 'output_type', 'CLOB');
CTX_DDL.create_preference('CRT_PREF_EN','BASIC_WORDLIST');
ctx_ddl.set_attribute('CRT_PREF_EN','FUZZY_MATCH','ENGLISH');
ctx_ddl.set_attribute('CRT_PREF_EN','STEMMER','ENGLISH');
ctx_ddl.set_attribute('CRT_PREF_EN','SUBSTRING_INDEX','TRUE');
CTX_DDL.create_section_group('CRT_HTML_SECTION','HTML_SECTION_GROUP');
CTX_DDL.add_zone_section('CRT_HTML_SECTION', 'title', 'TITLE');
ctx_ddl.create_preference('CRT_LEXER_EN', 'BASIC_LEXER');
ctx_ddl.set_attribute('CRT_LEXER_EN', 'skipjoins', '-');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'index_text', 'YES');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'base_letter', 'YES');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'index_stems', 'ENGLISH');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'index_themes', 'YES');
ctx_ddl.set_attribute ( 'CRT_LEXER_EN', 'theme_language', 'ENGLISH');
CREATE INDEX MULTI_CONTENT_EN_IDX ON CONTENTS
(top_content_html_en)
INDEXTYPE IS CTXSYS.CONTEXT
parameters ('filter ctxsys.null_filter DATASTORE crt_user_datastore_en LEXER CRT_LEXER_EN wordlist CRT_PREF_EN section group CRT_HTML_SECTION');I have issued the following grants:
grant execute on CTXSYS.ctxsys_multi_index_fr_prc to CRT;
grant execute on CTXSYS.ctxsys_multi_index_en_prc to CRT;
grant execute on CRT_DEV.multi_index_fr_prc to CTXSYS;
grant execute on CRT_DEV.multi_index_en_prc to CTXSYS;CRT is the index owner schema
CRT_DEV is the schema owning the user_datastore procedure. (Could this be the problem?) Should the procedure reside in the same schema as index owner?
Here are my procedures:
CTXSYS stub:
CREATE OR REPLACE PROCEDURE ctxsys_multi_index_en_prc (
rid IN ROWID,
tlob IN OUT CLOB
IS
BEGIN
crt_dev.multi_index_en_prc (rid, tlob);
END;Actual procedure:
CREATE OR REPLACE PROCEDURE multi_index_en_prc (rid IN ROWID, tlob IN OUT CLOB)
IS
BEGIN
FOR c1 IN (SELECT '<TITLE>'
|| cc.content_category_name_en
|| '</TITLE>' content_title,
c.content_html_content_en, c.top_html_content_en
FROM content_categories cc, CONTENTS c
WHERE cc.content_category_id = c.content_category_id
AND c.ROWID = rid)
LOOP
DBMS_LOB.writeappend (tlob, LENGTH (c1.content_title),
c1.content_title);
DBMS_LOB.append (dest_lob => tlob, src_lob => c1.top_html_content_en);
DBMS_LOB.append (dest_lob => tlob,
src_lob => c1.content_html_content_en
END LOOP;
END multi_index_en_prc;I can run the following test script, and get no errors:
declare
rid rowid;
tlob clob;
begin
dbms_lob.CREATETEMPORARY(tlob,false);
CRT_DEV.multi_index_en_prc('AAAC0UAAMAAAAMAAA2',tlob);
dbms_output.put_line(dbms_lob.GETLENGTH(tlob));
dbms_output.put_line(dbms_lob.substr(tlob,25));
dbms_lob.FREETEMPORARY(tlob);
end;Output:
25
<TITLE>References</TITLE>
I'm at a total loss on the cause of the error.
Any help/tips is appreciated!
Thanks
Edited by: pl_sequel on Feb 9, 2010 11:25 AMThanks Roger.
I did add those in... DBA insists that didn't matter, since explicit "select" privs were granted to CRT_DEV to select CRT tables. He did say that a length check was required on the CLOBS before appedning them to the destination lob (tlob) to prevent NULL lob locators being appended and raising the exception.
In any case, it works now... however, unsure if it's due to the schema prefix on the tables, or the lob length checks... -
Creating cube index in process chain
Hi,
From my previous post I realized that we build index of cube first and then delete the overlapping request from cube.
(http://help.sap.com/saphelp_nw04/helpdata/en/d5/e80d3dbd82f72ce10000000a114084/frameset.htm)
If I design a process chain in which I delete the overlapping request first and then build index then in the checking view it does not give me any error.
The process chain also works fine.
How does it hurt to have it this way or what is the concept behind having the sequence as recommended by SAP.
Thanks,
samHi Sam,
Writing performance is increased when there is no index --- So we delete the index before updating data.
Reading Performance is increased when there is a index -- So we create Index so that when queries are executed quickly by reading the data in the info-cube.
BI Best solutions suggests that old requests are to be deleted before loading new one.So we delete ovelapping requests.
Hope it helps. -
Is it worth creating secondary index on BKPF table ?
Hello,
One of my clients is using ECC version 5.0. I have a requirement wherein I need to fetch the data from BKPF table based on AWKEY, BUKRS and GJAHR. There is no standard secondary index available.
I have decided to create a secondary index on these fields in the following order:
1) MANDT
2) AWKEY
3) BUKRS
4) GJAHR
I know that creating secondary indexes does improve performance during data retrieval. But when I checked the total number of entries in BKPF table in production system, there are more than 20 lac 2 million records.
I am worried that creation of secondary index will create another table of such a large size in production that has data sorted on the above fields. Also, the RAM of production system is 6 GB.
Please suggest if creation of secondary index is a good measure OR should I recommend the client to increase the system RAM?
Regards,
Danish.
Edited by: Thomas Zloch on Oct 3, 2011 3:01 PMHi,
Secondary Index on BKPF-AWKEY has been successfully created in production. The report which used to timeout in foreground as well as in background is now executing in less than 10 seconds !!
Client is very much satisfied with this. But, there is one problem that we are facing now is that when the user is changing an existing billing document via VF02, on SAVE, system takes a very long time to save the changes done.
We monitored the processes via SM50 and found that there was a sequential read on BKPF table.
Before transporting the index in production, system approximately took not more than 5 seconds to save the Billing Document. But now system takes more than 20 minutes just to save the billing document via VF02.
I really don't know what has gone wrong. I can't figure out if I have missed any step while creating the index.
I did the following,
1) Created a Secondary index on BKPF, saved it in the transport request and activated it. Since the index was not existing in database ORACLE, I activated and adjusted the table via SE14. Now, index exists on database as well. Working perfectly in development.
2) Imported the transport request to Production. Checked in SE11. Index was existing and active. Also, index existed in database ORACLE.
Have I missed anything ? Is it required to activate and adjust the database via SE14 in production too ?
Regards,
Danish. -
Please help me create the indexes for this XML
Hi Mark and others,
What is the way to create the correct index for this kind of XML (I posted earlier)? I created the indexes without using those prefixes without any problems but they do not seem to be used during processing. For 300 statutes, it took about 10 minutes! For the smplier verion, I created indexes and it took no more than 30 seconds to process more than 4000 statutes.
<AllStatuteQueryResponse xmlns="http://crimnet.state.mn.us/mnjustice/statute/service/3.0">
<ns1:Statutes xmlns:ns1="http://crimnet.state.mn.us/mnjustice/statute/messages/3.0">
<ns1:Statutes>
<ns2:StatuteId xmlns:ns2="http://crimnet.state.mn.us/mnjustice/statute/3.0">1</ns2:StatuteId>
<ns3:Chapter xmlns:ns3="http://crimnet.state.mn.us/mnjustice/statute/3.0">84</ns3:Chapter>
<ns4:Section xmlns:ns4="http://crimnet.state.mn.us/mnjustice/statute/3.0">82</ns4:Section>
<ns5:Subdivision xmlns:ns5="http://crimnet.state.mn.us/mnjustice/statute/3.0">1a</ns5:Subdivision>
<ns6:Year xmlns:ns6="http://crimnet.state.mn.us/mnjustice/statute/3.0">0</ns6:Year>
<ns7:LegislativeSessionCode xmlns:ns7="http://crimnet.state.mn.us/mnjustice/statute/3.0">
<ns7:StatuteCode>
<ns7:code>4</ns7:code>
<ns7:description>4</ns7:description>
</ns7:StatuteCode>
</ns7:LegislativeSessionCode>
<ns8:SessionTextIndicator xmlns:ns8="http://crimnet.state.mn.us/mnjustice/statute/3.0">false</ns8:SessionTextIndicator>
<ns9:HeadNoteIndicator xmlns:ns9="http://crimnet.state.mn.us/mnjustice/statute/3.0">false</ns9:HeadNoteIndicator>
<ns10:EffectiveDate xmlns:ns10="http://crimnet.state.mn.us/mnjustice/statute/3.0">1859-01-01</ns10:EffectiveDate>
<ns11:EnactmentDate xmlns:ns11="http://crimnet.state.mn.us/mnjustice/statute/3.0">1859-01-01</ns11:EnactmentDate>
<ns12:RepealedIndicator xmlns:ns12="http://crimnet.state.mn.us/mnjustice/statute/3.0">false</ns12:RepealedIndicator>
<j:DocumentLocationURI xmlns:j="http://www.it.ojp.gov/jxdm/3.0.2">
<j:ID xsi:type="j:TextType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">http://www.revisor.leg.state.mn.us/stats/84/82.html</j:ID>
</j:DocumentLocationURI>
<ns13:SummaryDescriptionText xmlns:ns13="http://crimnet.state.mn.us/mnjustice/statute/3.0">Snowmobiles-Snowmobile registration</ns13:SummaryDescriptionText>
<ns14:StatuteFunction xmlns:ns14="http://crimnet.state.mn.us/mnjustice/statute/3.0">
<ns14:StatuteIntegrationId>1</ns14:StatuteIntegrationId>
Thanks!
BenHi Mark, here is the schema. I did not register the schema, because when I processed the simpler version, I did not either and I just created the indexes. I did not create an VARRAY in the table. The DDL is simply create table CStatute_XML(id number, xmldoc xmltype).
Schema:
<?xml version="1.0" encoding="UTF-8"?>
<!-- CriMNet -->
<!-- Minnesota Criminal Justice Statute Web Service Data Dictionary -->
<!-- Dave Everson -->
<!-- Version 3.0 -->
<xsd:schema targetNamespace="http://crimnet.state.mn.us/mnjustice/statute/3.0" elementFormDefault="qualified" attributeFormDefault="unqualified" version="3.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://crimnet.state.mn.us/mnjustice/statute/3.0">
<xsd:element name="StatuteCode">
<xsd:annotation>
<xsd:documentation>
This complex type is a generic structure representing code value sets defined in the Minnesota Criminal Justice Statute Service.
A single element of the value set contains both a code value (e.g. F) and a description (e.g. Felony).
The following concepts within the MNCJSS are represented by this complex type:
OffenseSummary
OffenseSummarySeverityLevel
LegislativeSession
Function
OffenseLevel
OffenseSeverityLevel
DetailedOffenseCode
GeneralOffenseCode
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="code" type="xsd:string"/>
<xsd:element name="description" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="StatuteId" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>Primary Key reference to Minnesota Criminal Justice Statute Service disseminated by CriMNet</xsd:documentation>
<xsd:appinfo>Statute.statuteId</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="StatuteIntegrationId" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>Primary Key reference to the StatuteFunction object within the Minnesota Criminal Justice Statute Service disseminated by CriMNet</xsd:documentation>
<xsd:appinfo>StatuteFunction.statuteIntegrationId</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="FunctionCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.Function</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OffenseSummaryCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.OffenseSummary</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OffenseSummarySeverityLevelCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.OffenseSummary.OffenseSummarySeverityLevel</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OffenseLevelCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.OffenseLevel</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="OffenseSeverityLevelCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteFunction.OffenseSeverityLevel</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LegislativeSessionCode">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteChapterSection.LegislativeSession</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GeneralOffenseCode" nillable="true">
<xsd:annotation>
<xsd:documentation>An integer (1-9) identifier of a general statute category code used for statistical analysis.</xsd:documentation>
<xsd:appinfo>StatuteFunction.DetailedOffenseCode.GeneralOffenseCode</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DetailedOffenseCode" nillable="true">
<xsd:annotation>
<xsd:documentation>An identification number associated with a statute offense type in the form of nnn.nnn. From a list of 350. Corresponds to the StatuteOffinseTypeText.</xsd:documentation>
<xsd:appinfo>StatuteFunction.DetailedOffenseCode</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Chapter" type="xsd:string">
<xsd:annotation>
<xsd:documentation>A numeric identifier of a chapter within a statute.</xsd:documentation>
<xsd:appinfo>Statute.chapter; StatuteChapterSection.chapter</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Section" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation>An integer number identifier of a section of a chapter of a statute.</xsd:documentation>
<xsd:appinfo>Statute.section; StatuteChapterSection.section</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Subdivision" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation>An identifier of a subdivision within a code book.</xsd:documentation>
<xsd:appinfo>Statute.subdivision</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="HeadNoteIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteChapterSection.headNote</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Year" type="xsd:int">
<xsd:annotation>
<xsd:documentation>TBD</xsd:documentation>
<xsd:appinfo>StatuteChapterSection.year</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="EffectiveDate" type="xsd:date" nillable="true">
<xsd:annotation>
<xsd:documentation>The date a statute came into effect</xsd:documentation>
<xsd:appinfo>Statute.effectiveDate</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ExpirationDate" type="xsd:date" nillable="true">
<xsd:annotation>
<xsd:documentation>The date a statute was not longer effective.</xsd:documentation>
<xsd:appinfo>Statute.effectiveDate</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="EnactmentDate" type="xsd:date" nillable="true">
<xsd:annotation>
<xsd:documentation>A date a statute was signed into law.</xsd:documentation>
<xsd:appinfo>Statute.enactmentDate</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="RepealedIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>A date a statute number was repealed, amended, or renumbered.</xsd:documentation>
<xsd:appinfo>Statute.repealedFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="HeadNote" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>Statute.headNote</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SummaryDescriptionText" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation>A long description of a statute.</xsd:documentation>
<xsd:appinfo>Statute.summaryText</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LegislativeText" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation>The legislative of a statute.</xsd:documentation>
<xsd:appinfo>StatuteChapterSection.legislativeText</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SessionTextIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteChapterSection.sessionTextFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="FunctionText" type="xsd:string" nillable="true">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteFunction.functionText</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="JuvenileOnlyIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>An indicator identifying whether a statute applies to juveniles only.</xsd:documentation>
<xsd:appinfo>StatuteFunction.juvenileOnlyFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="CrimeOfViolenceIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>An indicator identifying whether a statute is a crime of violence under Minnesota statute 624 section 712 subdivision 5.</xsd:documentation>
<xsd:appinfo>StatuteFunction.crimeOfViolenceFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="EnhanceableIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>An indicator identifying whether the charges are enhanceable by specific factors (the definition of enhanceable is pending review).</xsd:documentation>
<xsd:appinfo>StatuteFunction.enhanceableFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="TargetedMisdemeanorIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>An indicator identifying whether a statute is a targeted misdemeanor as defined in Minnnesota Statute 299C.10, subdivision. 1(d).</xsd:documentation>
<xsd:appinfo>StatuteFunction.targetedMisdemeanorFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="MandatoryAppearanceIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteFunction.mandatoryAppearanceFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="RegisterableOffenseIndicator" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteFunction.registerableOffenseFlag</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="StatuteFunction">
<xsd:annotation>
<xsd:documentation></xsd:documentation>
<xsd:appinfo>StatuteFunction</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="StatuteIntegrationId" />
<xsd:element ref="FunctionCode"/>
<xsd:element ref="FunctionText" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="CrimeOfViolenceIndicator"/>
<xsd:element ref="EnhanceableIndicator"/>
<xsd:element ref="TargetedMisdemeanorIndicator"/>
<xsd:element ref="RegisterableOffenseIndicator"/>
<xsd:element ref="JuvenileOnlyIndicator"/>
<xsd:element ref="MandatoryAppearanceIndicator"/>
<xsd:element ref="OffenseLevelCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="GeneralOffenseCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DetailedOffenseCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="OffenseSummaryCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="OffenseSummarySeverityLevelCode" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="OffenseSeverityLevelCode" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Query:
first part to get the statute ID numbers,
insert into CriMNet_Statutes
select cs.StatuteId, cs.Chapter, cs.Section, cs.Subdivision, cs.Year, cs.LegCode,
cs.LegDesc, cs.SessionTextIndicator, cs.HeadNoteIndicator,
to_date(cs.EffectiveDate, 'yyyy/mm/dd') as eDate,
to_date(cs.EnactmentDate, 'yyyy/mm/dd') as EnDate,
cs.RepealedIndicator, cs.SummaryDescriptionText
from Cstatute_xml,
xmltable
xmlnamespaces
default 'http://crimnet.state.mn.us/mnjustice/statute/3.0',
--- or 'http://crimnet.state.mn.us/mnjustice/statute/3.0' as "cs"
'http://crimnet.state.mn.us/mnjustice/statute/service/3.0' as "cx",
'http://crimnet.state.mn.us/mnjustice/statute/messages/3.0' as "ns1"
'/cx:AllStatuteQueryResponse/ns1:Statutes/ns1:Statutes'
--- '/AllStatuteQueryResponse//ns:Statutes' --- produces an extra row
passing SXMLDOC
columns
StatuteId varchar2(10) path '//StatuteId',
Chapter varchar2(10) path '//Chapter',
Section varchar2(20) path '//Section',
Subdivision varchar2(20) path '//Subdivision',
Year number path '//Year',
LegCode varchar2(10) path '//LegislativeSessionCode/StatuteCode/code',
LegDesc varchar2(10) path '//LegislativeSessionCode/StatuteCode/description',
SessionTextIndicator varchar2(10) path '//SessionTextIndicator',
HeadNoteIndicator varchar2(10) path '//HeadNoteIndicator',
EffectiveDate varchar2(15) path '//EffectiveDate',
EnactmentDate varchar2(15) path '//EnactmentDate',
RepealedIndicator varchar2(10) path '//RepealedIndicator',
SummaryDescriptionText varchar2(150) path '//SummaryDescriptionText'
) cs;
Second part to get the function code for each statute ID (one ID to many function codes).
declare
v_statuteID number;
v_statuteIDC varchar2(10);
cursor c_cmns is
select statuteid from CriMNet_Statutes;
begin
for v_cmns in c_cmns loop
v_StatuteID := v_cmns.StatuteID;
v_statuteIDC := to_char(v_statuteID);
insert into CriMNet_Statute_Function
select v_StatuteID, cf.* from Cstatute_xml,
xmltable
xmlnamespaces
'http://crimnet.state.mn.us/mnjustice/statute/3.0' as "cs",
'http://crimnet.state.mn.us/mnjustice/statute/service/3.0' as "cx",
'http://crimnet.state.mn.us/mnjustice/statute/messages/3.0' as "ns1"
'for $cxm in /cx:AllStatuteQueryResponse/ns1:Statutes/ns1:Statutes[cs:StatuteId = $val/pStatuteId]/cs:StatuteFunction
return
<cs:CSFunction>
<cs:StatuteIntegrationId>{$cxm//cs:StatuteIntegrationId}</cs:StatuteIntegrationId>
<cs:FunctionCode>{$cxm//cs:FunctionCode/cs:StatuteCode/cs:code}</cs:FunctionCode>
<cs:FunctionDesc>{$cxm//cs:FunctionCode/cs:StatuteCode/cs:description}</cs:FunctionDesc>
<cs:CrimeOfViolenceIndicator>{$cxm//cs:CrimeOfViolenceIndicator}</cs:CrimeOfViolenceIndicator>
<cs:EnhanceableIndicator>{$cxm//cs:EnhanceableIndicator}</cs:EnhanceableIndicator>
<cs:TargetedMisdIndicator>{$cxm//cs:TargetedMisdemeanorIndicator}</cs:TargetedMisdIndicator>
<cs:RegisterableOffIndicator>{$cxm//cs:RegisterableOffenseIndicator}</cs:RegisterableOffIndicator>
<cs:JuvenileOnlyIndicator>{$cxm//cs:JuvenileOnlyIndicator}</cs:JuvenileOnlyIndicator>
<cs:MandatoryAppIndicator>{$cxm//cs:MandatoryAppearanceIndicator}</cs:MandatoryAppIndicator>
<cs:OffenseLevelCode>{$cxm//cs:OffenseLevelCode/cs:StatuteCode/cs:code}</cs:OffenseLevelCode>
<cs:OffenseLevelDesc>{$cxm//cs:OffenseLevelCode/cs:StatuteCode/cs:description}</cs:OffenseLevelDesc>
<cs:GeneralOffenseCode>{$cxm//cs:GeneralOffenseCode/cs:StatuteCode/cs:code}</cs:GeneralOffenseCode>
<cs:GeneralOffenseDesc>{$cxm//cs:GeneralOffenseCode/cs:StatuteCode/cs:description}</cs:GeneralOffenseDesc>
<cs:DetailedOffenseCode>{$cxm//cs:DetailedOffenseCode/cs:StatuteCode/cs:code}</cs:DetailedOffenseCode>
<cs:DetailedOffenseDesc>{$cxm//cs:DetailedOffenseCode/cs:StatuteCode/cs:description}</cs:DetailedOffenseDesc>
<cs:OffenseSummaryCode>{$cxm//cs:OffenseSummaryCode/cs:StatuteCode/cs:code}</cs:OffenseSummaryCode>
<cs:OffenseSummaryDesc>{$cxm//cs:OffenseSummaryCode/cs:StatuteCode/cs:description}</cs:OffenseSummaryDesc>
<cs:OffenseSumSeverityLevelCode>{$cxm//cs:OffenseSummarySeverityLevelCode/cs:StatuteCode/cs:code}</cs:OffenseSumSeverityLevelCode>
<cs:OffenseSumSeverityLevelDesc>{$cxm//cs:OffenseSummarySeverityLevelCode/cs:StatuteCode/cs:description}</cs:OffenseSumSeverityLevelDesc>
</cs:CSFunction>'
passing SXMLDOC, xmlelement("pStatuteId", v_statuteIDC) as "val"
columns
StatuteIntegrationId number path '/cs:CSFunction/cs:StatuteIntegrationId',
FunctionCode varchar2(10) path '/cs:CSFunction/cs:FunctionCode',
FunctionDesc varchar2(30) path '/cs:CSFunction/cs:FunctionDesc',
CrimeOfViolenceIndicator varchar2(10) path '/cs:CSFunction/cs:CrimeOfViolenceIndicator',
EnhanceableIndicator varchar2(10) path '/cs:CSFunction/cs:EnhanceableIndicator',
TargetedMisdIndicator varchar2(10) path '/cs:CSFunction/cs:TargetedMisdIndicator',
RegisterableOffIndicator varchar2(10) path '/cs:CSFunction/cs:RegisterableOffIndicator',
JuvenileOnlyIndicator varchar2(10) path '/cs:CSFunction/cs:JuvenileOnlyIndicator',
MandatoryAppIndicator varchar2(10) path '/cs:CSFunction/cs:MandatoryAppIndicator',
OffenseLevelCode varchar2(10) path '/cs:CSFunction/cs:OffenseLevelCode',
OffenseLevelDesc varchar2(40) path '/cs:CSFunction/cs:OffenseLevelDesc',
GeneralOffenseCode varchar2(10) path '/cs:CSFunction/cs:GeneralOffenseCode',
GeneralOffenseDesc varchar2(60) path '/cs:CSFunction/cs:GeneralOffenseDesc',
DetailedOffenseCode varchar2(10) path '/cs:CSFunction/cs:DetailedOffenseCode',
DetailedOffenseDesc varchar2(60) path '/cs:CSFunction/cs:DetailedOffenseDesc',
OffenseSummaryCode varchar2(10) path '/cs:CSFunction/cs:OffenseSummaryCode',
OffenseSummaryDesc varchar2(60) path '/cs:CSFunction/cs:OffenseSummaryDesc',
OffenseSumSeverityLevelCode varchar2(10) path '/cs:CSFunction/cs:OffenseSumSeverityLevelCode',
OffenseSumSeverityLevelDesc varchar2(30) path '/cs:CSFunction/cs:OffenseSumSeverityLevelDesc'
) cf;
---dbms_output.put_line('Statute ID = ' || v_StatuteID);
end loop;
end;
You mentioned that I should include the namespace in the existsnode function but I did not. I am going to try after including it. Thanks.
Ben
Maybe you are looking for
-
I have what I think is adobe 11 - I need a website link to use the application.
I have copy of the purchase invoice but the software is not specified in a manner I can recognise. it is basic software that cost £16.11 at the time and merely allows conversion to and from pdf / word. Access is through one of adobe websites but I do
-
Can Resource Units be shown as a column in the main project plan?
Hi When you open the Task Summary Information screen, you have the Units field - can this field be displayed on a project plan? We use Project for resource planning and this field is used to show what % of a resource's work day is spent on a task. It
-
How can I email apple company directly
I have a question to ask them about iPhone but I couldn't find the website. Thank you
-
Why is this php sql wrong?
hello i have wrote this code: $sql = "select a.Name, (select sum(b.Points) as tpoints from Points_Table b group by b.Name order by tpoints limit 10 ) as TotalPoints from Points_Table a, Points_Table b where a.Name = b.Name group by a.Name order by T
-
Hi Can anyone please provide SAP HR Interview Question. Thanks Ash