Insert by using the loop

Hi all
Take into consideration the following:

CREATE TABLE  XX_SEG
  (
    SEGMENT3 VARCHAR2(20),
    SEGMENT4 VARCHAR2(20 )
  )
CREATE TABLE XX_SEG3
  (
    SEG3 VARCHAR2(20)
  )
CREATE TABLE XX_SEG4
  (
    SEG4 VARCHAR2(20)
  )
Insert into xx_seg3 (SEG3) values ('0000');
Insert into xx_seg3 (SEG3) values ('0001');
Insert into xx_seg3 (SEG3) values ('0002');
Insert into xx_seg3 (SEG3) values ('0003');
Insert into xx_seg3 (SEG3) values ('0004');
Insert into xx_seg3 (SEG3) values ('0005');
Insert into xx_seg3 (SEG3) values ('0008');
Insert into xx_seg3 (SEG3) values ('0015');
Insert into xx_seg3 (SEG3) values ('0017');
Insert into xx_seg3 (SEG3) values ('0100');
Insert into xx_seg3 (SEG3) values ('0101');
Insert into xx_seg3 (SEG3) values ('0121');
Insert into xx_seg3 (SEG3) values ('0141');
Insert into xx_seg3 (SEG3) values ('0142');



Insert into xx_seg4 (SEG4) values ('1000');
Insert into xx_seg4 (SEG4) values ('1004');
Insert into xx_seg4 (SEG4) values ('1306');
Insert into xx_seg4 (SEG4) values ('1308');
Insert into xx_seg4 (SEG4) values ('1309');
Insert into xx_seg4 (SEG4) values ('1310');
Insert into xx_seg4 (SEG4) values ('1312');
Insert into xx_seg4 (SEG4) values ('1321');
Insert into xx_seg4 (SEG4) values ('1400');
Insert into xx_seg4 (SEG4) values ('1407');
Insert into xx_seg4 (SEG4) values ('1500');
Insert into xx_seg4 (SEG4) values ('1600');
Insert into xx_seg4 (SEG4) values ('1801');
Insert into xx_seg4 (SEG4) values ('1803');
INSERT INTO XX_SEG4 (SEG4) VALUES ('1806');
Insert into xx_seg4 (SEG4) values ('1807');
The question is: for each seg3 I want to insert all the values for seg4 in the xx_seg table.

I try the following:
DECLARE 

BEGIN 
  FOR I IN (SELECT SEG3 FROM XX_SEG3)LOOP
    FOR I2 IN (SELECT seg4 FROM X_SEG4)LOOP
      INSERT INTO XX_SEG  
        values (i.seg3,i2.seg4);  
    end loop;   
  end loop;
end;
but I got the error:
ORA-06550: line 5, column 33:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 5, column 16:
PL/SQL: SQL Statement ignored
ORA-06550: line 7, column 24:
PLS-00364: loop index variable 'I2' use is invalid
ORA-06550: line 7, column 27:
PL/SQL: ORA-00984: column not allowed here
ORA-06550: line 6, column 7:
Any ideas?
Version: 11g


Thanks in advance,
Bahchevanov.

OF X_SEG4 => OF XX_SEG4

Tags: Database

Similar Questions

  • An associative array, how the records using the loop counter?

    In the associative array, how the records using the loop counter? for example
    declare
        type population is table of number index by varchar2(64);
        city_population population;   
    begin
        city_population('Samillve') := 200;
        city_population('Lindenhurst') := 300;    
        
        for i in 1 .. city_population.count
        loop
            dbms_output.put_line(city_population(i)); -- compiler error
        end loop;
    end;
    /

    That would look like

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2      type population is table of number index by varchar2(64);
      3      city_population population;
      4      l_index varchar2(64);
      5  begin
      6      city_population('Samillve') := 200;
      7      city_population('Lindenhurst') := 300;
      8      l_index := city_population.first;
      9      while( l_index IS NOT NULL )
     10      loop
     11          dbms_output.put_line(city_population(l_index ));
     12          l_index := city_population.next(l_index);
     13      end loop;
     14* end;
    SQL> /
    300
    200
    
    PL/SQL procedure successfully completed.
    

    Justin

  • Using the loop will decrease performance

    Hello
    Using the loop with a query will decrease performance.

    for r_row in (select * from table) Loop
    end of loop.

    This is done within another loop for, more cases, it returns a single value.
    It will decrease the performance of the procedure.
    kindly advice...

    Kind regards
    Balu

    user575682 wrote:
    Using the loop with a query will decrease performance.

    for r_row in (select * from table) Loop
    end of loop.

    This is done within another loop for, more cases, it returns a single value.
    It will decrease the performance of the procedure.

    Perhaps better understand everything that makes this PL/SQL loop construction.

    PL/SQL is two languages. It's PL (logic programming code) like Pascal, C or Java. You can use a 2nd language in it called SQL. The PL engine will be able to recognize when the 2nd language is used. And it compiles all the things that are necessary for motor PL call the SQL engine, pass the data to the SQL engine and get back data, etc. (compare this with the complexity of the use of SQL in Pascal, C or Java language).

    So what's this loop? The PL engine recognizes the SQL SELECT statement. It creates an implicit cursor by calling the SQL engine to analyze (I hope a soft Parser), then run it.

    As part of the loop of the PL, the PL engine now calls the SQL engine to extract data (lines) of the cursor. With 10g and later, the engine of the PL is smart enough to use the implicit treatment in bulk.

    Before 10 g that he used to extract a line from the SQL engine, make the loop, the next line extraction, the loop, etc. In other words, if there is a 1000 lines to pick up, he'll call the SQL engine after 1000.

    With 10g and later he get a 100 lines, which store in a buffer internal and then make the loop once 100. With a 1000 lines to fetch, it requires 10 extractions in bulk instead of one 1000 rank of extractions.

    These extractions require a change of context - as the engine PL must not out back, and in the SQL engine to extract a line. It is an overhead projector and can become so slow the context switch nothing more.

    And it's the construction of bases for this loop (and most other cursor loops) in PL/SQL.

    The ideal is to reduce the number of context switches. It is an overload that can have an impact on performance.

    What about using a loop in a loop. As 'bad '. This example uses the outer loop to retrieve the data. These data are then used to excite the extraction in internal or nested loop. The outside loop draws data from the SQL engine in PL variables Inside loop drives that same data back to the SQL engine.

    Why? It would have been much faster not to pull and push data between the loops using PL.

    It will be much faster do so only through SQL. Write the two loops as a single SQL statement and have the SQL engine directly driving these loops itself. This is called a JOIN in SQL. And the SQL engine can do not only more quickly, but it has a few algorithms of multiplied can be used which are even faster than a nested loop process (called merge joins, hash joins, etc.).

    Bottom line. Optimize SQL. Reduce to a minimum the PL. *

    Do as much of your data, crunch in SQL as possible. SQL is the fastest 'place' and process the data. No PL (or C/Pascal/Java).

  • insert into the table using the loop and permanently display

    Hello

    I am trying to insert some values of loop loop run into two tables and trying to draw using Graph XY. I need values Joanie be inserted one by one in each iteration. But at the end of the iteration in the table, I get only last value... can someone help me?

    Hello Manu,

    use a shift register to store each table. BuildArray allows to add/Add (not Insert!) of new values in the table.

    Then you need not use an ExpressVI to create the chart, a knot simple bundle (as indicated in the context-sensitive help) is enough to create a field in a XY Chart...

    Example with a table:

    Keep in mind:

    It's not (memory/CPU time) effective to use for time of data acquisition time (giving rise to large Bay). Use different approaches then...

  • Build the value of 100 mb of data in the table using the loop

    DB version: 11.2

    How can I create about 100 MB of test data in a table using minum number of records.
    If I use the below for loop. It takes 100,000 records to fill only 2 MB.
    SQL> create table a2 (mynum1 number, mynum2 number);
    
    Table created.
    
    begin
    for i in 1..100000 loop
        insert into a2 values(i,i*2);
    end loop;
    end;
    
    
    select segment_name, bytes/1024/1024 MB from dba_segments where segment_name = 'A2' AND owner='SCOTT'
    
    
    SEGMENT  BYTES/1024/1024
    -------- ---------------
    A2                     2

    Hello

    Is that what you are looking for?

    SQL> CREATE TABLE tbl1(c1 CHAR(1024));  -- ~1KB per row
    
    Table created.
    
    Elapsed: 00:00:00.00
    SQL> INSERT /*+ APPEND */ INTO tbl1 SELECT 'X' FROM dual CONNECT BY LEVEL < 100000; -- 100K rows * 1KB = 100MB + some additional overhead
    
    99999 rows created.
    
    Elapsed: 00:00:13.02
    SQL> SELECT bytes/1024/1024 MB FROM user_segments WHERE segment_name = 'TBL1';
    
            MB
    ----------
        113.75
    

    Lukasz

  • How to use the loop in BPEL process

    Hi friends

    I did a bpel process that picks up the XMl file using the File adapter and imports the data from the XMl file into db oracle table using the DB adapter...

    But here the XML in the file that have only one line... If I want to insert the XML code in the file that have two or more lines I want to use a loop in my process BPEL how to use loop in my bpel process?

    In my BPEL process, that I have que j' ai utilise used receive, process and call activity where I can use in my BPEL process

    Thanks in advance

    AT

    Here is a basic example of while activity in BPEL

    http://blogs.Oracle.com/ajaysharma/

    Thank you
    AJ

  • How to use the loop to commit every 1 M folders?

    Oracle 9i
    40 M records must be insert the table. You will need to validate every 1 M. But I don't want to loop every recording and validation. I like select commit and records of 1 m and then select another 1 M, then validation; How to do? use the save point?

    Appreciate any ideas.
    Thank you
    S.

    You can perform this anonymous help block by using a loop and listen but it not a good idea to commit after 1 million or 100 k you put more load on your system and the performance will be declining.

    Concerning

  • Incorrect display using the loop format for

    Hello

    I have a digital painting using a hexadecimal display format that is autoindexed by a loop for. Within the loop for each unique value is passed to a Subvi needed the hexadecimal display format. Unfortunately, indexing is not keep this hex format but transfers back to a decimal number.

    No idea how to solve this problem?

    Thanks in advance and best regards

    Simon

    Thanks for this tip. The problem was an another Subvi where I created the num-array that will subsequently in the loop for., all the digital elements where the value instead of I32 I16. The controller could not handle these false values, so I got a nonsense.

    Thank you very much for your quick responses!

  • decimal to binary conversion using the loop

    How to create a LabVIEW program to convert a decimal number to binary equivalent using FOR loop?

    can someone help me please...

    Dhass, your sound question as a duty. Is this correct?

    If so, the zip code you have already so that we can identify the weak points in it.

    Tone

  • Excerpt from my table using the loop For

    Hello

    I have this loop to create a 2D array. The result is on the table below. I want that this 2D table should be fully completed and compiled, then it will be sent out of the loop.

    I don't want to extract the value of table 2D is a loop. This is the problem that I am facing.

    My ultimate goal is to extract the individual number of the final table of the 2D table line and be an entry for other functions.

    Please help me. Thank you

    PX

    Hi PX.

    Here's a solution without using screw express

  • Insert pictures using the registers as a parameter

    Hello

    I need to insert data into the table that my procedure will be called via JAVA.

    No Java so wonder if it is possible to take a JAVA object (which is the records outside PLSQL) as input and then insert it into the tables.

    Here's the DDL for tables

    create table gnv_sol_attributes)

    so_id varchar2 (20).

    se_integration_id varchar2 (20).

    ParameterName varchar2 (100),

    action_code varchar2 (20).

    parameter_value VARCHAR2 (255)

    );

    create table

    () gnv_sol_serviceelement

    customer_ref varchar2 (20).

    billing_account_code varchar2 (20).

    so_id varchar2 (20).

    so_type varchar2 (5).

    se_integration_id varchar2 (20).

    se_root_integration_id varchar2 (20).

    se_parent_integration_id varchar2 (20).

    offer_id varchar2 (75).

    offer_id_old varchar2 (75).

    pricing_id varchar2 (75).

    promo_id varchar2 (20).

    action_code varchar2 (20).

    REASON_ID varchar2 (100),

    product_code varchar2 (40),

    date of product_subsc_date,

    date of product_start_date,

    date of product_modify_date,

    date of product_end_date,

    event_source varchar2 (40),

    sales_force_code varchar2 (20).

    line_number varchar2 (20).

    product_status varchar2 (2)

    );

    So there in the table of gnv_sol_attributes for different simple so_id and se_integration_id parameter_name.

    Here they explain as in a record we can and then insert it another folder (look like multidimensional collection).

    Sample data for the table of gnv_sol_serviceelemen

    CUSTOMER_REF,BILLING_ACCOUNT_CODE,SO_ID,SO_TYPE,SE_INTEGRATION_ID,SE_ROOT_INTEGRATION_ID,SE_PARENT_INTEGRATION_ID,OFFER_ID,OFFER_ID_OLD,PRICING_ID,PROMO_ID,ACTION_CODE,REASON_ID,PRODUCT_CODE,PRODUCT_SUBSC_DATE,PRODUCT_START_DATE,PRODUCT_MODIFY_DATE,PRODUCT_END_DATE,EVENT_SOURCE,SALES_FORCE_CODE,LINE_NUMBER,PRODUCT_STATUS

    C_1, BA_1, SO_1, OT_1, SE_1, SE_1, SE_1, STDE_A8, STDE_A8_FEE_AE, add, STDE_A8, 7/13/2015,7/13/2015, 1.

    C_1, BA_1, SO_1, OT_1, SE_2, SE_1, SE_1, STDE_A8, STDE_MA, add, STDE_MA, 7/14/2015,7/14/2015, 2,

    C_1, BA_1, SO_1, OT_1, SE_3, SE_1, SE_1, STDE_A8, STDE_WIFI, add, STDE_WIFI, 7/15/2015,7/15/2015, 3,.

    C_1, BA_1, SO_1, OT_1, SE_4, SE_1, SE_1, STDE_A8, STDE_BCK_M_FEE_AE, add, STDE_BCK_M, 7/16/2015,7/16/2015, 4,.

    C_1, BA_1, SO_1, OT_1, SE_5, SE_1, SE_1, STDE_A8, SBRI_1_FEE_AE, add, SBRI_1, 7/17/2015,7/17/2015, 5.

    C_1, BA_1, SO_1, OT_1, SE_6, SE_1, SE_1, STDE_A8, SBRI_6_FEE_AE, add, SBRI_4, 7/18/2015,7/18/2015, 6,.

    C_1, BA_1, SO_1, OT_1, SE_7, SE_1, SE_1, STDE_A8, SPUN_6_FEE_AE, add, SPUN_6, 7/19/2015,7/19/2015, 7,.

    C_1, BA_1, SO_1, OT_1, SE_8, SE_1, SE_7, STDE_A8, SPUN_AV_6, add, SPUN_AV_6, 7/20/2015,7/20/2015, 8.

    C_1, BA_1, SO_1, OT_1, SE_9, SE_1, SE_7, STDE_A8, SPUN_AF_6, add, SPUN_AF_6, 7/21/2015,7/21/2015, 9,.

    C_1, BA_1, SO_1, OT_1, SE_10, SE_1, SE_7, STDE_A8, SPUN_ARS_6, add, SPUN_ARS_6, 7/22/2015,7/22/2015, 10.

    C_1, BA_1, SO_1, OT_1, SE_11, SE_1, SE_1, STDE_A8, SCOE_VOIP_CEIP_3_FEE_AE, add, SCOE_VOIP_CEIP_3, 7/23/2015,7/23/2015, 11.

    sample data for gnv_sol_attributes

    PARAMETER_VALUE, PARAMETER_NAME, SO_ID, ACTION_CODE, SE_INTEGRATION_ID

    1, SO_1 SE_1, PCT? (Without), adding,?

    2, SO_1 SE_1, the PCT FEE, add, 110.

    3, SO_1 SE_1, AE PCT, add, 212.

    4, SO_1 SE_1, AE + TAX PCT, add, 218.

    5, SO_1 SE_1, STRONGHOLD of BOO, add, YES,

    6, SO_1 SE_1, AE BOO, add, YES,

    7, SO_1 SE_1, AE + TAX BOO, add, YES,

    8, SO_1 SE_1, hierarchy ID, Add,

    9, SO_1 SE_1, hierarchy Add subscription ID,

    10, SO_1, SE_1, ID Add parent hierarchy,

    11, SO_1, SE_1, date of the subscription, add-on, 31/07/2015,

    12, SO_1, SE_1, filling start date, Add, 31/07/2015.

    13, SO_1, SE_1, beginning of billing to update, add, 31/07/2015.

    14, SO_1, SE_1, (address), add,

    15, SO_1, SE_1, download Bandwidth, add, 20480.

    16, SO_1, SE_1, download bandwidth, add-on, 1024,

    I created this procedure and it's successfully insert one line in the table of bith.

    create or replace procedure ins_svc (p_svc IN SVC_REC, p_svc_att IN SVC_ATTR_REC)

    is

    Start

    insert into gnv_sol_serviceelement (p_svc.customer_ref, p_svc.billing_account_code, p_svc.so_id, p_svc.so_type values

    p_svc.se_integration_id, p_svc.se_root_integration_id, p_svc.se_parent_integration_id

    p_svc.offer_id, p_svc.offer_id_old, p_svc.pricing_id, p_svc.promo_id, p_svc.action_code

    p_svc.reason_id, p_svc.product_code, p_svc.product_subsc_date, p_svc.product_start_date

    p_svc.product_modify_date, p_svc.product_end_date, p_svc.event_source

    p_svc.sales_force_code, p_svc.line_number, p_svc.product_status);

    insert into GNV_SOL_ATTRIBUTES (p_svc_att.so_id, p_svc_att.se_integration_id, p_svc_att.parameter_name values

    (p_svc_att.action_code, p_svc_att.parameter_value);

    exception

    while others then

    dbms_output.put_line (' error code ' |') '|| SQLCODE. » '||' The error '. SQLERRM);

    end;

    Now that JAVA person asking me if there is a way in which I insert one line in the gnv_sol_serviceelemen table

    and several lines in the gnv_sol_attributes because there is in the table of attributes different parameter value for the same so_id and SE_INTEGRATION_ID.

    This is where I got stuck.

    If anyone has a wayout.

    DATABASE VERSION: -.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    You can create an API like this

    SQL> create or replace package gnv_sol_api
      2  as
      3    type gnv_sol_attributes_tbl is table of gnv_sol_attributes%rowtype index by pls_integer;
      4
      5    procedure gnv_sol_insert(par1 gnv_sol_serviceelement%rowtype, par2 gnv_sol_attributes_tbl);
      6  end;
      7  /
    
    Package created.
    
    SQL> create or replace package body gnv_sol_api
      2  as
      3    procedure gnv_sol_insert(par1 gnv_sol_serviceelement%rowtype, par2 gnv_sol_attributes_tbl)
      4    is
      5    begin
      6      insert into gnv_sol_serviceelement values par1;
      7      forall i in 1..par2.count
      8          insert into gnv_sol_attributes values par2(i);
      9    end;
     10  end;
     11  /
    
    Package body created.
    

    I used the anonymous PL/SQL block as a customer to call this API. For you, it would be Java.

    SQL> declare
      2    var1 gnv_sol_serviceelement%rowtype;
      3    var2 gnv_sol_api.gnv_sol_attributes_tbl;
      4  begin
      5    var1.customer_ref              := 'C_1';
      6    var1.billing_account_code      := 'BA_1';
      7    var1.so_id                     := 'SO_1';
      8    var1.so_type                   := 'OT_1';
      9    var1.se_integration_id         := 'SE_1';
     10    var1.se_root_integration_id    := 'SE_1';
     11    var1.se_parent_integration_id  := 'SE_1';
     12    var1.offer_id                  := 'STDE_A8';
     13    var1.offer_id_old              := null;
     14    var1.pricing_id                := 'STDE_A8_FEE_AE';
     15    var1.promo_id                  := null;
     16    var1.action_code               := 'Add';
     17    var1.reason_id                 := null;
     18    var1.product_code              := 'STDE_A8';
     19    var1.product_subsc_date        := to_date('7/13/2015','mm/dd/yyyy');
     20    var1.product_start_date        := to_date('7/13/2015', 'mm/dd/yyyy');
     21    var1.product_modify_date       := null;
     22    var1.product_end_date          := null;
     23    var1.event_source              := null;
     24    var1.sales_force_code          := '1';
     25    var1.line_number               := null;
     26
     27    var2(1).so_id                  := 1;
     28    var2(1).se_integration_id      := 'SO_1';
     29    var2(1).parameter_name         := 'SE_1';
     30    var2(1).action_code            := 'PCT? (Without)';
     31    var2(1).parameter_value        := 'Add';
     32
     33    var2(2).so_id                  := 2;
     34    var2(2).se_integration_id      := 'SO_1';
     35    var2(2).parameter_name         := 'SE_1';
     36    var2(2).action_code            := 'FEE PCT';
     37    var2(2).parameter_value        := 'Add';
     38
     39    var2(3).so_id                  := 3;
     40    var2(3).se_integration_id      := 'SO_1';
     41    var2(3).parameter_name         := 'SE_1';
     42    var2(3).action_code            := 'AE PCT';
     43    var2(3).parameter_value        := 'Add';
     44
     45    var2(4).so_id                  := 4;
     46    var2(4).se_integration_id      := 'SO_1';
     47    var2(4).parameter_name         := 'SE_1';
     48    var2(4).action_code            := 'AE+FEE PCT';
     49    var2(4).parameter_value        := 'Add';
     50
     51    gnv_sol_api.gnv_sol_insert(var1, var2);
     52  end;
     53  /
    
    PL/SQL procedure successfully completed.
    

    output

    SQL> select * from gnv_sol_serviceelement;
    
    CUSTOMER_REF    BILLING_ACCOUNT SO_ID           SO_TYPE         SE_INTEGRATION_ SE_ROOT_INTEGRA SE_PARENT_INTEG OFFER_ID        OFFER_ID_OLD    PRICING_ID      PROMO_ID        ACTION_CODE     REASON_ID       PRODUCT_CODE    PRODUCT_SUBSC_D PRODUCT_START_D PRODUCT_MODIFY_ PRODUCT_END_DAT EVENT_SOURCE    SALES_FORCE_COD LINE_NUMBER     PRODUCT_STATUS
    --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- ---------------
    C_1             BA_1            SO_1            OT_1            SE_1            SE_1            SE_1            STDE_A8                         STDE_A8_FEE_AE                  Add                             STDE_A8         13-JUL-15       13-JUL-15                                                       1                               
    
    SQL> select * from gnv_sol_attributes;
    
    SO_ID           SE_INTEGRATION_ PARAMETER_NAME       ACTION_CODE     PARAMETER_VALUE
    --------------- --------------- -------------------- --------------- --------------------
    1               SO_1            SE_1                 PCT? (Without)  Add
    2               SO_1            SE_1                 FEE PCT         Add
    3               SO_1            SE_1                 AE PCT          Add
    4               SO_1            SE_1                 AE+FEE PCT      Add
    
  • Using the loop

    Hi all

    I have two VO... IE, VO1 and VO2. and I have a handful of two your

    I want to compare attribute VO1 VO2 attribute... both have guess that 4 attributes.

    what I want to do here is: first of all I want to compare all 4 attributess VO1 1 rank to all the 4 attributes of 1st row of VO2. If they're all matches then the 5th value of attribute attribute value VO1 VO2 5th.

    If the 1st rank of VO1 is not with the 1st rank of VO2 then compare VO1 1 rank 2nd in the VO2... and so on...

    If the match then set value and exit that loop... and yet once compare with 2nd row of VO1 1st row of VO2...

    How can I do this... can I use 2 loops?

    loop external and inner loop?

    If Yes, then how can I extract the data of both your and how I can compare their attributes?

    Thank you...

    Hello

    Yes... you can do using two Do While loops. using vo.next.

    Please find the below generic example code.

    OAViewObject dbVo = (OAViewObject) oaapplicationmodule.findViewObject ("SimpleSearchVO");

    Line line = null;

    dbVo.reset ();

    do

    {

    line = dbVo.next ();

    if(Row == null)

    {

    break;

    }

    Line row2 = dbVo.getCurrentRow ();

    String newprice = String.valueOf (row2.getAttribute (viewAttributeName))

    } while (true);

    Thank you

    Bharat

  • Cross-Schema insert by using the stored procedure

    Hi all.

    I am currently migrating 11.2.0.1 to 11.2.0.3,
    and I have to deal with an unexpected privileges error "ORA-13199: insufficient privilege for the table in the application of the xxx model."

    While inserting triplets in the table in the application of the model
    using a stored procedure which is
    owned by the owner of model table and app,
    but called by another issued user.

    There has never been a problem 10.2.0.4 or 11.2.0.1.
    It seems that something has really changed, (perhaps an authid pragma or something like this in the code internal SDO_RDF_TRIPLE?)
    The two users are needed on my system for security policy reasons.



    Here's a simplified script to reproduce the success on 1.2.0.1 and error on 11.2.0.3.
    Users are: ADMWAT = model, USEWAT = calling application


    SQL > connect SYS/xxxxx@DB_*11201*.world as sysdba
    Connected.
    SQL > select value of MDSYS. RDF_PARAMETER where namespace = "MDSYS" and the attribute = "SEM_VERSION";

    VALUE
    --------------------------------------------------------------------------------
    * 112 *.

    SQL >
    SQL > connect ADMWAT/xxxxx@DB_11201.world
    Connected.
    SQL > CREATE TABLE family_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S);

    Table created.

    SQL >
    SQL > exec SEM_APIS.create_rdf_model ('family', 'family_rdf_data', 'three');

    PL/SQL procedure successfully completed.

    SQL >
    SQL > GRANT INSERT ON family_rdf_data in MDSYS.

    Grant succeeded.

    SQL >
    SQL > create or replace PROCEDURE NEW_TRIPLE IS
    BEGIN 2
    3 INSERT INTO family_rdf_data VALUES (1,
    4 SDO_RDF_TRIPLE_S ('family',
    5 "http://www.example.org/family/John."
    6 "http://www.example.org/family/fatherOf."
    7 'http://www.example.org/family/Suzie'));
    8 END;
    9.

    Created procedure.

    SQL >
    SQL > GRANT EXECUTE ON NEW_TRIPLE to USEWAT;

    Grant succeeded.

    SQL >
    SQL > connect ADMWAT/xxxxx@DB_11201.world
    Connected.
    SQL > exec ADMWAT. NEW_TRIPLE();

    PL/SQL procedure successfully completed.

    SQL > rollback;

    Complete restoration.

    SQL >
    SQL > connect USEWAT/xxxxx@DB_11201.world
    Connected.
    SQL > exec ADMWAT. NEW_TRIPLE();

    PL/SQL procedure successfully complete.

    SQL >
    SQL >
    SQL >

    ************************************************************************************************************
    ************************************************************************************************************
    ************************************************************************************************************

    SQL > connect SYS/xxxxx@DB_*11203*.world as sysdba
    Connected.
    SQL > select value of MDSYS. RDF_PARAMETER where namespace = "MDSYS" and the attribute = "SEM_VERSION";

    VALUE
    --------------------------------------------------------------------------------
    * 11203 *.

    SQL >
    SQL > connect ADMWAT/xxxxx@DB_11203.world
    Connected.
    SQL >
    SQL > CREATE TABLE family_rdf_data (id NUMBER, triple SDO_RDF_TRIPLE_S);

    Table created.

    SQL >
    SQL > exec SEM_APIS.create_rdf_model ('family', 'family_rdf_data', 'three');

    PL/SQL procedure successfully completed.

    SQL >
    SQL > GRANT INSERT ON family_rdf_data in MDSYS.

    Grant succeeded.

    SQL >
    SQL > create or replace PROCEDURE NEW_TRIPLE IS
    BEGIN 2
    3 INSERT INTO family_rdf_data VALUES (1,
    4 SDO_RDF_TRIPLE_S ('family',
    5 "http://www.example.org/family/John."
    6 "http://www.example.org/family/fatherOf."
    7 'http://www.example.org/family/Suzie'));
    8 END;
    9.

    Created procedure.

    SQL >
    SQL > GRANT EXECUTE ON NEW_TRIPLE to USEWAT;
    Grant succeeded.

    SQL >
    SQL > connect ADMWAT/xxxxx@DB_11203.world
    Connected.
    SQL > exec ADMWAT. NEW_TRIPLE();

    PL/SQL procedure successfully completed.

    SQL > rollback;

    Complete restoration.

    SQL >
    SQL > connect USEWAT/xxxxx@DB_11203.world
    Connected.
    SQL > exec ADMWAT. NEW_TRIPLE();
    BEGIN ADMWAT. NEW_TRIPLE(); END;

    *
    ERROR on line 1:
    ORA-55303: SDO_RDF_TRIPLE_S constructor failed:

    SQLERRM = ORA-13199: insufficient privilege for the application of the model family table [
    ORA-06512: at the 'MDSYS. MD", line 1723
    ORA-06512: at the 'MDSYS. MDERR", line 17
    ORA-06512: at the 'MDSYS. SDO_RDF_TRIPLE_S', line 41
    ]
    ORA-06512: at the 'MDSYS. MD", line 1723
    ORA-06512: at the 'MDSYS. MDERR", line 17
    ORA-06512: at the 'MDSYS. SDO_RDF_TRIPLE_S', line 68
    ORA-06512: at "ADMWAT. NEW_TRIPLE', line 3
    ORA-06512: at line 1


    SQL >

    Published by: damien.claveau on March 26, 2012 02:02

    Damien,

    Please submit a Service request for this issue in Support of Oracle.

    Meanwhile, until a patch will be available, another possible solution, you could consider to use is to grant the DBA role to ADMWAT.

    If you want, please contact me directly by email: souripriya das at oracle dot com dot

    Thank you
    -Smiled.

  • Reading data from a Table by using the loop

    I have a dynamic array within the PDF form. I want to loop through the rows in the table and read the contents of the cell. I successfully get the number of rows in the table. But impossible to read the values in the cells. I put control TextField (txtName) editable in every cell and trying to read its value.

    screenshot is below.

    table_loop_error.jpg

    I use the code is:

     form1.Page1.Subform1.btnReadTable::click - (JavaScript, client)
    
    var rowCount = MyTable._Row1.count;
    app.alert("Row Count: " + rowCount);
    var i = 0;
    
    for(i=0 ; i<rowCount ; i++)
    {
        //app.alert(MyTable.Row1[i].txtName.rawValue); // NOT WORKING
        
        app.alert(MyTable.Row1.txtName.rawValue); // WORKING, But just giving the value for the first row.
    }
    

    Please tell me how can I get the value of each name in all ranks by making a loop.

    Thanks in advance.

    -

    Afonso

    Hi, Afonso,

    You must resolve the node for the particular case of i. The syntax is:

    xfa.resolveNode("MyTable.Row1[" + i  + "].txtName").rawValue;
    

    Here there is an example that will show you the loop in action:

    http://www.assuredynamics.com/index.php/category/portfolio/two-way-binding-in-tables/

    Hope that helps,

    Niall

    Ensure the dynamics

  • AS2.0 using the loop

    It's been a while for me, I use to know AS2.0 very well, but far from him, I've traveled (mostly do PHP, Java, c#, VB now), but I'm back in the flash thing and I need help to dynamically create a variable name to work with. I remember I use to know how to do it, but alas, my knowledge is gone.

    Question: I have a few video clips with some unique identifies within each of them, that I need to access it in a loop for example.:

    myMovieClip01_mc
    myMovieClip02_mc
    myMovieClip03_mc
    ... etc.

    So basically I write a loop for which will allow me to access each in the loop for I thought to rewrite the program with a table, but it's a lot of code.

    Thus, each loop I need to create something like this:

    "myMovieClip" + (i + 1) + "_mc".

    Please to jog my memory on this subject. Thank you very much.

    of course - you must use the operator to access here, as in:

    This ["myMovieClip" + (i + 1) + "_mc"].

Maybe you are looking for

  • Embeded video

    Hello.Embeded video starts auto when I start a new facet.How kan I stop this, its crasy.I have Samsung Edge.I'm sorry for my bad English. Regards Janne

  • How can I set bookmarks in files

    nothing more to say - is not a complex problem

  • Toshiba SpursEngine U.S. campaign

    If you agree with my statement on Facebook then explain why and say Toshiba to release where you live.

  • processors is supported by Windows xp 32-bit intel core i3

    I'm building a new pc on a tight budget.  I would like to build a machine with an Intel i3 processor and install Windows XP 32 bit, my current operating system.  Windows XP 32-bit and Intel i3 support each other?

  • HP Pavilion 15-p064no: opening HP 15-p064no rear panel

    I was trying to dust off the inside of my laptop 15-p064no due to some problems of overheating, however, after unscrewing the screws on the back panel, it seems the rear panel does not come off (tried a sharp knife between the seam and all). Is it st