Index beyond count and error in DML table

Hi all

I really appreciate your advice regarding the below question.

I have a big procedure so I can't put my procedure here, but I'll try to give you some details and maybe I can pass my problem and advice of experts with you.

I have some values in the named collection of PL/SQL as TAB_ABC and then I filter this tab using if statement and then add it to another TAB_ABC_REC tab and then insert it into my table. something like below.

Begin

For a 1.TAB_ABC in. COUNTY

LOOP

IF TAB_ABC (a) .group_no = 100 then

TAB_ABC_REC. EXTEND (1) the values ;--Load in this collection

TAB_ABC_REC (a). Name: = TAB_ABC (a). Name;

TAB_ABC_REC (a). Address: = TAB_ABC (a). Address;

END IF;

END LOOP;

BEGIN

FORALL j IN TAB_ABC_REC. FIRST... TAB_ABC_REC. FINALLY SAVE EXCEPTIONS

INSERT INTO ABC

(

NAME,

ADDRESS

)

VALUES

(

TAB_ABC_REC (j). Name,

TAB_ABC_REC (j). Address

);

Exception

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

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

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

TAB_ABC_REC. DELETE;

END;

The above code works fine, but a few times I got the following errors when I run my package.

Index out of County

error in DML table

So, I had fewer documents but the amazing thing is that some time that this procedure works well without any errors. Please guide how to I get rid of this error. Thank you

Concerning

Shu

Change like that. Your will fail if a jump values, say 1 succeeds, but fails 2 and 3. For 1Il will insert in the collection, but given that the 2 and 3 cannot it will insert for 4 If 4 succeeds... but you have extended by only 1... If the operation fails

For a 1.TAB_ABC in. COUNTY

LOOP

IF TAB_ABC (a) .group_no = 100 then

TAB_ABC_REC. EXTEND; - load in this collection values

TAB_ABC_REC (TAB_ABC_REC LAST). Name: = TAB_ABC (a). Name;

TAB_ABC_REC (TAB_ABC_REC LAST). Address: = TAB_ABC (a). Address;

END IF;

END LOOP;

Tags: Database

Similar Questions

  • Oracle Data Integrator insert County Update comte Delete Count and error neck

    I'm trying to change an incremental update IKM Oracle

    What I have to do is insert a table at the end of each interface with the following information:

    Technologies: ORACLE

    < % if (odiRef.getOption ("METADATA_TABLE") () .length == 0) {% >}
    Invalid value for the metadata option
    < %}; % >
    / * METADATA_TABLE = < %=odiRef.getOption ("METADATA_TABLE") % > * /.
    < % / * for NO value * / if ("NONE".equals (odiRef.getOption ("METADATA_TABLE"))) {% >}
    / * Command ignored due to choice METADATA_TABLE * /.
    < %} else {% >}

    INSERT INTO < %=odiRef.getOption ("METADATA_TABLE") % >
    (
    ODI_SESSION_NO,
    ODI_SESSION_NAME,
    ODI_STEP_NAME,
    ODI_STEP_NO,
    ODI_STEP_TYPE,
    S_TABLE,
    T_TABLE,
    RUN_DATE,
    S_ROW_COUNT,
    T_ROW_COUNT
    )
    VALUES
    (
    '< % = odiRef.getSession ("SESS_NO") % >',
    '< % = odiRef.getSession ("SESS_NAME") % >',
    '< % = odiRef.getStep ("STEP_NAME") % >',
    '< % = odiRef.getStep ("NSN") % >',
    case when "< % = odiRef.getStep ("STEP_TYPE") % > ' = 'F', THEN 'Interface.
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = 'VD' THEN "declaring variables".
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = 'VS' THEN ' Set / / increment the variable'
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = have ' THEN 'variable Evaluate. "
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = 'V' THEN 'variable refresh.
    When ' < % = odiRef.getStep ("STEP_TYPE") % > ' = ' t ' THEN 'procedure '.
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = 'OE' AND 'OS command.
    When ' < % = odiRef.getStep("STEP_TYPE") % > "="IS"THEN"ODI Tool"
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = 'RM' and THEN 'model of bone '.
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = 'CM' THEN 'Check model '.
    When '< % = odiRef.getStep("STEP_TYPE") % > ' =' CS' THEN 'check sous-modèle.
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = 'CD' THEN 'check datastore.
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = 'JM' THEN 'Journalize model '.
    When '< % = odiRef.getStep ("STEP_TYPE") % >' = 'JD' THEN 'log the data store.
    END OTHER 'UNKNOWN ',.
    ' < % = odiRef.getSrcTablesList ("", "[SCHEMA].) [RES_NAME] », «, », « ») % >',
    "< %=odiRef.getTable ("L","A","TARG_NAME") % >."
    To_date (SUBSTR ("< % = odiRef.getSession ("SESS_BEG") % > ' 1, 19"), "YYYY-MM-DD HH24:MI:SS"),
    (SELECT COUNT (*)
    from < % = odiRef.getSrcTablesList ("", "[SCHEMA].) [RES_NAME] », «, », « ») % >
    where (1 = 1)
    < % = odiRef.getJoin () % >
    < % = odiRef.getFilter () % >
    < % = odiRef.getGrpBy () % >
    < % = odiRef.getHaving () % >),
    (SELECT COUNT (*) IN < %=odiRef.getTable ("L", "A", "TARG_NAME") % >)

    )
    < %}; % >

    The code above works well, however I need to update the Insert the number of rows, number of rows to update, remove the number of lines and number of rows in error via an ODI procedure.

    I managed to update (number of rows, number of update rows, number of lines, number of lines of error - remove) the table via the procedure described below:

    UPDATE ODI_PROCESS_LOAD
    SET
    INSERT_COUNT = '< % = odiRef.getPrevStepLog ("INSERT_COUNT") % >',
    UPDATE_COUNT = '< % = odiRef.getPrevStepLog ("UPDATE_COUNT") % >',
    DELETE_COUNT = '< % = odiRef.getPrevStepLog ("DELETE_COUNT") % >',
    ERROR_COUNT = '< % = odiRef.getPrevStepLog ("ERROR_COUNT") % >'
    WHERE
    ODI_SESSION_NO = '< % = odiRef.getPrevStepLog ("SESS_NO") % >'
    AND ODI_STEP_NO = '< % = odiRef.getPrevStepLog ("NSN") % >'

    What I need to do, it is by a single Insert statement mentioned above instead of the second update statement.

    I wonder if there is a way to do

    Take a look at the getPrevStepLog() method - it might be of some use, but you probably wouldn't be able to use it since the km you attempt to change:

    http://gerardnico.com/doc/ODI/Webhelp/en/ref_api/getprevsteplog.htm

  • How can I insert a number to a specific index (row and column) to a table

    I had the most with function 'insert into array' problem because of its counter-intuitiveness. I want to insert a number I got inside a loop IN a table. The ROW and COLUMN of this table I want enter the number is specified by the number of loops of two loops FOR. It did not work.

    So, I have isolated and tested this function further. Frankly, I initialized a table 2D with ZEROS and plugged into the "insert into array" function (on top of entry). I then put the number '1' for the index (line) and the number "2" for the index (column) and then put the entry number "6" for the "new item/sub-table. Then, I hung a picture of 2-D (indicator) output to the output of the function "insert into array. When I did all that, it means I want to just put the number '6' in line '1' and the column '2'... This isn't letting me do it.

    How can I do this SIMPLE?

    Hi Darrell h...,

    Looks like you can use the function "autoindexing. Take your value and connect it to your loop, it will be a default autoindexing. Right-click on the last tunnel of output and select Create indicator, the result is your table.

    It will be useful.

    Mike

  • mutation in the triggers table problem (need to COUNT (col) and MAX (col) of table shot)

    I was looking for the solution and find many examples, but I do not know what is the best in my option and don't understand everything.

    I realized that can't do a SELECT query in the table where trigger is triggered. But I have need SELECT COUNT (col), then MAX (id) of this table, update some statistical info...
    And also need to row id update, so I can't do trigger of table instead of relaxation of the line.


    So this is my TRIGGER:

    create or replace

    update_stat relaxation

    AFTER UPDATE ON TABLE1 TO EACH LINE

    DECLARE

    juice FLOAT;

    all the NUMBER;

    end NUMBER;

    BEGIN

    IF (: old.ended <>: new.ended) THEN

    SELECT COUNT (id) FROM end FROM table1 WHERE fk_table2 = new.fk_table2 AND finished = 1;  -Error in the table of mutation

    SELECT COUNT (id) FROM everything FROM table1 WHERE fk_table2 = new.fk_table2; -Error in the table of mutation

    Juice: = ((end /all) * 100);

    UPDATE table2 SET suc = success WHERE id =:new.fk_table2;

    END IF;

    END;

    I also tried with

    pragma autonomous_transaction;

     

    trigger body....AND

     

     

    commit;

    But don't working right when insert more records.

    Thanks, Urban

    Data and structure of the example table

    SQL> create table table2
      2  (
      3     id        integer
      4   , success   number
      5   , constraint table2_pk primary key (id)
      6  );
    
    Table created.
    
    SQL> create table table1
      2  (
      3     id        integer
      4   , id_t2     integer
      5   , ended     integer
      6   , constraint table1_pk primary key (id)
      7   , constraint table1_fk_id_t2 foreign key (id_t2) references table2
      8  );
    
    Table created.
    
    SQL> insert into table2(id, success) values (1, 0);
    
    1 row created.
    
    SQL> insert into table2(id, success) values (2, 0);
    
    1 row created.
    
    SQL> insert into table1
      2  (
      3     id
      4   , id_t2
      5   , ended
      6  )
      7  select level
      8       , ceil(level/10)
      9       , 0
     10    from dual
     11  connect by level <= 20;
    20 rows created.
    
    SQL> commit;
    
    Commit complete.
    

    Create objects to the suite

    create or replace type update_stat_obj as object (id integer, id_t2 integer, ended integer)
    /
    create or replace type update_stat_tbl as table of update_stat_obj
    /
    create or replace package update_stat_pkg
    as
       g_table_1 update_stat_tbl;
       procedure load(p_id integer, p_id_t2 integer, p_ended integer);
       procedure updt;
    end;
    /
    show err
    create or replace package body update_stat_pkg
    as
       procedure load(p_id integer, p_id_t2 integer, p_ended integer)
       is
       begin
          if g_table_1 is null then
            g_table_1 := update_stat_tbl();
          end if;
    
          g_table_1.extend;
          g_table_1(g_table_1.count) := update_stat_obj(p_id, p_id_t2, p_ended);
       end;
       procedure updt
       is
       begin
           merge into table2 t2
           using (
                  select t1.id_t2
                       , (count(t2.id)/count(t1.id))*100 success
                    from table1 t1
                    left
                    join table(g_table_1) t2
                      on t1.id    = t2.id
                     and t2.ended = 1
                   group
                      by t1.id_t2
                 ) t1
              on (t2.id = t1.id_t2)
            when matched then
                update set t2.success = t1.success;
    
           g_table_1 := null;
       end;
    end;
    /
    show err
    create or replace trigger update_stat_row_trig after update on table1 for each row
    begin
        if (:old.ended <> :new.ended)
        then
           update_stat_pkg.load(:new.id, :new.id_t2, :new.ended);
        end if;
    end;
    /
    show err
    create or replace trigger update_stat_trig after update on table1
    begin
        update_stat_pkg.updt;
    end;
    /
    show err
    

    Now look for the UPDATE.

    SQL> select * from table1;
    
            ID      ID_T2      ENDED
    ---------- ---------- ----------
             1          1          0
             2          1          0
             3          1          0
             4          1          0
             5          1          0
             6          1          0
             7          1          0
             8          1          0
             9          1          0
            10          1          0
            11          2          0
            12          2          0
            13          2          0
            14          2          0
            15          2          0
            16          2          0
            17          2          0
            18          2          0
            19          2          0
            20          2          0
    
    20 rows selected.
    
    SQL> select * from table2;
    
            ID    SUCCESS
    ---------- ----------
             1          0
             2          0
    
    SQL> update table1 set ended = 1 where id between 1 and 7 or id between 11 and 19;
    
    16 rows updated.
    
    SQL> select * from table2;
    
            ID    SUCCESS
    ---------- ----------
             1         70
             2         90
    
    SQL> select * from table1;
    
            ID      ID_T2      ENDED
    ---------- ---------- ----------
             1          1          1
             2          1          1
             3          1          1
             4          1          1
             5          1          1
             6          1          1
             7          1          1
             8          1          0
             9          1          0
            10          1          0
            11          2          1
            12          2          1
            13          2          1
            14          2          1
            15          2          1
            16          2          1
            17          2          1
            18          2          1
            19          2          1
            20          2          0
    
    20 rows selected.
    
  • Creating a unique index frame on a one-to-many table and search

    Hello

    I was properly put in place of the full text index on multiple columns on the same table (using the MULTI_COLUMN_DATASTORE preferences), but now I have a situation with a table of one-to-many data collection (with a CF of a lookup table), and I need to get columns through two of these tables. Code example below, several of my chatter after the code block:
    CREATE TABLE SUBMISSION
    ( SUBMISSION_ID             NUMBER(10)          NOT NULL,
      SUBMISSION_NAME           VARCHAR2(100)       NOT NULL
    );
     
    CREATE TABLE ADVISOR_TYPE
    ( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      ADVISOR_TYPE_NAME         VARCHAR2(50)        NOT NULL
    );
      
    CREATE TABLE SUBMISSION_ADVISORS
    ( SUBMISSION_ADVISORS_ID    NUMBER(10)          NOT NULL,
      SUBMISSION_ID             NUMBER(10)          NOT NULL,
      ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      FIRST_NAME                VARCHAR(50)         NULL,
      LAST_NAME                 VARCHAR(50)         NULL,
      SUFFIX                    VARCHAR(20)         NULL
    );
    
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (1, 'Some Research Paper');
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (2, 'Thesis on 17th Century Weather Patterns');
    INSERT INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME) VALUES (3, 'Statistical Analysis on Sunny Days in March');
    
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (1, 'Department Chair');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (2, 'Department Co-Chair');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (3, 'Professor');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (4, 'Associate Professor');
    INSERT INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME) VALUES (5, 'Scientist');
    
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (1,1,2,'John', 'Doe', 'PhD');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (2,1,2,'Jane', 'Doe', 'PhD');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (3,2,3,'Johan', 'Smith', NULL);
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (4,2,4,'Magnus', 'Jackson', 'MS');
    INSERT INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX) VALUES (5,3,5,'Williard', 'Forsberg', 'AMS');
     
    COMMIT;
    I want to be able to create a text index to group these fields:

    SUBMISSION_ADVISORS. FIRST NAME
    SUBMISSION_ADVISORS. LAST_NAME
    SUBMISSION_ADVISORS. SUFFIX
    ADVISOR_TYPE. ADVISOR_TYPE_NAME

    I looked at DETAIL_DATASTORE and USER_DATASTORE, but examples of Oracle Docs for DETAIL_DATASTORE leave me a little confused. It seems that this should be fairly simple.

    Ideally, I try to avoid creating new columns and keeping a minimum shutter adjustments. But I'm open to any suggestion. Thanks for your time and your thoughts.

    -Jamie

    I would create a procedure that creates a virtual with labels document, what is the multi_column_datatstore behind the scenes. Then I would like to use this procedure in a user_datastore, so the result is the same for several tables as a multi_column_datastore for a table. I would use auto_section_group or another type of Group of sections, so that you can search from WITHIN as with the multi_column_datastore. Please see the demo below.

    SCOTT@orcl_11gR2> -- tables and data that you provided:
    SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION
      2  ( SUBMISSION_ID           NUMBER(10)          NOT NULL,
      3    SUBMISSION_NAME           VARCHAR2(100)          NOT NULL
      4  )
      5  /
    
    Table created.
    
    SCOTT@orcl_11gR2> CREATE TABLE ADVISOR_TYPE
      2  ( ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      3    ADVISOR_TYPE_NAME      VARCHAR2(50)          NOT NULL
      4  )
      5  /
    
    Table created.
    
    SCOTT@orcl_11gR2> CREATE TABLE SUBMISSION_ADVISORS
      2  ( SUBMISSION_ADVISORS_ID      NUMBER(10)          NOT NULL,
      3    SUBMISSION_ID           NUMBER(10)          NOT NULL,
      4    ADVISOR_TYPE_ID           NUMBER(10)          NOT NULL,
      5    FIRST_NAME           VARCHAR(50)          NULL,
      6    LAST_NAME           VARCHAR(50)          NULL,
      7    SUFFIX                VARCHAR(20)          NULL
      8  )
      9  /
    
    Table created.
    
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      3    VALUES (1, 'Some Research Paper')
      4  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      5    VALUES (2, 'Thesis on 17th Century Weather Patterns')
      6  INTO SUBMISSION (SUBMISSION_ID, SUBMISSION_NAME)
      7    VALUES (3, 'Statistical Analysis on Sunny Days in March')
      8  SELECT * FROM DUAL
      9  /
    
    3 rows created.
    
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      3    VALUES (1, 'Department Chair')
      4  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      5    VALUES (2, 'Department Co-Chair')
      6  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      7    VALUES (3, 'Professor')
      8  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
      9    VALUES (4, 'Associate Professor')
     10  INTO ADVISOR_TYPE (ADVISOR_TYPE_ID, ADVISOR_TYPE_NAME)
     11    VALUES (5, 'Scientist')
     12  SELECT * FROM DUAL
     13  /
    
    5 rows created.
    
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      3    VALUES (1,1,2,'John', 'Doe', 'PhD')
      4  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      5    VALUES (2,1,2,'Jane', 'Doe', 'PhD')
      6  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      7    VALUES (3,2,3,'Johan', 'Smith', NULL)
      8  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
      9    VALUES (4,2,4,'Magnus', 'Jackson', 'MS')
     10  INTO SUBMISSION_ADVISORS (SUBMISSION_ADVISORS_ID, SUBMISSION_ID, ADVISOR_TYPE_ID, FIRST_NAME, LAST_NAME, SUFFIX)
     11    VALUES (5,3,5,'Williard', 'Forsberg', 'AMS')
     12  SELECT * FROM DUAL
     13  /
    
    5 rows created.
    
    SCOTT@orcl_11gR2> -- constraints presumed based on your description:
    SCOTT@orcl_11gR2> ALTER TABLE submission ADD CONSTRAINT submission_id_pk
      2    PRIMARY KEY (submission_id)
      3  /
    
    Table altered.
    
    SCOTT@orcl_11gR2> ALTER TABLE advisor_type ADD CONSTRAINT advisor_type_id_pk
      2    PRIMARY KEY (advisor_type_id)
      3  /
    
    Table altered.
    
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_advisors_id_pk
      2    PRIMARY KEY (submission_advisors_id)
      3  /
    
    Table altered.
    
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT submission_id_fk
      2    FOREIGN KEY (submission_id) REFERENCES submission (submission_id)
      3  /
    
    Table altered.
    
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD CONSTRAINT advisor_type_id_fk
      2    FOREIGN KEY (advisor_type_id) REFERENCES advisor_type (advisor_type_id)
      3  /
    
    Table altered.
    
    SCOTT@orcl_11gR2> -- resulting data:
    SCOTT@orcl_11gR2> COLUMN submission_name FORMAT A45
    SCOTT@orcl_11gR2> COLUMN advisor      FORMAT A40
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  sa.advisor_type_id = a.advisor_type_id
     10  AND    sa.submission_id = s.submission_id
     11  /
    
    SUBMISSION_NAME                               ADVISOR
    --------------------------------------------- ----------------------------------------
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    Statistical Analysis on Sunny Days in March   Scientist Williard Forsberg AMS
    
    5 rows selected.
    
    SCOTT@orcl_11gR2> -- procedure to create virtual documents:
    SCOTT@orcl_11gR2> CREATE OR REPLACE PROCEDURE submission_advisors_proc
      2    (p_rowid IN           ROWID,
      3       p_clob     IN OUT NOCOPY CLOB)
      4  AS
      5  BEGIN
      6    FOR r1 IN
      7        (SELECT *
      8         FROM      submission_advisors
      9         WHERE  ROWID = p_rowid)
     10    LOOP
     11        IF r1.first_name IS NOT NULL THEN
     12          DBMS_LOB.WRITEAPPEND (p_clob, 12, '');
     13          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.first_name), r1.first_name);
     14          DBMS_LOB.WRITEAPPEND (p_clob, 13, '');
     15        END IF;
     16        IF r1.last_name IS NOT NULL THEN
     17          DBMS_LOB.WRITEAPPEND (p_clob, 11, '');
     18          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.last_name), r1.last_name);
     19          DBMS_LOB.WRITEAPPEND (p_clob, 12, '');
     20        END IF;
     21        IF r1.suffix IS NOT NULL THEN
     22          DBMS_LOB.WRITEAPPEND (p_clob, 8, '');
     23          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r1.suffix), r1.suffix);
     24          DBMS_LOB.WRITEAPPEND (p_clob, 9, '');
     25        END IF;
     26        FOR r2 IN
     27          (SELECT *
     28           FROM   submission
     29           WHERE  submission_id = r1.submission_id)
     30        LOOP
     31          DBMS_LOB.WRITEAPPEND (p_clob, 17, '');
     32          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r2.submission_name), r2.submission_name);
     33          DBMS_LOB.WRITEAPPEND (p_clob, 18, '');
     34        END LOOP;
     35        FOR r3 IN
     36          (SELECT *
     37           FROM   advisor_type
     38           WHERE  advisor_type_id = r1.advisor_type_id)
     39        LOOP
     40          DBMS_LOB.WRITEAPPEND (p_clob, 19, '');
     41          DBMS_LOB.WRITEAPPEND (p_clob, LENGTH (r3.advisor_type_name), r3.advisor_type_name);
     42          DBMS_LOB.WRITEAPPEND (p_clob, 20, '');
     43        END LOOP;
     44    END LOOP;
     45  END submission_advisors_proc;
     46  /
    
    Procedure created.
    
    SCOTT@orcl_11gR2> SHOW ERRORS
    No errors.
    SCOTT@orcl_11gR2> -- examples of virtual documents that procedure creates:
    SCOTT@orcl_11gR2> DECLARE
      2    v_clob  CLOB := EMPTY_CLOB();
      3  BEGIN
      4    FOR r IN
      5        (SELECT ROWID rid FROM submission_advisors)
      6    LOOP
      7        DBMS_LOB.CREATETEMPORARY (v_clob, TRUE);
      8        submission_advisors_proc (r.rid, v_clob);
      9        DBMS_OUTPUT.PUT_LINE (v_clob);
     10        DBMS_LOB.FREETEMPORARY (v_clob);
     11    END LOOP;
     12  END;
     13  /
    JohnDoePhDSome
    Research PaperDepartment Co-Chair
    JaneDoePhDSome
    Research PaperDepartment Co-Chair
    JohanSmithThesis on 17th Century
    Weather PatternsProfessor
    MagnusJacksonMSThe
    sis on 17th Century Weather PatternsAssociate
    Professor
    WilliardForsbergAMS
    

    Statistical Analysis on Sunny Days in

    MarchScientist
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> -- user_datastore that uses procedure:
    SCOTT@orcl_11gR2> BEGIN
      2    CTX_DDL.CREATE_PREFERENCE ('sa_datastore', 'USER_DATASTORE');
      3    CTX_DDL.SET_ATTRIBUTE ('sa_datastore', 'PROCEDURE', 'submission_advisors_proc');
      4  END;
      5  /
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> -- index (on optional extra column) that uses user_datastore and section group:
    SCOTT@orcl_11gR2> ALTER TABLE submission_advisors ADD (any_column VARCHAR2(1))
      2  /
    
    Table altered.
    
    SCOTT@orcl_11gR2> CREATE INDEX submission_advisors_idx
      2  ON submission_advisors (any_column)
      3  INDEXTYPE IS CTXSYS.CONTEXT
      4  PARAMETERS
      5    ('DATASTORE     sa_datastore
      6        SECTION GROUP     CTXSYS.AUTO_SECTION_GROUP')
      7  /
    
    Index created.
    
    SCOTT@orcl_11gR2> -- what is tokenized, indexed, and searchable:
    SCOTT@orcl_11gR2> SELECT token_text FROM dr$submission_advisors_idx$i
      2  /
    
    TOKEN_TEXT
    ----------------------------------------------------------------
    17TH
    ADVISOR_TYPE_NAME
    AMS
    ANALYSIS
    ASSOCIATE
    CENTURY
    CHAIR
    CO
    DAYS
    DEPARTMENT
    DOE
    FIRST_NAME
    FORSBERG
    JACKSON
    JANE
    JOHAN
    JOHN
    LAST_NAME
    MAGNUS
    MARCH
    PAPER
    PATTERNS
    PHD
    PROFESSOR
    RESEARCH
    SCIENTIST
    SMITH
    STATISTICAL
    SUBMISSION_NAME
    SUFFIX
    SUNNY
    THESIS
    WEATHER
    WILLIARD
    
    34 rows selected.
    
    SCOTT@orcl_11gR2> -- sample searches across all data:
    SCOTT@orcl_11gR2> VARIABLE search_string VARCHAR2(100)
    SCOTT@orcl_11gR2> EXEC :search_string := 'professor'
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string) > 0
     10  AND    sa.advisor_type_id = a.advisor_type_id
     11  AND    sa.submission_id = s.submission_id
     12  /
    
    SUBMISSION_NAME                               ADVISOR
    --------------------------------------------- ----------------------------------------
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    
    2 rows selected.
    
    SCOTT@orcl_11gR2> EXEC :search_string := 'doe'
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> /
    
    SUBMISSION_NAME                               ADVISOR
    --------------------------------------------- ----------------------------------------
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    
    2 rows selected.
    
    SCOTT@orcl_11gR2> EXEC :search_string := 'paper'
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> /
    
    SUBMISSION_NAME                               ADVISOR
    --------------------------------------------- ----------------------------------------
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    
    2 rows selected.
    
    SCOTT@orcl_11gR2> -- sample searches within specific columns:
    SCOTT@orcl_11gR2> EXEC :search_string := 'chair'
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN advisor_type_name') > 0
     10  AND    sa.advisor_type_id = a.advisor_type_id
     11  AND    sa.submission_id = s.submission_id
     12  /
    
    SUBMISSION_NAME                               ADVISOR
    --------------------------------------------- ----------------------------------------
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    
    2 rows selected.
    
    SCOTT@orcl_11gR2> EXEC :search_string := 'phd'
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN suffix') > 0
     10  AND    sa.advisor_type_id = a.advisor_type_id
     11  AND    sa.submission_id = s.submission_id
     12  /
    
    SUBMISSION_NAME                               ADVISOR
    --------------------------------------------- ----------------------------------------
    Some Research Paper                           Department Co-Chair John Doe PhD
    Some Research Paper                           Department Co-Chair Jane Doe PhD
    
    2 rows selected.
    
    SCOTT@orcl_11gR2> EXEC :search_string := 'weather'
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> SELECT s.submission_name,
      2           a.advisor_type_name || ' ' ||
      3           sa.first_name || ' ' ||
      4           sa.last_name || ' ' ||
      5           sa.suffix AS advisor
      6  FROM   submission_advisors sa,
      7           submission s,
      8           advisor_type a
      9  WHERE  CONTAINS (sa.any_column, :search_string || ' WITHIN submission_name') > 0
     10  AND    sa.advisor_type_id = a.advisor_type_id
     11  AND    sa.submission_id = s.submission_id
     12  /
    
    SUBMISSION_NAME                               ADVISOR
    --------------------------------------------- ----------------------------------------
    Thesis on 17th Century Weather Patterns       Professor Johan Smith
    Thesis on 17th Century Weather Patterns       Associate Professor Magnus Jackson MS
    
    2 rows selected.
    
  • 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;
    /
    
  • 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-20505: error in DML: p_rowid AAARr/AAOAAAAh9AAB =, p_alt_rowid = PK, p_row

    HI, Hi, I'm running Application Express 4.0.1.00.02 and Oracle 11 g I can't do updates. As a result of updates in the following: ORA-20505: error in DML: p_rowid = AAARr/AAOAAAAh9AAB, p_alt_rowid is PK, p_rowid2 =, p_alt_rowid2 is. ORA-01733: virtual column not allowed here. Insert or delete error is: ORA-01733: virtual column not allowed here. The pk in my opinion have a rowid column and do not have a sequence number. ManyThanks.

    ROWID is a virtual column in view of Oracle. You must identify a column or set of columns in the table for Oracle to TRY and maintain order in the data...

    Thank you

    Tony Miller
    Webster, TX

    Never argue with a fool. They do you drag down to their level, then beat you with experience.

  • A question about the count of several lines of table in a PL/SQL block

    Hi all




    I have a problem on counting the rows from several tables in a PL/SQL block, and I would be grateful if you could kindly give me a helping hand. Here's my problem: file in Microsoft Excel (one column) I have a list of several names of tables. For each table, when the number of rows is equal to 10000 I have to call a procedure. Here's how I tried to do:
    DECLARE
         CURSOR tb_cursor IS
              WITH my_table_names AS
                   (
                        SELECT  'table1'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table2'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table3'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table4'  AS tbname  FROM  DUAL  UNION
                        .
                        .  Here I continue writing one line for each table in order
                        .  to have the table names stored in my Excel file as a table 
                           to be queried by SELECT statement
                        .
                   )
              SELECT *
              FROM my_table_names;
    BEGIN
         -- Here I verify that for each table having more than 10000 lines
         -- I call the specified procedure which is needed
         
         FOR I IN tb_cursor LOOP
              DECLARE
                   -- Here I declare a cursor for counting the number of rows
                   CURSOR currentTableRowCounter IS
                        SELECT COUNT(*) AS rowsNum
                        FROM I.tbname;
                        
                   numberOfRows currentTableRowCounter%ROWTYPE;
              BEGIN
                   OPEN currentTableRowCounter;
                   FETCH numberOfRows INTO numberOfRows;
                   CLOSE currentTableRowCounter;
                   
                   IF (numberOfRows.rowsNum > 10000) THEN
                        -- And here I will call the procedure which has to be run
                   END IF;
              END;
         END LOOP;
    END;
    /
    I already checked this code with tables inividual and it works. The only problem is
    . . .
    SELECT COUNT(*) AS rowsNum
    FROM I.tbname;
    . . .
    Indeed, oracle considers "I.tbname" as an unknown table name (although he refers to by its exact name).
    SQL> @script.sql
    
                                    FROM I.tbname;
                                           *
    ERROR at line 99:
    ORA-06550: line 99, column 12:
    PL/SQL: ORA-00942: table or view does not exist
    How can I solve this problem? I mean, how to use a variable (in my example, I.tbname) as the table name in the FROM clause to query a table instead of explicitly write the name of the table?





    Thanks in advance,
    Dariyoosh

    Replace the following code:

              DECLARE
                   -- Here I declare a cursor for counting the number of rows
                   CURSOR currentTableRowCounter IS
                        SELECT COUNT(*) AS rowsNum
                        FROM I.tbname;
    
                   numberOfRows currentTableRowCounter%ROWTYPE;
              BEGIN
                   OPEN currentTableRowCounter;
                   FETCH numberOfRows INTO numberOfRows;
                   CLOSE currentTableRowCounter;
    
                   IF (numberOfRows.rowsNum > 10000) THEN
                        -- And here I will call the procedure which has to be run
                   END IF;
              END;
    

    By the following:

    Declare
      numberOfRows number;
    begin
      EXECUTE IMMEDIATE 'select count(*) from '||I.tbname into numberOfRows;
    
      IF (numberOfRows.rowsNum > 10000) THEN
        -- And here I will call the procedure which has to be run
      END IF;
    end;
    

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/10/crittografia-in-plsql-utilizzando-dbms_crypto/]

    Published by: Massimo Ruocchio, January 12, 2010 15:25
    Added Variable Declaration

  • Table temporary global vs create and drop an ordinary table in pl/sql proc

    Hello!

    I currently have these statements in a pl/sql procedure:

    EXECUTE IMMEDIATE 'drop table tmp_deal;

    RUN IMMEDIATELY.
    create the table tmp_deal as
    Select deal_tracking_num, ins_num, tran_status
    ab_tran t, part p
    where 1 = 1
    AND t.internal = p.PARTY_ID
    AND p.sname in ("SXXX - YY", "ZZZNE - TT","FG - RT")
    and t.MAT_DATE > sysdate - 15 * 31
    AND t.status IN (1,3,4,11)';

    EXECUTE IMMEDIATE 'create index tmp_deal_idx1 on statistics calculation in line of tmp_deal (status, tracking_num);
    EXECUTE IMMEDIATE 'create index tmp_deal_idx2 on statistics calculation in line of tmp_deal (tracking_num, status);
    EXECUTE IMMEDIATE 'create index tmp_deal_idx3 on statistics calculation in line of tmp_deal (ins_num);


    As you can see I am falling and re-creating a table. The table is used as an intermediate storage for a larger SQL following further in my procedure (not shown in this post).

    My question is:
    Y at - it an advantage or a drawback in using global temporary tables (gtt) instead of the create and drop an ordinary table? The table contains about 7000 records and is not needed more once the procedure is complete. The procedure runs once per day, every day of the year

    We are running Oracle 9iR2.

    And finally, please do not look to find errors in SQL statements above. They are slightly darkened and still developing. The basic question is if TWG's benefit to the common way to do it.


    Thank you in advance for your help!

    user7066552, the use of temporary tables may be a necessity in SQL Server and mySQL, but with Oracle and its authors do not block readers reading model consistency using temporary tables as part of the treatment is generally unnecessary.

    A valid use for a table of work could be where you create an operating table that is used to generate reports that are run on demand and several different users need access to the same data. However, you create the work only one table and truncate it prior to restocking rather than drop and it dynamically create. When only the current process will use the data a TWG is the way to go if you must have a table that is "temporary".

    HTH - Mark D Powell.

  • Count several element in a table 1 d

    Hi LV Warrior.

    I have a problem regarding the handling of data in a table.

    I have a table of elements (numbers), and I want to count the elements in an array.

    Example: Table (1,1,1,1,2,2,2,3,3,3,3,3,5,5,5)

    I want to have a listbox at the end showing that we have:

    4 times 1

    3 times 2

    5 times 3

    3 times 5

    I don't know how. Any ideas would be helpful...

    Thank you

    Here is a version that generates a 2D output table. The first column has the counties and the second column has values. It sorts the input array, so there is no restriction on the order of the elements in the input array.  Limitation: Integer Data Types.

    The second case structure handles both cases where the last two items in the sorted table are identical or different.

    Thanks to Bob Schor: after thinking about the question for a bit I copied the algorithm before you start coding.  The algorithm is not specified in the VI.

    Lynn

  • Save and write data from table to table - easy

    Hello

    I got this system delivered to me. I'm new to LabView and just save the data from the table "average voltage" (inside the while loop) to do some additional testing of our product.

    I will like to do similar to this.

    (1) save in excel file.

    (2) save only when a button button and save it then 5 ilteration.

    (3) save and manipulate the data, so it is displayed in 6 columns (each LED 1) instead of 1 long colum.

    I tried different things with structure business T/F, which resolved the buttom-request. But I am in doubt I should use, writing to the file of the measurement or write to us to the worksheet (by using labview 15.0)-delimited according to my offer the best possible?

    He also seems to be too much to handle when I try to write in txt file, because it pops up with and error that I do not know how to fix, but it says this:

    Error-200279

    Possible reasons:

    The application is not able to cope with the acquisition of equipment.

    Increase in the size of buffer, most frequently the reading of data or by specifying a fixed number of samples to read instead of reading all available samples would correct the problem.

    Property: RelativeTo

    Corresponding value: current playback Position

    Property: Offset

    Corresponding value: 0

    Task name: analog channel

    Thanks in advance

    I agree with Taki, but want to make some additional remarks:

    • LabVIEW is a data flow language.  Think of the "flow" of your data.  You talk about "save only when a key is pressed" and a finite set of data.  You are collecting before the press the button and everything just do not save?
    • Data are collected at some rate, and likely, you don't want to "Miss" data points.  This means that you shouldn't do anything in the loop of the Collection that takes a long time.  If your recovery rate is low and your treatment is fast, you can have everything in a single loop.  Otherwise, to use the technical stream (producer/consumer is a good) to process the data in a single loop in parallel with the collection in a loop independent (and asynchronously).
    • How do you write your data?  You want to write "on the fly", as it is, or can you wait, collect everything, any format and then write it "all at once"?
    • What do you mean by 'save the file in Excel?  Do you mean a 'native' Excel file, one with the extension .xls or .xlsx?  Do you mean a Comma-Separated Variable (.csv) file this reading peut of Excel (and, indeed, usually registers itself to read, change the icon of the .csv files to "look like" it is really an Excel file)?  If the first case, I recommend using the report generation tool.  But for the latter, you can also use write delimited spreadsheet, which can be easier to use.

    Bob Schor

  • I have a PC brand new - HP and played Chess Titans. Now all of a sudden it says it cannot find the texture, but he said no zero the reference count and then could not find device 3D.

    original title: Chess Titans

    I have a PC brand new - HP and played Chess Titans.  Now all of a sudden it says it cannot find the texture, but he said no zero the reference count and then could not find device 3D.  What's past and how to fix this.  Thank you.

    These error messages can occur if you (or software) also disabled Aero. Aero must be on (and supported by the video card) to play Chess Titans. "192GO should be enough for everyone." (of the miniseries "Next generation jokes")

  • How to solve the "HKEY_LOCAL_MACHINE Windows Search\Gather\Windows\System Index missing or invalid" error message

    'HKEY_LOCAL_MACHINE Windows Search\Gather\Windows\System Index missing or invalid' error message appears after each Norton Utilities scan.

    The problem is that IE frequently slows down or blocks, the Task Manager shows the CPU clocked at 100% the problem will clear for 5-10 minutes.

    I am running Windows XP Home Edition with Norton Utilities; Norton Antivirus; Advance system care and Super AntiSpyware as my software security.

    Anyone had any chance to solve this problem?

    Thank you

    Richard Boyer

    Hello

     

    ·         Is your update of the antivirus program?

    ·         Were there recent changes made on the computer before the show?

     

    Follow these steps and check if that helps.

     

    Step 1:

    As you receive the error message when you use Norton, I suggest you to contact Norton support:

    http://us.Norton.com/support/index.jsp

    Step 2:

    I suggest you run this Microsoft Fixit tool and check if it helps.

    Solve Internet Explorer add-on problems when IE hangs or freezes

    http://support.Microsoft.com/mats/ie_freezes_or_crashes/en-us

    You can also view this article to improve the performance of Internet Explorer and check if it helps.

    Internet Explorer is slow? 5 things to try

    http://Windows.Microsoft.com/en-us/Windows/help/Internet-Explorer/slow-five-tips-to-boost-performance

Maybe you are looking for

  • Lost my hard drive

    Can I Exchange my 500 GB Serial ATA SATA Hard Drive IQ506 for a 500 GB Serial ATA SATA Hard Drive HP TouchSmart IQ775 IQ770 HP TouchSmart? My product is KQ437AA SN[personal information] Hitachi HDP725050GLA360 HARD drive Win Vista 64-bit

  • Satellite Pro A300D - black & white photo via S-video

    Hello I have a Satellite Pro A300D. After months of work perfectly, it now gives me a black & white image on my screen extended through my S Video Jack, although my laptop screen is in color. I checked all the wires and they are fine. Did I miss some

  • Misfortunes of Slimline Pavillion

    I have real difficulty at the moment get a pavilion slimline s3110.uk pc friends behave...Its Vista Home premium running and it is sometimes holding still and a day to start. Sometimes he goes to the disk check, and then other times it will go to rec

  • Windows Update does not work on my laptop - I get the error C800044E. nothing seems to work.

    I ran Symantec and the removal tool malicious s/w - found nothing.  I get a similar error when I try to update the windows defender definitions.

  • How do we uninstall Realtek PCIE Card Reader

    Hello I am running on windows 7, I will try yo upgrade to 8 but it says I have to uninstall Realtek PCIE Card Reader. but I can not find it to uninstall. I checked the driver manager, that I still couldn't find it