Error: ORA-06533 beyond County index

Hello
I am trying to create a varray of strings using items returned from a nested table, but get the error ora-06533, can someone pls help me over come this
I use a script like below:

' declare
number of Time_start;
number of Time_end;
type text_nt is table of the cpw_account_info % rowtype;
v_eName_nt text_nt;

term_acc type is varray (5000) of varchar2 (5000);
term_acc_stmnt term_acc;--:=term_acc();

cursor c_emp is select * from cpw_account_info;

Start
Open c_emp;
Time_start: = dbms_utility.get_time;
loop
C_emp fetch bulk collect within the limits of v_eName_nt 500;
Dbms_output.put_line ('v_eName_nt.count: ' | v_eName_nt.) (Count);
Dbms_output.put_line('===');
because me in 1.v_eName_nt.count
loop
Dbms_output.put_line (v_ename_nt (i). ACCOUNT_NUM | «, » || v_ename_nt (i). END_DAT | «, » || v_ename_nt (i). TERMINATION_REASON_ID | «, » || v_ename_nt (i). ERLY_TERM_CHRG_BOO);
term_acc_stmnt:=term_acc();
term_acc_stmnt.extend (v_eName_nt. (Count);
-create the string array using varray
term_acc_stmnt: = term_acc('ACC.) TERMACC('||)
v_ename_nt (i). ACCOUNT_NUM | «, » ||
v_ename_nt (i). END_DAT | «, » ||
v_ename_nt (i). TERMINATION_REASON_ID | «, » ||
v_ename_nt (i). ERLY_TERM_CHRG_BOO |
');'
);
dbms_output.put_line (' put an end to the string of API: ' | term_acc_stmnt (i));
end loop;
When the exit c_emp % NOTFOUND;
end loop;
Time_end: = dbms_utility.get_time;
dbms_output.put_line ('time_start: ' |) Time_start);
dbms_output.put_line ('time_end: ' |) Time_end);
dbms_output.put_line (' time in ms: ' |) (Time_end-Time_start)/100 * 1000);
close c_emp;
end;
/'

DBMS_OUTPUT:
v_eName_nt. Count: 5
*=====================================*
* 123455, 09-JUL-11, 1, F *.
Finish the string API: VAC. TERMACC(123455,09-JUL-11,1,F);
* 123456, 09-JUL-11, 1, F *.
* ora-06533 beyond County index *.
* / * out with this error script errors when I'm waiting for the script to go ahead and produce strings as *.
Finish the string API: VAC. TERMACC(99999,09-JUL-11,1,F);
Finish the string API: VAC. TERMACC(11111,09-JUL-11,1,F);
Complete the string API: VAC. TERMACC(22222,09-JUL-11,1,F); /*

I guess I'm getting married a mistak of accessin varray in a nested table loop, your suggestions please

Published by: Camilla July 9, 2011 21:28
declare
    time_start number;
    time_end number;
    type text_nt is table of cpw_account_info%rowtype;
    v_eName_nt text_nt;
    type term_acc is varray(5000) of varchar2(5000);
    term_acc_stmnt term_acc :=term_acc();
    cursor c_emp is select * from cpw_account_info;
begin
    open c_emp;
    time_start:=dbms_utility.get_time;
    loop
      fetch c_emp bulk collect into v_eName_nt limit 500;
      DBMS_OUTPUT.put_line('v_eName_nt.count: '||v_eName_nt.count);
      DBMS_OUTPUT.put_line('=====================================');
      for i in 1..v_eName_nt.count loop
        DBMS_OUTPUT.put_line(v_ename_nt(i).ACCOUNT_NUM||','||v_ename_nt(i).END_DAT||','||
                             v_ename_nt(i).TERMINATION_REASON_ID||','||v_ename_nt(i).ERLY_TERM_CHRG_BOO);
        term_acc_stmnt.extend;
        term_acc_stmnt(term_acc_stmnt.count) := 'ACC.TERMACC('||
        v_ename_nt(i).ACCOUNT_NUM ||','||
        v_ename_nt(i).END_DAT ||','||
        v_ename_nt(i).TERMINATION_REASON_ID||','||
        v_ename_nt(i).ERLY_TERM_CHRG_BOO || ');';
        dbms_output.put_line('Terminate API String: '|| term_acc_stmnt(i));
      end loop;
      exit when c_emp%NOTFOUND;
    end loop;
    time_end:=dbms_utility.get_time;
    dbms_output.put_line('time_start: '||time_start);
    dbms_output.put_line('time_end: '||time_end);
    dbms_output.put_line('time elapsed in ms: '||(time_end-time_start)/100*1000);
    close c_emp;
end;
/
v_eName_nt.count: 5
=====================================
123455,09-JUL-11,1,F
Terminate API String: ACC.TERMACC(123455,09-JUL-11,1,F);
123456,09-JUL-11,1,F
Terminate API String: ACC.TERMACC(123456,09-JUL-11,1,F);
123457,09-JUL-11,1,F
Terminate API String: ACC.TERMACC(123457,09-JUL-11,1,F);
123458,09-JUL-11,1,F
Terminate API String: ACC.TERMACC(123458,09-JUL-11,1,F);
123459,09-JUL-11,1,F
Terminate API String: ACC.TERMACC(123459,09-JUL-11,1,F);
time_start: 8172625
time_end: 8172625
time elapsed in ms: 0

PL/SQL procedure successfully completed.

SQL> 

SY.

Tags: Database

Similar Questions

  • County index beyond

    Hello

    I used a table in a loop block, in a function
    so, I stated the table like this

    Varray_numbers TYPE VARRAY (35) NUMBER IS (13.3);
    v_varray varray_numbers: = varray_numbers();

    and I used it in a loop

    I'm in 1.35
    loop
    .. .TRT...
    v_varray.extend;
    Select (case when (i not in (17,18,22,23,24)) then ((champ_2_i + champ_6_i) from double))
    (other)
    case
    When I = 17 then (select champ_2_i + champ_6_i + v_varray (11) + (v_varray (14) - v_varray (13)) double)
    When I = 18 then (select champ_2_i + champ_6_i + v_varray (12) + (v_varray (16) - v_varray (15)) double)
    When I = 22 then (select champ_2_i + champ_6_i + v_varray (5) + (v_varray (8) - v_varray (19)) double)
    When I = 23 then (select champ_2_i + champ_6_i + v_varray (6) + (v_varray (9) - v_varray (20)) double)
    When I = 24 then (select champ_2_i + champ_6_i + v_varray (7) + (v_varray (10) - v_varray (21)) double)
    a piece)) in v_varray (i) of the double;

    ... trt...


    end loop;
    I got this error:
    ORA-06533: index beyond County

    someone has an idea?

    Concerning
    ELYES
    PS version of oracle: oracle 9i

    Edited by: user10393090 Jan 13. 2009 03:04

    Edited by: user10393090 Jan 13. 2009 03:18

    Now that you mentioned that you have an inner and an outer loop, which explains things.

    In the inner loop, you are ranging from 35 times. So when you get to the second iteration of the outer loop, the varray already has 35 items (and they are all filled). You STRETCH for the 36th time and the declaration of VARRAY (35) causes an exception.

    So the easiest thing would be to make the MEASURE only once, before your external loop.

    Now, that's fine as long as there is no danger that one of the missions can be missed (that is to say that there is no danger of the use of the value of a previous iteration of the outer loop.

    You can also (and more "structured block" you can declare inside v_varray the outer loop (so it is not retained between iterations)):

    <>
    FOR l in 1..X LOOP
       DECLARE
          TYPE varray_numbers IS VARRAY(35) OF NUMBER(13,3);
          v_varray varray_numbers := varray_numbers();
       BEGIN
          v_varray.EXTEND(35);
    
         <>
          FOR i in 1..35 LOOP
                v_varray(i) := ...
          END LOOP; -- inner loop
    
       END; -- end scope for v_varray
    END LOOP; -- outer loop
    

    Or you can just use an uncontrolled associative array:

    TYPE array_numbers IS TABLE of NUMBER(13,3) INDEX BY pls_integer
    v_array array_numbers
    

    Then you can assign values without all this palaver EXTEND.

    Nigel cordially

  • ORA-06533: index beyond County ORA-06512:

    Hello

    I tried to insert the collection of data (below) in two individual tables, when I tried to insert a unique collection of data in two individual tables, it has been introduced.

    But when I tired to insert several collections into two individual tables, I am getting below error.

    Einf is my PLSQL CODE with details of the error,

    could you please give me solution.

    Thanks in advance .

    Set serveroutput on

    DECLARE

    /*

    PL ORG_ADDRESSES_PHONES_TAB: = ORG_ADDRESSES_PHONES_TAB (ORG_ADDRESSES_PHONES_TYPE ('a1', 'c1', 's1', 'p1', 1, ORG_PHONES_TAB (ORG_PHONES_TYPE ('a2', 'p1', 's1', 'e1')));)

    If inserted unique collections

    */

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ------------------------------------------------------------------------          But Below data is not inserting because of multiple collections          ----------------------------------------------------------------------------------------------

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    PL ORG_ADDRESSES_PHONES_TAB: = ORG_ADDRESSES_PHONES_TAB (ORG_ADDRESSES_PHONES_TYPE ("a1", "c1", "s1", "p1", 1, ORG_PHONES_TAB (ORG_PHONES_TYPE ("a2", "p1", "s1", "e1"))), ORG_ADDRESSES_PHONES_TYPE ('a2', 'c2', 's3', 'p4', 2, ORG_PHONES_TAB (ORG_PHONES_TYPE ('d3', 'f3', 'ws3', 're3')));)

    BEGIN

    I'm IN pl. FIRST... LAST pl.

    LOOP

    PL. EXTEND;

    dbms_output.put_line (i);

    dbms_output.put_line ('next': pl (i) .ORG_PHONES.) Next (1));

    PL of YEW. (I) exists, THEN - if the element exists then display

    dbms_output.put_line (' ADDRESS ': pl (i).) ADDRESS);

    dbms_output.put_line (' CITY ' | pl (i).) IN TOWN);

    dbms_output.put_line ('STATE_CODE' | pl (i).) STATE_CODE);

    dbms_output.put_line (' zip_code ' | pl (i).) ZIP_CODE);

    dbms_output.put_line ('PRIMARY_YESNO': (i) pl.) PRIMARY_YESNO);

    dbms_output.put_line ('POSTAL Code': pl (i) .ORG_PHONES (i).) AREA CODE);

    dbms_output.put_line ('PREFIX': pl (i) .ORG_PHONES (i).) PREFIX);

    dbms_output.put_line ('SUFFIX' | pl (i) .ORG_PHONES (i).) SUFFIX);

    dbms_output.put_line ('EXTENSION' | pl (i) .ORG_PHONES (i).) EXTENSION);

    -pl. EXTEND;

    -pl (i) .ORG_PHONES. EXTEND;

    END IF;

    PL (i) .ORG_PHONES. EXTEND;

    END LOOP;

    COMMIT;

    -dbms_output.put_line ('hii');

    end;

    ----------------------------------------

    Failed query see the settings

    Error from line: 3 in command.

    DECLARE

    -declare a variable of type projecttable

    PL ORG_ADDRESSES_PHONES_TAB: = ORG_ADDRESSES_PHONES_TAB (ORG_ADDRESSES_PHONES_TYPE ("a1", "c1", "s1", "p1", 1, ORG_PHONES_TAB (ORG_PHONES_TYPE ("a2", "p1", "s1", "e1"))), ORG_ADDRESSES_PHONES_TYPE ('ta2', 'uc2', 'vs3', 'wp4', 2, ORG_PHONES_TAB (ORG_PHONES_TYPE ('d3', 'f3', 'ws3', 're3')));)

    -How to display the values in the table

    BEGIN - beginning of the main block

    I'm in pl.first... pl. Last

    loop

    dbms_output.put_line (i);

    dbms_output.put_line (' ADDRESS ': pl (i).) ADDRESS);

    dbms_output.put_line (' CITY ' | pl (i).) IN TOWN);

    dbms_output.put_line ('STATE_CODE' | pl (i).) STATE_CODE);

    dbms_output.put_line (' zip_code ' | pl (i).) ZIP_CODE);

    dbms_output.put_line ('PRIMARY_YESNO': (i) pl.) PRIMARY_YESNO);

    dbms_output.put_line ('POSTAL Code': pl (i) .ORG_PHONES (i).) AREA CODE);

    dbms_output.put_line ('PREFIX': pl (i) .ORG_PHONES (i).) PREFIX);

    dbms_output.put_line ('SUFFIX' | pl (i) .ORG_PHONES (i).) SUFFIX);

    dbms_output.put_line ('EXTENSION' | pl (i) .ORG_PHONES (i).) EXTENSION);

    -pl. EXTEND;

    PL (i) .ORG_PHONES. EXTEND;

    end loop;

    COMMIT;

    -dbms_output.put_line ('hii');

    end;

    Error report-

    ORA-06533: index beyond County

    ORA-06512: at line 19

    06533 00000 - 'County beyond index'

    * Cause: A limit index was greater than the number of a varray

    or too big for a nested table.

    * Action: Verify program logic and extend explicitly if necessary.

    1

    ADDRESS a1

    CITY c1

    STATE_CODE s1

    Zip_code p1

    PRIMARY_YESNO 1

    CODEZONE a2

    PREFIX p1

    SUFFIX s1

    E1 EXTENSION

    2

    ADDRESS ta2

    Uc2 CITY

    STATE_CODE vs3

    Zip_code wp4

    PRIMARY_YESNO 2

    You have to LOOP in your table of pl (I) .ORG_PHONES (I)

    CREATE OR REPLACE PROCEDURE myproc AS
    
       pl ORG_ADDRESSES_PHONES_TAB := ORG_ADDRESSES_PHONES_TAB(ORG_ADDRESSES_PHONES_TYPE('a1'
                                                                                        ,'c1'
                                                                                        ,'s1'
                                                                                        ,'p1'
                                                                                        ,1
                                                                                        ,ORG_PHONES_TAB(ORG_PHONES_TYPE('a2'
                                                                                                                       ,'p1'
                                                                                                                       ,'s1'
                                                                                                                       ,'e1')
                                                                                                       )
                                                                                       )
                                                              ,ORG_ADDRESSES_PHONES_TYPE('a2'
                                                                                        ,'c2'
                                                                                        ,'s3'
                                                                                        ,'p4'
                                                                                        ,2
                                                                                        ,ORG_PHONES_TAB(ORG_PHONES_TYPE('d3'
                                                                                                                       ,'f3'
                                                                                                                       ,'ws3'
                                                                                                                       ,'re3')
                                                                                                       )
                                                                                        )
                                                              );
    
    BEGIN
    
       DBMS_OUTPUT.PUT_LINE('First: ' || TO_CHAR(pl.FIRST));
       DBMS_OUTPUT.PUT_LINE('Last: ' || TO_CHAR(pl.LAST));
    
       FOR I IN pl.FIRST..pl.LAST LOOP
    
          pl.EXTEND;
    
          DBMS_OUTPUT.PUT_LINE(I);
          DBMS_OUTPUT.PUT_LINE('next ' || pl(I).ORG_PHONES.NEXT(1));
    
          IF(pl.EXISTS(I)) THEN                       -- if item exists then display
    
             DBMS_OUTPUT.PUT_LINE('ADDRESS  ' || pl(I).ADDRESS);
             DBMS_OUTPUT.PUT_LINE('CITY  ' || pl(I).CITY);
             DBMS_OUTPUT.PUT_LINE('STATE_CODE  ' || pl(I).STATE_CODE);
             DBMS_OUTPUT.PUT_LINE('POSTAL_CODE  ' || pl(I).POSTAL_CODE);
             DBMS_OUTPUT.PUT_LINE('PRIMARY_YESNO  ' || pl(I).PRIMARY_YESNO);
    
             FOR j IN pl(I).org_phones.FIRST..pl(I).org_phones.LAST LOOP
    
                DBMS_OUTPUT.PUT_LINE('AREACODE  ' || pl(I).ORG_PHONES(j).AREACODE);
                DBMS_OUTPUT.PUT_LINE('PREFIX  ' || pl(I).ORG_PHONES(j).PREFIX);
                DBMS_OUTPUT.PUT_LINE('SUFFIX  ' || pl(I).ORG_PHONES(j).SUFFIX);
                DBMS_OUTPUT.PUT_LINE('EXTENSION  ' || pl(I).ORG_PHONES(j).EXTENSION);
    
             END LOOP;
    
          --pl.EXTEND;
          --pl(i).ORG_PHONES.EXTEND;
    
          END IF;
    
          pl(I).ORG_PHONES.EXTEND;
    
       END LOOP;
    
       COMMIT;
    
       --dbms_output.put_line('hii');
    
    EXCEPTION
    
       WHEN OTHERS THEN
          DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
    
    END myproc;
    
  • ORA-06533: index beyond County

    Hello

    I want to create and use the two-dimensional array in plsql.

    I created the below sample plsql

    CREATE OR REPLACE FUNCTION fun_array RETURN number
    IS
        type sarray is table of varchar2(100);
        type tarray is table of sarray;
         array2D    tarray;
    BEGIN
         array2D  := new tarray();
         array2D (1)(1)  :='A';
          DBMS_OUTPUT.put_line(array2D(1) (1));
         RETURN 1;
    END;
    
    

    When I run this, I got the below error

    SQL> select fun_array from dual;
    select fun_array from dual
           *
    ERROR at line 1:
    ORA-06533: Subscript beyond count
    ORA-06512: at "PERFEXDEMO.FUN_ARRAY", line 8
    
    

    where I'm wrong?

    SQL> select * from v$version
      2  /
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Release 10.2.0.1.0 - Production
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    

    SQL terminΘe this Message was edited by: Karthik_N

    Seems a piece totally meaningless to the code, but I suspect you're just learning/testing.

    Try

    create or replace function fun_array return number
    is
      type sarray is table of varchar2(100);
      type tarray is table of sarray;
      array2d tarray;
    begin
      array2d := new tarray();
      array2d.extend;
      array2d(1):=new sarray();
      array2d(1).extend;
      array2d(1)(1) := 'A';
      dbms_output.put_line(array2d(1) (1));
      return 1;
    end;
    /
    
  • VARRAY ORA-06533: Subscript beyond County

    Hi all
    I stated in my package body
    create or replace package body mng_res_pack
    is
    ------------------------------------------------------
    TYPE rest_ans_type IS VARRAY(5) OF NUMBER(1);
    rest_ans rest_ans_type:=rest_ans_type();
    -----------------------------------------------------
    PROCEDURE fetch_rest_data
     IS
     rest_rec restore_users%ROWTYPE;
     MONE NUMBER :=0;
     BEGIN 
     FOR I IN 1..5
     LOOP 
     DBMS_OUTPUT.PUT_LINE ('HERE'||' '||rest_ans(i));
     END LOOP;
    .
    .
    .
    end fetch_rest_data;
    end mng_res_pack;
    When I run the procedure, I get the error
    ERROR on line 1:
    ORA-06533: index beyond County
    -----------------------------------------------------
    ORA-06512: at "MNG_RES_PACK", line 46
    Why?
    the size of the varray is 5, and I've also initialized?
    Help, please
    Thanks in advance
    Naama

    >
    even if I does not initialize the varray with numbers, I stil I declare it as a size of 5.
    I still don't understand why he wrote that it out of bounds. NULL is only the value, not the size of the varray.
    He must have made loops 5 times and display null, no?
    >
    No - the VARRAY itself is EMPTY - meaning there is no entry for access. You cannot browse entries because there isn't any.
    The declared 5 size is simply the maximum number of entries that the VARRAY can ever - but it does not all entries; You must do.

    See Varrays in the doc of the PL/SQL language
    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e17126/composites.htm#CHDEIJHD
    >
    An uninitialized variable varray is a collection of nowhere. You must initialize, either by making empty or by assigning a value not NULL. For more information, see 'Constructors of Collection' and "Assign values to the Variables Collection".

  • ERROR "ora-01422" during insertion in the table?

    Hello

    I have created the dynamic action of PL/SQL to insert data but founded by page_item

    
    
     declare 
    x_found_pages number;
    x_auth_id number;
    x_user_id number;
     begin
     x_user_id := :P41_USR_ID; -- this is my page_item _____ successful run When change it to number value .. !
    
    
    
    
          select count(V_APP_PAGES.PAGE_ID) into x_found_pages
          from V_AUTH_DTL V_AUTH_DTL,V_APP_PAGES V_APP_PAGES 
          where V_AUTH_DTL.PAGE_ID!=V_APP_PAGES.PAGE_ID
          and  V_AUTH_DTL.USR_ID = x_user_id;
       
          select T_AUTH.ID into x_auth_id 
          from T_AUTH_DTL T_AUTH_DTL,T_AUTH T_AUTH 
          where T_AUTH_DTL.AUTH_ID=T_AUTH.ID
          and T_AUTH.USR_ID = x_user_id;
    
    
    -- Checking...? 
      if x_found_pages > 0 then
    
            for i in (select V_APP_PAGES.PAGE_ID
               from V_AUTH_DTL V_AUTH_DTL,V_APP_PAGES V_APP_PAGES 
               where V_AUTH_DTL.PAGE_ID!=V_APP_PAGES.PAGE_ID
               and  V_AUTH_DTL.USR_ID = x_user_id)
        
      loop
      insert into T_AUTH_DTL (AUTH_ID,PAGE_ID) values (x_auth_id,i.PAGE_ID);
      end loop;
    
        end if;
    
     end;
    
    
    
    

    Please help me to avoid the ERROR "ora-01422" when running code in the dynamic action...

    Thank you...

    AMR Abdeen wrote:

    I have created the dynamic action of PL/SQL to insert data but founded by page_item

    1. declare
    2. number of x_found_pages;
    3. number of x_auth_id;
    4. number of x_user_id;
    5. Start
    6. x_user_id: =: P41_USR_ID; -It is my page_item _ successfully performed when change to value the number...!
    7. SELECT count (V_APP_PAGES. Page_id) in x_found_pages
    8. of V_AUTH_DTL V_AUTH_DTL, V_APP_PAGES V_APP_PAGES
    9. where V_AUTH_DTL. PAGE_ID! = V_APP_PAGES. PAGE_ID
    10. and V_AUTH_DTL. USR_ID = x_user_id;
    11. Select T_AUTH.ID from x_auth_id
    12. of T_AUTH_DTL T_AUTH_DTL, T_AUTH T_AUTH
    13. where T_AUTH_DTL. AUTH_ID = T_AUTH.ID
    14. and T_AUTH. USR_ID = x_user_id;
    15. -Checking...?
    16. If x_found_pages > 0 then
    17. I'm in (select V_APP_PAGES. PAGE_ID
    18. of V_AUTH_DTL V_AUTH_DTL, V_APP_PAGES V_APP_PAGES
    19. where V_AUTH_DTL. PAGE_ID! = V_APP_PAGES. PAGE_ID
    20. and V_AUTH_DTL. USR_ID = x_user_id)
    21. loop
    22. insert into T_AUTH_DTL (AUTH_ID, PAGE_ID) values (x_auth_id, i.PAGE_ID);
    23. end loop;
    24. end if;
    25. end;

    Please help me to avoid the ERROR "ora-01422" when running code in the dynamic action...

    The error is explicit:

    ORA-01422: exact fetch returns more than number of lines

    Cause: The exact extraction specified number is less than the rows returned.

    Action: Rewrite the query or change the number of rows requested

    This would imply the query in line 16 as County dissociated in the previous one will always return only one row.

    Run

    select T_AUTH.ID into x_auth_id
    from T_AUTH_DTL T_AUTH_DTL,T_AUTH T_AUTH
    where T_AUTH_DTL.AUTH_ID=T_AUTH.ID
    and T_AUTH.USR_ID = :x_user_id
    

    in the workshop of SQL by using the P41_USR_ID value in the variable link to find out how many rows it returns.

    It is likely that the entire block can be replaced by a single INSERT statement. If you provide instructions CREATE TABLE, INSERT statements to create sample data and a clear definition of the requirements that we try to do.

    What is the point of the inclusion of tables aliases that are exactly the same as the names of the tables?

  • Error: ORA-01841: (full) year must be between-4713 and 9999 and not 0

    Hi - I get error ORA-01841 ((full) year must be between-4713 and 9999 and not 0) because of the following line in my where clause:

    AND p_run_date < ((add_months (ip. insured_plan_termination_date,,13) nvl), to_date (31-DEC-9999. ' ' DD-MON-YYYY '))

    I look and what I read speaks not to compare the strings that contain dates, but that is not the case here.   p_run_date is without a doubt a date.  I've hardcoded even on a specific date, and I still get the error.

    Any help is greatly appreciated.

    Thank you

    Christine

    Hi, Christine.

    What is insured_plan_termination_date when you get the error?  If it's December, 9998 or later version, you cannot add 13 months, which would put the year beyond 9999, everything as the error message said.

    You said p_run_date is without a doubt one DATE, but what about insured_plan_termination_date?

    It would really help if you could post a test script complete (including CREATE TABLE and INSERT and your complete query instructions) so that people can recreate the problem and test their ideas.

    Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

  • How to solve the error ORA-01658

    Trying to get a little old working code database and get the following errors with the following

    REM **********************************************************************

    CREATE TABLE gam_service (/ * gam_ser * /)

    service_group_id NUMBER (10) NOT NULL

    CONSTRAINT gam_ser_fk_gam_sergrp REFERENCES gam_service_group (service_group_id)

    ON DELETE CASCADE,

    service_id NUMBER (10) NOT NULL,

    service_name VARCHAR2 (127) NOT NULL, / * length leave CPG code.

    service_type char(1) NOT NULL, / * type of Service Gulp, taken mp, special client * /.

    Server VARCHAR2 (127) NOT NULL, / * Server name, for example "gulp" * /.

    version VARCHAR2 (20) NOT NULL, / * need binary Server version number * /.

    parameters NULL VARCHAR2 (2000), / * parameters to start the service - could be binary * /.

    cpu_power_level NULL NUMBER (3), / * NULL for generics.

    type_systeme_exploitation NULL char (1) / * NULL for generics (Solaris2.4, winNt) * /.

    CONSTRAINT gam_ser_ostype CHECK (type_systeme_exploitation IN (NULL, the of ', 'n')),

    hardware_owner_type NULL VARCHAR2 (10) / * NULL for Joker (company name) * /.

    ) TABLESPACE gam_tab STORAGE (INITIAL 25 K NEXT 100 K PCTINCREASE 100 MINEXTENTS 1 MAXEXTENTS unlimited)

    /

    CREATE UNIQUE INDEX gam_service_pk on gam_service (service_group_id, service_name)

    TABLESPACE gam_ind

    STORAGE (INITIAL 5 K NEXT 20 K PCTINCREASE 100 MINEXTENTS 1 MAXEXTENTS unlimited)

    /

    CREATE SEQUENCE gam_service_seq

    INCREMENT BY 1

    START WITH 1001

    NOCYCLE

    NOCACHE

    ALL

    /

    Here the error message

    CREATE UNIQUE INDEX gam_service_pk on gam_service (service_group_id, service_name)

    *

    ERROR on line 1:

    ORA-01658: cannot create as INITIAL segment in tablespace GAM_IND

    I really hope someone can help me thanks

    You just was lack of space in the tablespace gam_ind. contiguous space to be precise. Your INTITIAL extend needs 5K of space contoguous. And as you have specified PCTINCREASE 100, contiguous space requirement will double with each following measure. Most likely, that you ended up with a case where there are a lot of free space not no contiguous space to required size.

    SY.

  • Error ORA-29874 with XMLIndex

    So, I am creating a XMLIndex in Oracle 11.2.0.3.0 by following the instructions here:

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e16659/xdb_indexing.htm#BCGJCEAF

    I have a table defined as follows:
    CREATE TABLE book_master OF XMLTYPE XMLTYPE STORE AS SECUREFILE BINARY XML;
    I ran the following to try to create a structured index:
    CREATE INDEX my_xmlindex_ix ON book_master (OBJECT_VALUE) INDEXTYPE IS XDB.XMLIndex PARAMETERS ('PATH TABLE path_tab');
    
    BEGIN
       DBMS_XMLINDEX.registerParameter(
          'myparam',
          'ADD_GROUP GROUP gdm_record
             XMLTable gdm_idx_tab 
             XmlNamespaces(''http://www.mrbook.com/BookFormat/PropertyLicHdr'' AS "plh",
                      ''http://www.mrbrook.com/InventoryData'' AS "invtdata", 
                      ''http://www.mrbook.com/BookFormat/Identity'' AS "idty",
                      ''http://www.mrbook.com/BookFormat/LiteraryCloneReferences'' AS "lclone",
                          ''http://www.mrbook.com/TradeInfo'' AS "trd",
                      ''http://www.mrbook.com/'' AS "book"),
             ''/invtdata:inventory''
               COLUMNS
                    book_id    RAW(16)     PATH ''@BOOK_ID'',
                    title_txt  VARCHAR(64) PATH ''plh:LIC/plh:TITLE'',
                    subj_txt   VARCHAR(64) PATH ''plh:LIC/plh:SUBJ'',
                    
                    target_mkt NUMBER(13,0) PATH ''plh:LIC/plh:MKT_NBR'',
                    
                    catg NUMBER(7,0) PATH ''idty:BOOK_INFO/idty:CATG'',
                    lang_code NUMBER(7,0) PATH ''idty:BOOK_INFO/idty:lang_code'',
                    out_of_stock_reas NUMBER(7,0) PATH ''/idty:BOOK_INFO/idty:OUT_OF_STOCK_REAS'',
                    
                    sucsr_title VARCHAR2(64) PATH ''idty:BOOK_INFO/idty:SUCSR_TITLE'',
                    sucsr_subj_txt VARHCAR2(64) PATH ''idty:BOOK_INFO/idty:SUCSR_SUBJ_TXT'',
                    
                    orig_copy_ref VARCHAR2(64) PATH ''lclone:ORIG_COPY_REF/lclone:REF[child::lclone:REF_TYP_CD="160"]/lclone:TITLE'',
                    orig_subj_txt VARCHAR2(64) PATH ''lclone:ORIG_COPY_REF/lclone:REF[child::lclone:REF_TYP_CD="160"]/lclone:SUBJ_TXT'',
                    
                    last_upd_dt TIMESTAMP PATH ''node()[local-name()="LAST_UPD_DT"]'',
                    
                    catg_ref_code  NUMBER(7) PATH ''idty:BOOK_INFO/idty:BOOK_ENTR[child::idty:BOOK_REF=1]/idty:CATG_REF_CD'',
                    catg_code VARCHAR2(48) PATH ''//idty:BOOK_INFO/idty:BOOK_ENTR[child::idty:BOOK_REF=1]/idty:CATG_CODE'',
                    
                    book_trade_info  XMLType   PATH ''trd:book_trade_info'' VIRTUAL
                    
                XMLTable trd_book_ix 
             XmlNamespaces(''http://www.mrbook.com/BookFormat/PropertyLicHdr'' AS "plh",
                      ''http://www.mrbrook.com/InventoryData'' AS "invtdata", 
                      ''http://www.mrbook.com/BookFormat/Identity'' AS "idty",
                      ''http://www.mrbook.com/BookFormat/LiteraryCloneReferences'' AS "lclone",
                          ''http://www.mrbook.com/TradeInfo'' AS "trd",
                      ''http://www.mrbook.com/'' AS "book"),
                   ''/trd:TRADE_ENTR'' PASSING book_trade_info
                COLUMNS
                    trd_yrmoday  VARCHAR2(6) PATH ''@TRD_DT_YRMODAY''
            ');
    END;
    
    ALTER INDEX book_xmlindex_ix PARAMETERS('PARAM myparam3');
    When I run the present, I have the following error:
    anonymous block completed
    Error starting at line 69 in command:
    ALTER INDEX my_xmlindex_ix PARAMETERS('PARAM myparam')
    Error report:
    SQL Error: ORA-29874: warning in the execution of ODCIINDEXALTER routine
    ORA-29960: line 1, ORA-44749: Missing PATH for the COLUMN.
    29874. 00000 -  "warning in the execution of ODCIINDEXALTER routine"
    *Cause:    A waring was returned from the ODCIIndexAlter routine.
    *Action:   Check to see if the routine has been coded correctly
               Check the user defined warning log tables for greater details.
    I checked three times and I PATH statements in the XMLTable command. I also tried to search the forums for "Path missing XMLIndex column", but I don't see anything. Does anyone have an idea how to fix this?

    Thank you...

    Edited by: KnightOfBlueArmor to add the definition of the table on March 26, 2013 14:09

    See the typo on the type of data?

    sucsr_subj_txt VARHCAR2(64) PATH ''idty:BOOK_INFO/idty:SUCSR_SUBJ_TXT'',
    

    You will have after the first error correction.

    Then, you will hit it:

    ORA-19276: XPST0005 - XPath step specifies an invalid element/attribute name: (trd:TRADE_ENTR trd='http://www.mrbook.com/TradeInfo')
    

    That one is because the element root spent the 2nd XMLTable is 'trd:book_trade_info', but you specify "/ trd:TRADE_ENTR" in the main XQuery, where the static error found.
    Specify the correct XQuery from the root node, for example

    ''/trd:book_trade_info/trd:TRADE_ENTR'' PASSING book_trade_info
    

    or what is the true XPath.

    Then it should be OK and the parameter added correctly.

    No doubt you will become a few more errors during execution, some of them because of inconsistencies in path expressions, for example

    idty:BOOK_INFO/idty:lang_code
    //idty:BOOK_INFO/idty:BOOK_ENTR[child::idty:BOOK_REF=1]/idty:CATG_CODE
    /idty:BOOK_INFO/idty:OUT_OF_STOCK_REAS
    

    I let you discover them (if any) ;)

    Published by: odie_63 on March 26, 2013 23:09

  • ORA-02327: cannot create indexes on the LOB data type expression

    DB 10.2.0.4
    DB 5.2

    I am not able to move lobindex and lobsegment. While try occurs below error

    SQL > ALTER INDEX dev. "" SYS_IL0000718396C00002$ $"REBUILD THE TABLESPACE DATA_TEMP;
    ALTER INDEX dev. "" SYS_IL0000718396C00002$ $"REBUILD TABLESPACE DATA_TEMP
    *
    ERROR on line 1:
    ORA-02327: cannot create indexes on the LOB data type expression

    Thank you

    Published by: user13382934 on October 16, 2012 14:05

    correct syntax is
    ALTER TABLE.

    MOVE the LOB ()
    STORE AS (tablespace );

    Where is a name of the / columns LOB, not the name of the segment. Moving type LOB data will move its indexes as well.

  • InPlace schema evolution error: ORA-31166: error code internal etc...

    Hello

    I have a table in which I will be storing an XMLTYPE column based on an XML schema. I use the following version of the database:
    SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 23 18:20:12 2012
    
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Now, when I run my test InPlace Schema Evolution, I get the following error message:

    < font color = "red" >
    ORA-31166: internal error code to handle ignorable attributes
    < / make >

    I built a re-producable case of test for the purpose of this post on the forum. For starters, I have a database scheme grants the following privileges:
    DIRECTLY GRANTED SYSTEM PRIVS
    =============================
    CREATE TRIGGER
    ALTER SESSION
    CREATE TABLE
    
    EXECUTE PRIVS (SYS-OWNED PACKAGES)
    =============
    EXECUTE ON DBMS_XMLSCHEMA
    
    ROLES GRANTED
    =============
    CONNECT
    DATA_ROLE
    
    DATA_ROLE DDL
    =============
    create role DATA_ROLE not identified;
    grant create database link to DATA_ROLE;
    GRANT CREATE MATERIALIZED VIEW TO DATA_ROLE;
    grant create procedure to DATA_ROLE;
    grant create sequence to DATA_ROLE;
    GRANT CREATE SYNONYM TO DATA_ROLE;
    grant create table to DATA_ROLE with admin option;
    grant create trigger to DATA_ROLE;
    grant create view to DATA_ROLE;
    grant select any dictionary to DATA_ROLE;
    All other scripts are run as the database schema. For the purposes of clarity, let's call the {*} TEST_DB_SCHEMA {*}. I follow the steps below in this scheme:

    H3. 1. run this PL/SQL script to record the Version 1 of my XML schema:
    PROMPT -------------------------------;
    PROMPT INITIAL XML SCHEMA REGISTRATION;
    PROMPT -------------------------------;
    
    SET SERVEROUTPUT ON
    SET FEEDBACK OFF
    
    DECLARE
       l_xsd_url_con CONSTANT VARCHAR2(60) := 'http://home/xsd/test_binXML_v1.xsd';
       
       l_xml_schema VARCHAR2(32767);
       
       E_XSD_ALREADY_REGISTERED EXCEPTION;
       PRAGMA EXCEPTION_INIT(E_XSD_ALREADY_REGISTERED, -31085);
    BEGIN
       l_xml_schema :=
          '<xs:schema'||CHR(10)||
          'xmlns:xs="http://www.w3.org/2001/XMLSchema"'||CHR(10)||
          'xmlns:xdb="http://xmlns.oracle.com/xdb"'||CHR(10)||
          'version="1.0"'||CHR(10)||
          'xdb:storeVarrayAsTable = "true">'||CHR(10)||
          ' <xs:element name="TransactionBatch" type="TransactionBatchType" xdb:defaultTable="XSD_TEST_BATCH_BINXML1"/>'||CHR(10)||
          ' <xs:complexType name="TransactionBatchType">'||CHR(10)||
          '  <xs:sequence>'||CHR(10)||
          '   <xs:element name="Transaction" type="TransactionType" minOccurs="1" maxOccurs="unbounded" xdb:defaultTable="XSD_TEST_TRANSACTION_BINXML1"/>'||CHR(10)||
          '  </xs:sequence>'||CHR(10)||
          ' </xs:complexType>'||CHR(10)||
          ' <xs:complexType name="TransactionType">'||CHR(10)||
          '  <xs:sequence>'||CHR(10)||
          '   <xs:element name="Portal" type="PortalType" minOccurs="1" maxOccurs="1" />'||CHR(10)||
          '   <xs:element name="CustomerId" type="CustomerIdType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '   <xs:element name="TransactionQuantity" type="TransactionQuantityType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '   <xs:element name="AppTransactionId" type="AppTransactionIdType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '   <xs:element name="TransactionDetails" type="TransactionDetailType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '   <xs:element name="Username" type="UsernameType" minOccurs="1" maxOccurs="1" />'||CHR(10)||
          '  </xs:sequence>'||CHR(10)||
          ' </xs:complexType>'||CHR(10)||
          ' <xs:simpleType name="PortalType">'||CHR(10)||
          '  <xs:restriction base="xs:string">'||CHR(10)||
          '   <xs:minLength value="1"/>'||CHR(10)||
          '   <xs:maxLength value="30"/>'||CHR(10)||
          '   <xs:enumeration value="TEST1"/>'||CHR(10)||
          '   <xs:enumeration value="TEST2"/>'||CHR(10)||
          '  </xs:restriction>'||CHR(10)||
          ' </xs:simpleType>'||CHR(10)||
          ' <xs:simpleType name="CustomerIdType">'||CHR(10)||
          '  <xs:restriction base="xs:string"/>'||CHR(10)||
          ' </xs:simpleType>'||CHR(10)||
          ' <xs:simpleType name="TransactionQuantityType">'||CHR(10)||
          '  <xs:restriction base="xs:integer">'||CHR(10)||
          '   <xs:minExclusive value="0"/>'||CHR(10)||
          '  </xs:restriction>'||CHR(10)||
          ' </xs:simpleType>'||CHR(10)||
          ' <xs:simpleType name="AppTransactionIdType">'||CHR(10)||
          '  <xs:restriction base="xs:string">'||CHR(10)||
          '   <xs:minLength value="1"/>'||CHR(10)||
          '   <xs:maxLength value="20"/>'||CHR(10)||
          '  </xs:restriction>'||CHR(10)||
          ' </xs:simpleType>'||CHR(10)||
          ' <xs:simpleType name="TransactionDetailType">'||CHR(10)||
          '  <xs:restriction base="xs:string">'||CHR(10)||
          '   <xs:minLength value="1"/>'||CHR(10)||
          '  </xs:restriction>'||CHR(10)||
          ' </xs:simpleType>'||CHR(10)||
          ' <xs:simpleType name="UsernameType">'||CHR(10)||
          '  <xs:restriction base="xs:string">'||CHR(10)||
          '   <xs:minLength value="1"/>'||CHR(10)||
          '   <xs:maxLength value="30"/>'||CHR(10)||
          '  </xs:restriction>'||CHR(10)||
          ' </xs:simpleType>'||CHR(10)||
          '</xs:schema>';
       
       DBMS_XMLSCHEMA.REGISTERSCHEMA(
          schemaurl       => l_xsd_url_con,
          schemadoc       => l_xml_schema,
          local           => TRUE,                             -- XSD must only be visible to the Owner DB Schema in which this script is run.
          genTypes        => FALSE,                            -- Don't want to generate object types, as we're using Binary XML.
          force           => FALSE,                            -- Raise all errors on creation
          owner           => USER,                             -- XML Schema will belong to the currently executing user.
          options         => DBMS_XMLSCHEMA.REGISTER_BINARYXML -- We wish to register the XSD as Binary XML.
       );
       
    EXCEPTION
       WHEN E_XSD_ALREADY_REGISTERED
       THEN
          DBMS_OUTPUT.PUT_LINE('XML Schema '||l_xsd_url_con||' is already registered.');
          
    END;
    /
    
    SET FEEDBACK ON
    H3. 2. create a bunch of Table with an XMLTYPE column based on version 1 of my XML schema:
    PROMPT ----------------------;
    PROMPT ONE-OFF DDL STATEMENTS;
    PROMPT ----------------------;
    
    DROP TABLE test_batch;
    DROP SEQUENCE seq_test_batch_id;
    
    CREATE TABLE test_batch
    (
       batch_id        NUMBER(20),
       batch_timestamp TIMESTAMP   DEFAULT SYSTIMESTAMP,
       batch_xml       XMLTYPE,
       CONSTRAINT tbh_batch_id_nn        CHECK(batch_id IS NOT NULL),
       CONSTRAINT tbh_batch_timestamp_nn CHECK(batch_timestamp IS NOT NULL),
       CONSTRAINT tbh_batch_xml_nn       CHECK(batch_xml IS NOT NULL)
    )
    XMLTYPE COLUMN batch_xml STORE AS SECUREFILE BINARY XML
    XMLSCHEMA "http://home/xsd/test_binXML_v1.xsd"
    ELEMENT "TransactionBatch"
    PARTITION BY RANGE(batch_timestamp)
    INTERVAL (NUMTOYMINTERVAL(1, 'MONTH'))
    (
       PARTITION P_TEST_BATCH_201208 VALUES LESS THAN (TO_DATE('01-SEP-2012', 'DD-MON-YYYY')) TABLESPACE &&TABLSPACE_OF_YOUR_CHOICE
    );
    
    CREATE UNIQUE INDEX idx_tbh_batch_id ON test_batch(batch_id)
    TABLESPACE TXTREME_IDX_XLG;
    
    ALTER TABLE test_batch
       ADD CONSTRAINT tbh_batch_id_pk PRIMARY KEY (batch_id) USING INDEX idx_tbh_batch_id;
    
    CREATE SEQUENCE seq_test_batch_id
    START WITH 1
    INCREMENT BY 1
    MAXVALUE 99999999999999999999
    CYCLE
    NOCACHE
    NOORDER;
    H3. 3. fill this table with the test data.
    PROMPT --------------------------;
    PROMPT CREATING INITIAL TEST DATA;
    PROMPT --------------------------;
    
    TRUNCATE TABLE TEST_BATCH;
    
    SET TIMING ON
    DECLARE
       l_batch_count_con CONSTANT NUMBER(4) := 200;
       
       l_transaction_count   PLS_INTEGER;
       l_total_transactions  PLS_INTEGER DEFAULT 0;
       l_transaction_xmlclob CLOB;
       l_transaction_xmldoc  XMLTYPE;
    BEGIN
       FOR idx IN 1..l_batch_count_con
       LOOP
          l_transaction_count := TRUNC(DBMS_RANDOM.VALUE(1,100));
          
          -- Initialise XML CLOB String. 
          l_transaction_xmlclob := '<?xml version="1.0"?>'||CHR(10)||'<TransactionBatch>';
          
          -- Insert the contents of the XML CLOB String.
          FOR idx IN 1 .. l_transaction_count
          LOOP
             l_transaction_xmlclob := l_transaction_xmlclob||CHR(10)||
                                      '  <Transaction>'||CHR(10)||
                                      '    <Portal>TEST1</Portal>'||CHR(10)||
                                      '    <CustomerId>1234567891</CustomerId>'||CHR(10)||
                                      '    <TransactionQuantity>4</TransactionQuantity>'||CHR(10)||
                                      '    <AppTransactionId>1232K89C</AppTransactionId>'||CHR(10)||
                                      '    <TransactionDetails>This is another long free text field</TransactionDetails>'||
                                      '    <Username>Jimbo2</Username>'||CHR(10)||
                                      '  </Transaction>';
          END LOOP;
          
          --Terminate XML CLOB String.
          l_transaction_xmlclob := l_transaction_xmlclob||CHR(10)||'</TransactionBatch>';
          
          -- Create XMLTYPE XML Document.
          l_transaction_xmldoc := XMLTYPE.createXML(l_transaction_xmlclob);
          
          -- Populate the TEST_BATCH Table.
          INSERT INTO test_batch
            ( batch_id,
              batch_timestamp,
              batch_xml
            )
          VALUES
            ( SEQ_TEST_BATCH_ID.NEXTVAL,
              SYSTIMESTAMP,
              l_transaction_xmldoc
            );
            
          l_total_transactions := l_total_transactions + l_transaction_count;
       END LOOP;
       
       DBMS_OUTPUT.PUT_LINE('Inserted a total of '||l_total_transactions||' transaction XML pieces across '||l_batch_count_con||' Test Batches.');
       COMMIT;
       DBMS_OUTPUT.PUT_LINE('Commit complete.');
    END;
    /
    
    SET TIMING OFF
    H3. 4. save the Version 2 of my XML schema
    PROMPT -----------------------------------------------------------------------------------;
    PROMPT NEW XML SCHEMA REGISTRATION - IDENTICAL TO OLD SCHEMA EXCEPT FOR NEW <Test> ELEMENT;
    PROMPT -----------------------------------------------------------------------------------;
    
    SET FEEDBACK OFF
    
    DECLARE
       l_xsd_url_con CONSTANT VARCHAR2(60) := 'http://home/xsd/test_binXML_v2.xsd';
       
       l_xml_schema VARCHAR2(32767);
       
       E_XSD_ALREADY_REGISTERED EXCEPTION;
       PRAGMA EXCEPTION_INIT(E_XSD_ALREADY_REGISTERED, -31085);
    BEGIN
       l_xml_schema :=
          '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">'||CHR(10)||
          '<xs:element name="TransactionBatch" type="TransactionBatchType" xdb:defaultTable="XSD_TEST_BATCH_BINXML2"/>'||CHR(10)||
          '<xs:complexType name="TransactionBatchType">'||CHR(10)||
          ' <xs:sequence>'||CHR(10)||
          '  <xs:element name="Transaction" type="TransactionType" minOccurs="1" maxOccurs="unbounded" xdb:defaultTable="XSD_TEST_TRANSACTION_BINXML2"/>'||CHR(10)||
          ' </xs:sequence>'||CHR(10)||
          '</xs:complexType>'||CHR(10)||
          '<xs:complexType name="TransactionType">'||CHR(10)||
          ' <xs:sequence>'||CHR(10)||
          '  <xs:element name="Portal" type="PortalType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '  <xs:element name="CustomerId" type="CustomerIdType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '  <xs:element name="TransactionQuantity" type="TransactionQuantityType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '  <xs:element name="AppTransactionId" type="AppTransactionIdType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '  <xs:element name="TransactionDetails" type="TransactionDetailType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '  <xs:element name="Username" type="UsernameType" minOccurs="1" maxOccurs="1"/>'||CHR(10)||
          '  <xs:element name="Test" type="TestType" minOccurs="0" maxOccurs="1"/>'||CHR(10)||
          ' </xs:sequence>'||CHR(10)||
          '</xs:complexType>'||CHR(10)||
          '<xs:simpleType name="PortalType">'||CHR(10)||
          ' <xs:restriction base="xs:string">'||CHR(10)||
          '  <xs:minLength value="1"/>'||CHR(10)||
          '  <xs:maxLength value="30"/>'||CHR(10)||
          '  <xs:enumeration value="TEST1"/>'||CHR(10)||
          '  <xs:enumeration value="TEST2"/>'||CHR(10)||
          ' </xs:restriction>'||CHR(10)||
          '</xs:simpleType>'||CHR(10)||
          '<xs:simpleType name="CustomerIdType">'||CHR(10)||
          ' <xs:restriction base="xs:string"/>'||CHR(10)||
          '</xs:simpleType>'||CHR(10)||
          '<xs:simpleType name="TransactionQuantityType">'||CHR(10)||
          ' <xs:restriction base="xs:integer">'||CHR(10)||
          '  <xs:minExclusive value="0"/>'||CHR(10)||
          ' </xs:restriction>'||CHR(10)||
          '</xs:simpleType>'||CHR(10)||
          '<xs:simpleType name="AppTransactionIdType">'||CHR(10)||
          ' <xs:restriction base="xs:string">'||CHR(10)||
          '  <xs:minLength value="1"/>'||CHR(10)||
          '  <xs:maxLength value="20"/>'||CHR(10)||
          ' </xs:restriction>'||CHR(10)||
          '</xs:simpleType>'||CHR(10)||
          '<xs:simpleType name="TransactionDetailType">'||CHR(10)||
          ' <xs:restriction base="xs:string">'||CHR(10)||
          '  <xs:minLength value="1"/>'||CHR(10)||
          ' </xs:restriction>'||CHR(10)||
          '</xs:simpleType>'||CHR(10)||
          '<xs:simpleType name="UsernameType">'||CHR(10)||
          ' <xs:restriction base="xs:string">'||CHR(10)||
          '  <xs:minLength value="1"/>'||CHR(10)||
          '  <xs:maxLength value="30"/>'||CHR(10)||
          ' </xs:restriction>'||CHR(10)||
          '</xs:simpleType>'||CHR(10)||
          '<xs:simpleType name="TestType">'||CHR(10)||
          ' <xs:restriction base="xs:string">'||CHR(10)||
          '  <xs:minLength value="1"/>'||CHR(10)||
          '  <xs:maxLength value="30"/>'||CHR(10)||
          ' </xs:restriction>'||CHR(10)||
          '</xs:simpleType>'||CHR(10)||
          '</xs:schema>';
       
       DBMS_XMLSCHEMA.REGISTERSCHEMA(
          schemaurl       => l_xsd_url_con,
          schemadoc       => l_xml_schema,
          local           => TRUE,                             -- XSD must only be visible to the Owner DB Schema in which this script is run.
          genTypes        => FALSE,                            -- Don't want to generate object types, as we're using Binary XML.
          force           => FALSE,                            -- Raise all errors on creation
          owner           => USER,                             -- XML Schema will belong to the currently executing user.
          options         => DBMS_XMLSCHEMA.REGISTER_BINARYXML -- We wish to register the XSD as Binary XML.
       );
       
    EXCEPTION
       WHEN E_XSD_ALREADY_REGISTERED
       THEN
          DBMS_OUTPUT.PUT_LINE('XML Schema '||l_xsd_url_con||' is already registered.');
          
    END;
    /
    
    SET FEEDBACK ON
    H3. 5 test to insert a new XML document in line with the second XML schema. This test fails as expected.
    PROMPT ---------------------------------------------------------------;
    PROMPT ATTEMPT TO INSERT V2 XSD-COMPLIANT XMLDOC INTO TEST_BATCH TABLE;
    PROMPT ---------------------------------------------------------------;
    
    DECLARE
       l_transaction_xmldoc XMLTYPE;
       
       E_XSD_VALIDATION_FAILURE EXCEPTION;
       PRAGMA EXCEPTION_INIT(E_XSD_VALIDATION_FAILURE, -31061);
    BEGIN
       l_transaction_xmldoc := XMLTYPE.createXML(
                                  '<?xml version="1.0" encoding="UTF-8"?>'||CHR(10)||
                                  '<TransactionBatch>'||CHR(10)||
                                  '  <Transaction>'||CHR(10)||
                                  '    <Portal>CARMAN</Portal>'||CHR(10)||
                                  '    <CustomerId>1234567891</CustomerId>'||CHR(10)||
                                  '    <TransactionQuantity>4</TransactionQuantity>'||CHR(10)||
                                  '    <AppTransactionId>1232K89C</AppTransactionId>'||CHR(10)||
                                  '    <TransactionDetails>This is a long free text field</TransactionDetails>'||CHR(10)||
                                  '    <Username>Jimbo2</Username>'||CHR(10)||
                                  '    <Test>This is an In-Place Schema Evolution Test</Test>'||CHR(10)||
                                  '  </Transaction>'||CHR(10)||
                                  '</TransactionBatch>'
                               );
       
       -- Attempt to populate the SUBMISSION_BATCH Table.
       INSERT INTO submission_batch
         ( batch_id,
           batch_timestamp,
           batch_xml
         )
       VALUES
         ( SEQ_SUB_BATCH_ID.NEXTVAL,
           SYSTIMESTAMP,
           l_transaction_xmldoc
         );
       
       DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT||' row inserted.');
       COMMIT;
       DBMS_OUTPUT.PUT_LINE('Commit complete.');
    
    EXCEPTION
       WHEN E_XSD_VALIDATION_FAILURE
       THEN
          DBMS_OUTPUT.PUT_LINE('Insert failed as expected.'||CHR(10));
          DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END;
    /
    H3. 6. try Inplace development of Version 1 of the XML schema in Version 2.
    PROMPT --------------------------------------------------------------------------------------;
    PROMPT PERFORM IN-PLACE EVOLUTION AND DE-REGISTER/PURGE OLD SCHEMA IF EVOLUTION IS SUCCESSFUL;
    PROMPT --------------------------------------------------------------------------------------;
    
    SET TIMING ON
    
    DECLARE
       l_current_schema   XMLTYPE;
       l_new_schema       XMLTYPE;
       l_xsd_differences  XMLTYPE;
       
       l_resource         BOOLEAN;
    BEGIN
       SELECT schema
         INTO l_current_schema
         FROM user_xml_schemas
        WHERE schema_url = 'http://home/xsd/test_binXML_v1.xsd';
       
       SELECT schema
         INTO l_new_schema
         FROM user_xml_schemas
        WHERE schema_url = 'http://home/xsd/test_binXML_v2.xsd';
       
       SELECT XMLDIFF(l_current_schema, l_new_schema)
         INTO l_xsd_differences
         FROM dual;
       
       DBMS_OUTPUT.PUT_LINE('Successfully extrapolated XDIFF XML Document.');
       
       DBMS_XMLSCHEMA.inPlaceEvolve( 'http://home/xsd/test_binXML_v1.xsd',
                                     l_xsd_differences,
                                     DBMS_XMLSCHEMA.INPLACE_TRACE
                                   );
       
       DBMS_OUTPUT.PUT_LINE('Successfully evolved original XML Schema.');
       
    EXCEPTION
       WHEN OTHERS
       THEN
          ROLLBACK;
          DBMS_OUTPUT.PUT_LINE('Error issued during InPlace XML Schema Evolution:');
          DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END;
    /
    H3. The scripts above provide the following Test output:
    Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 
    Connected as TEST_DB_SCHEMA@dbs02local
     
    SQL> 
    -------------------------------
    INITIAL XML SCHEMA REGISTRATION
    -------------------------------
     
    XML Schema http://home/xsd/test_binXML_v1.xsd is already registered.
     
    Executed in 0 seconds
    
    ----------------------
    ONE-OFF DDL STATEMENTS
    ----------------------
      
    Table created
     
    Executed in 0.016 seconds
     
    Index created
     
    Executed in 0.016 seconds
     
    Table altered
     
    Executed in 0 seconds
     
    Sequence created
     
    Executed in 0 seconds
    
    --------------------------
    CREATING INITIAL TEST DATA
    --------------------------
     
    Table truncated
     
    Executed in 0.032 seconds
    
    Inserted a total of 10259 transaction XML pieces across 200 Test Batches.
    Commit complete.
     
    PL/SQL procedure successfully completed
     
    Executed in 8.487 seconds
    
    -----------------------------------------------------------------------------------
    NEW XML SCHEMA REGISTRATION - IDENTICAL TO OLD SCHEMA EXCEPT FOR NEW <Test> ELEMENT
    -----------------------------------------------------------------------------------
     
    XML Schema http://home/xsd/test_binXML_v2.xsd is already registered.
    
    ---------------------------------------------------------------
    ATTEMPT TO INSERT V2 XSD-COMPLIANT XMLDOC INTO TEST_BATCH TABLE
    ---------------------------------------------------------------
     
    Insert failed as expected.
    
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00213: only 0 occurrences of particle "Transaction", minimum is 1
     
    PL/SQL procedure successfully completed
     
    --------------------------------------------------------------------------------------
    PERFORM IN-PLACE EVOLUTION AND DE-REGISTER/PURGE OLD SCHEMA IF EVOLUTION IS SUCCESSFUL
    --------------------------------------------------------------------------------------
     
    Successfully extrapolated XDIFF XML Document.
    Error issued during InPlace XML Schema Evolution:
    ORA-31166: internal error code to handle ignorable attributes
     
    PL/SQL procedure successfully completed
     
    Executed in 0.046 seconds
    SQL> 
    NOTE: When I ran the above tests, I had already created the test of XML schemas. That's why the output messages, say...

    H4. Now, as it is the first time I've ever tried evolution of XML schema in Oracle XMLDB, is there someone who could potentially open the door please, re. solve the < font color = "red" >ORA-31166< / police > error?

    Hello

    First of all, thank you for your efforts on the provision of a decent test case.

    However, there are a few inconsistencies:

    -Step 5 attempts to insert into SUBMISSION_BATCH, but the table created above is TEST_BATCH
    -Same for the sequence name

    Now back to the real question...

    I think the problem comes because you run XMLDiff against two versions saved of your drawings.
    When Oracle stores a schema, it adds a large number of attributes for internal use (you can see them by querying USER_XML_SCHEMAS. DIAGRAM) but we as end users don't have to worry about them.
    However, by building the Xdiff document based on these two 'internal' versions, we explicitly say Oracle whose internal attributes must be changed during the evolution of the scheme, leading to potential conflicts.

    A few other comments:
    -Given that you're using the binary XML schema, you must also set "genTables-online false" and more "genTypes-online false."
    -Also delete all annotations from xdb:defaultTable and xdb:storeVarrayAsTable on the diagrams, they are of no use in this situation.
    -Do not save the schema of the v2, it is not necessary. Just use a transient instance when calling XMLDiff

    So, to summarize:

    -XMLDiff run against both original patterns (do not save a new in any case, the process of evolution will take care of replacing the old).
    -of course, don't forget to change the INPLACE_TRACE to INPLACE_EVOLVE when ready :)

    Hope that helps.

    Published by: odie_63 on August 23, 2012 16:31 - fixed some typos

  • How to solve the error ORA-00001 in SQL Insert?

    Hi all, I need your help appreciated.

    I do a plsql procedure that inserts a line according to the value of the slider, I have error oracle ORA-00001: unique constraint (constraint_name) violated.

    This message may appear if a duplicate entry exists at a different level: in the RDBMS MySQL, I have the syntax IGNORES to solve this error of duplication... and in Oracle?

    Thanks for your time and your advice.
    Miguelito

    user6317803 wrote:
    How to solve the error ORA-00001 in SQL Insert?

    ORA-00001 means table a unique/primary key / index and you attempt to insert a row with the key value already exists in the table. I'll assume table has a primary key on COUNTRY_ID. Then modify SQL for:

    SQL = "INSERT INTO COUNTRIES (COUNTRY_ID, COUNTRY_NAME, REGION_ID) SELECT"BZ","BLZ", 3 DOUBLE WHERE DOES NOT EXIST (SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID ="BZ").

    There is a good chance COUNTRY table also has unique key/index on COUNTRY_NAME. If so use:

    SQL = "INSERT INTO COUNTRIES (COUNTRY_ID, COUNTRY_NAME, REGION_ID) SELECT"BZ","BLZ", 3 DOUBLE WHERE DOES NOT EXIST (SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ' OR 'BLZ' = COUNTRY_NAME).

    SY.

  • Error ORA-00932 - expected - got CLOB

    Summer of work on request and if necessary, to add comments that have been added to a service call. First time I tried were a failure. So I backed up and worked on an idea to put comments into a temporary table and the rest of the data in another temporary table (which will have filtering in from outside our data systems) and combine them in the evaluation table. This table is analyzed to determine if the call is sent by e-mail to the supervisors.

    The comments are a clob collected a variation of a function found here and as long as he stays, temporary table right. When the query tries to move this clob in the clob table corresponding assessment, I get the error ORA-00932 for incompatible data types: expected - got CLOB. (The destination column is a column clob as well.)

    The select statement which I use is
     INSERT INTO jc_hc_curent(ad_sec, eid, ad_ts, ag_id, tycod, sub_tycod, udts, xdts, estnum, edirpre, efeanme, efeatyp, edirsuf, eapt, ccity, unit_count, comments) SELECT cu.ad_sec, cu.eid, cu.ad_ts, cu.ag_id, cu.tycod, cu.sub_tycod, cu.udts, cu.xdts, cu.estnum, cu.edirpre, cu.efeanme, cu.efeatyp, cu.edirsuf, cu.eapt, cu.ccity, COUNT(cu.unid), cl.comments FROM hc_curent_temp cu JOIN hc_clob_temp cl ON cu.eid = cl.eid GROUP BY cu.ad_sec, cu.eid, cu.ad_ts, cu.ag_id, cu.tycod, cu.sub_tycod, cu.udts, cu.xdts, cu.estnum, cu.edirpre, cu.efeanme, cu.efeatyp, cu.edirsuf, cu.eapt, cu.ccity, cl.comments; 
    The hc_clob_temp.comments is a CLOB, just like the jc_hc_curent.comments in which it happens. the two columns of ad_sec and Eid are NUMBER (10.0) and the rest are VARCHAR2 of different sizes.

    So what am I I lack and what I have wrong here...?

    I would like to know if there is everything you need to view the problem.

    Thanks in advance,
    Tony

    >
    So what am I I lack and what I have wrong here...?
    >
    To solve the problems of this kind I find useful to remove all superfluous objects and focus on getting to work.

    So what happens if you use a query that simply inserts the CLOB column? Does it work? Then add a few more columns, and then even more until you find what does not work.

    If necessary to create a table that is a clone of jc_hc_curent but does not index or other unnecessary constraints.

  • ORA-39083: Object type TRIGGER could not create with error: ORA-04072:

    OS: windows Server 2003 STD 64 Bit
    DB version: 11g Enterprise Edition Release 11.2.0.1.0 - 64 bit

    I use impdp to a certain pattern and you get the following error:

    ORA-39083: Type WHAT TRIGGER could not create object error:
    ORA-04072: invalid trigger type
    Because sql is:
    DBMS_DDL BEGIN. SET_TRIGGER_FIRING_PROPERTY ('"AGILETEST" "," "SWAPOPTIMIZER" ', ALF)
    SE); END;

    Processing object type SCHEMA_EXPORT/TABLE/INDEX/FUNCTIONAL_AND_BITMAP/INDEX
    Object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_AND_BITMA of treatment
    P/INDEX_STATISTICS
    Object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS treatment
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/DOMAIN_INDEX/INDEX

    ----------
    I check in Metalink and found it to be a bug with no construction nearby.
    Bug 9858539 : DATA PUMP IMPORT FAILED TO TRIGGER LOGON ORA-04072: INVALID TYPE of TRIGGER

    ---------
    Any ideas?

    Well Yes, the patch is available for this bug 9858539 for 11.2.0.1 and 11.2.0.3.

    Salman

  • ORA-01418 for an index.

    Hello

    I have the following problem. I can't drop or change a return to index a unique constraint (primary key constraint). The index and constraint have the same name. I always get the error ORA-01418.

    What could be the reason for this strange behavior? Index constraint/is known, because the views all_constraints resp. all_indexes show that. Will there be a brute force method to deposit such things and create a new?

    Usually its difficult to believe when someone says something dubious, until and unless it don't stick the sqlplus output.

    So, just for us your alter index index-name command and select of all_indexes where index-name = "YOUR_INDEX_NAME".

    A guess, that you have created indexes with qutation mark "'"and now (alter index...) " you use no quotes.

    Because for ORA-01418; answer is "Specify the name of an index in the ALTER INDEX, DROP INDEX, or VALIDATE INDEX statement".

    Concerning
    Girish Sharma

Maybe you are looking for