Array of objects type

Hi all

I have a problem with my pl/sql code. I would refer to an array of types of objects as reference, not a copy.

I send you my sample code.

As you can see, mytype is the object, I use a "table with" to create a table. The function 'myfunc' illustrates the problem: I create an instance of the object named "mis1", I put one of its variable (date) and I create the table arrmytype and copy the mis1 as arrmytype (1)

Now the question: if I change mis1 arrmytype (1) does not alter it. I think that arrmytype (1) is a copy of mis1 and not a reference.

Am I wrong? How can I refer mis1 in a referenced table? Can I change the ' table a ' in something else...

create or replace type mytype as object

(

LDate date,

constructor function mytype self return as a result.

Members procedure setDate (date of update)

);

/

create or replace type body as mytype

constructor function mytype

return self as result that

Start

null;

end;

Members procedure setdate (date of update) as

Start

LDate: = pdate;

end setdate;

end;

/

create or replace type arrmytype in the table of mytype;

/

create or replace FUNCTION myfunc RETURN varchar2

AS

arrObj arrmytype: = arrmytype();

MIS1 mytype;

date of l_tmp1;

VARCHAR2 (100) retval;

BEGIN

MIS1: = new mytype();

MIS1. SetDate (sysdate);

l_tmp1: = mis1.ldate;

arrObj.EXTEND;

arrObj (arrObj.COUNT): = mis1.

MIS1. SetDate (sysdate);

l_tmp1: = arrObj (arrObj.COUNT) .ldate;

l_tmp1: = mis1.ldate;

RETURN retval;

MyFunc END;

/

Federico wrote:

I would like to refer as:

v_var1: = 9;

v_var2: = &v_var1; -as a code c ++

The PL/SQL language does not support pointers as a data type. Well, not exactly true because it supports locators that are pointers. But locators are limited to the type of LOB data.

So unfortunately you can't assign a reference to a variable/object in an array to a variable of pointer for quick reference. It's too bad that there is no pointer in PL/SQL data type as it is in C/C++ and Pascal.

But then on the other hand, just look at how programmers say substance completely upward using PL/SQL without pointers, to realize that PL/SQL programming to quality would have been much worse if the language supported for pointers. Not that this is a valid reason for PL/SQL not support pointers.

At least he could support the Pascal WITH clause which allows to define the scope and then resolve the name references in this scope...

Tags: Database

Similar Questions

  • The procedure with parameter output from test object type

    I have the sub object created with spec and body type.

    I need to test the procedure seen ino parameter object type.

    could you please help me test the procedure!

    create or replace type typ_obj_test as object
    (
       a_date   date,
       a_type   varchar2(10),
       a_status varchar2(2),
       descr    varchar2(10),
       a_id     number(10),
       constructor function typ_obj_test(a_date   date
                                        ,a_type   varchar2 default null
                                        ,a_status varchar2 default null
                                        ,descr    varchar2 default null
                                        ,a_id     number default null) return self as result
    );
    /
    create or replace type body typ_obj_test is
       constructor function typ_obj_test(a_date   date
                                        ,a_type   varchar2 default null
                                        ,a_status varchar2 default null
                                        ,descr    varchar2 default null
                                        ,a_id     number default null) return self as result is
          v_test varchar2(1);
          v_id   number(10);
       begin
          self.a_date   := a_date;
          self.a_type   := a_type;
          self.a_status := a_status;
          self.descr    := descr;
          self.a_id     := a_id;
          return;
       end;
    end;
    /
    create or replace procedure p_obj_test(p_obj_param in out typ_obj_test) is
    begin
       dbms_output.put_line('Checking the object type' || p_obj_param.a_date || '@' || p_obj_param.a_type || '@' || p_obj_param.a_status || '@' ||
                            p_obj_param.descr || '@' || p_obj_param.a_id);
    end;
    /
    

    You seem to be missing a table that could hold the object. See the next topic, especially the line # 43:

    Connected to:
    Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
    
    SQL> create or replace type typ_obj_test as object
      2  (
      3    a_date  date,
      4    a_type  varchar2(10),
      5    a_status varchar2(2),
      6    descr    varchar2(10),
      7    a_id    number(10),
      8    constructor function typ_obj_test(a_date  date
      9                                      ,a_type  varchar2 default null
    10                                      ,a_status varchar2 default null
    11                                      ,descr    varchar2 default null
    12                                      ,a_id    number default null) return self as result
    13  );
    14  /
    
    Type created.
    
    SQL> create or replace type body typ_obj_test is
      2    constructor function typ_obj_test(a_date  date
      3                                      ,a_type  varchar2 default null
      4                                      ,a_status varchar2 default null
      5                                      ,descr    varchar2 default null
      6                                      ,a_id    number default null) return self as result is
      7        v_test varchar2(1);
      8        v_id  number(10);
      9    begin
    10        self.a_date  := a_date;
    11        self.a_type  := a_type;
    12        self.a_status := a_status;
    13        self.descr    := descr;
    14        self.a_id    := a_id;
    15        return;
    16    end;
    17  end;
    18  /
    
    Type body created.
    
    -- Create a Nested table type array of above object type
    SQL> create or replace type nt_typ_obj_test as table of typ_obj_test;
      2  /
    
    Type created.
    
    -- Keep in out parameter's type as the nested table type
    -- modified the proc to do loop so that multiple records can be passed via object type
    SQL> create or replace procedure p_obj_test(p_obj_param in out nt_typ_obj_test) is
      2  begin
      3  for i in p_obj_param.first..p_obj_param.last
      4  loop
      5    dbms_output.put_line('Checking the object type' || p_obj_param(i).a_date || '@' || p_obj_param(i).a_type || '@' || p_obj_param(i).a_status || '@' ||
      6                          p_obj_param(i).descr || '@' || p_obj_param(i).a_id);
      7  end loop;
      8  end;
      9  /
    
    Procedure created.
    
    --Call the procedure
    SQL> set serveroutput on
    SQL> declare
      2  i_nt_typ nt_typ_obj_test ;
      3  begin
      4  i_nt_typ:=nt_typ_obj_test(typ_obj_test(sysdate,'A','Y','Descr',23),typ_obj_test(sysdate,'X','Z','ewe',55));
      5  p_obj_test(i_nt_typ);
      6  end;
      7  /
    Checking the object type26-MAR-15@A@Y@Descr@23
    Checking the object type26-MAR-15@X@Z@ewe@55
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
  • An array of objects with a filling loop. Noob PHP question.

    Hey guys,.

    You are all such a great help! Here's another one for you, the simple code below should create an array of objects of pizza (and it does) then display each item in the order. However... each object in the table seems to inherit the properties of everything what was the last item entered for a reason any.

    Copy the following code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <?php
    class pizza{
              public $price;
              public $description;
              public $name;
    }
    
    
    
    
    $menu2=fopen("pizzaMenu2.txt","r") or exit("System Error!");
    $pizzas = array();
    $arraypos=0;
    
    //This loop does all of the READING and populating of variables
    while(!feof($menu2))
      {
                //First get the array position
                                  $arraypos = (int)fgets($menu2);
    
              //Then Put in Title in title2 array
                                  $pizzas[$arraypos2] = new pizza(0,0,0);
                                  $pizzas[$arraypos2]->title = fgets($menu2);
                                  $pizzas[$arraypos2]->description = fgets($menu2);
                                  $pizzas[$arraypos2]->price = fgets($menu2);
      } //End of reading loop
    
    
    //begin writing data
    $arraypos=1;
    while ($arraypos <=3){
              echo "the array is in position: ".$arraypos;
              echo "<br />";
              echo $pizzas[$arraypos2]->title;
              echo "<br />";
              echo $pizzas[$arraypos2]->description;
              echo "<br />";
              echo $pizzas[$arraypos2]->price;
              echo "<br />";
              $arraypos++;
    }//end of writing data loop
    
    fclose($menu2);
    ?>
    <body>
    </body>
    </html>
    
    

    This returns:

    the array is in position: 1
    Test Pizza Two 
    The same as one with an extra one, yum! 
    22.99
    the array is in position: 2
    Test Pizza Two 
    The same as one with an extra one, yum! 
    22.99
    the array is in position: 3
    Test Pizza Two 
    The same as one with an extra one, yum! 
    22.99
    

    When it should return this:

    the array is in position: 1
    Test pizza One 
    Loaded with all that test pizza goodness! Lots and lots of ones 1111! 
    11.99 
    the array is in position: 2
    Test Pizza Two 
    The same as one with an extra one, yum! 
    22.99
    the array is in position: 3
    Test Threeza! 
    Do you see what I did there? I added a three to pizza, hahaha, I am so punny. 
    33.33 
    

    using the following text file pizzaMenu2.txt:

    1
    Test pizza One
    Loaded with all that test pizza goodness! Lots and lots of ones 1111!
    11.99
    3
    Test Threeza!
    Do you see what I did there? I added a three to pizza, hahaha, I am so punny.
    33.33
    2
    Test Pizza Two
    The same as one with an extra one, yum!
    22.99
    
    

    Now, I did line-by-line analysis and showed that the values are entered in the objects in the appropriate table, but everything that happens ultimately crushes all other objects, so ultimately, I have 3 objects in my table which are all the same. I don't know what I'm missing here.

    $pizzas [$arraypos2]

    must be:

    $pizzas [$arraypos]

  • Power supply an array of objects returned by a remote object using AMFPHP remote procedure calls.

    Hi guys,.

    I'm working on an AIR Application that uses Flex Remoting AMFPHP, the data type returned is an array of objects that contains a shot of a url to an image on the server, how to link it to a tilelist component, so I have a list with images representing the icons and the string representing the Tilelist labels?

    We assume that the object has these fields:

    -label
    -image

    Thus, you can first pass the array to the dataProvider of the TileList and make an ItemRenderer (with a label and an image). Then, in the ItemRenderer, go to the fields with the data objects:

    ItemRenderer.mxml

  • FGV VI within the class method called the array of objects in a for loop

    I have an array of objects connected to the loop for I call the VI method on the object in the loop for. If the method uses/calls some VI with state/memory (such as FGV) State is shared for each method call in a loop despite the called VI is reentrant preallocated. Someone knows how to fix this?

    NVM. I found an answer:

    https://lavag.org/topic/19014-dynamic-dispatch-shared-reentrancy/

  • Casting of object type to aid to more specific

    Hello

    I'm bit stuck in the legacies of the class in my current project. I implement a zero-coupling messaging architecture that uses variant tables to store objects to be cast to sample.

    The good news: it works in general, little we take a peek at some photos

    I tried the script of coulee before using an example that works as expected.

    Shows probe resulting:

    The Message of abstract [14] is cast to the more specific Message for the controller test [15], [9]

    Now, this implementation with the variants table, change things unfrotunately:

    The only thing that apparently changes is, as the class to be cast to a return value of a Subvi (actually reading the table variant) [12].

    As shown in the probe that the casting does not work this time... There is also no error on the terminal error.

    I have to admit, I'm quite confused... especially because in another class this exact methodiolgy works...

    Any thoughts?

    See you soon

    Oli

    Cast throws more specific to the type of object shown on the thread in the IDE, regardless of the type of the actual object passing along this thread (i.e. type of YARN and not DATA type).

    I bet that your wire to the Center terminal of the 'to more specific' is a son of the same type as the object you are trying to change but actually a more specific object.  The 'Cast to more specific"is a compiling decision, not a decision of execution. As such it takes the type of thread, not the object type for the casting.

    Look at the names on the left of your probes, they are all the same in the example below (all wires are nominally of the same type).  It's the onfo LV casting (assuming the names corresponding to the nominal type of the thread) not use content REAL of the wire.

    Shane.

    PS to make things clearer, give each hierarchy in your legacy a different aspect of wire.

  • What is the best way to save an array of objects and then load it?

    Hi, what is the best way to save and load an array of objects?

    I hade a code like that, but it does not work:

    var test = new Array();
    test.push(new Foo("a"));
    for (var i = 0; i < test.length; i++) {
        console.log(test[i]);
    }
    // save and load, then show again
    localStorage.setItem("test", test);
    var test2 = localStorage("test");
    for (var i = 0; i < test2.length; i++) {
        console.log(test2[i]);
    }
    

    the problem is, the first newspaper that get the things I want. The second time I get:

    Uncaught TypeError: Property 'localStorage' of object [object Object] is not a function
    

    The work around this problem is to stringify before saving and then analyze before loading.

    http://StackOverflow.com/a/2010948/773263

    Although I said, it is better to use IndexDB.

  • Filter for a specific value object type

    I would like to know if the documents loaded on an object type can be interrogated for a specific value. For ex, I wanted to fetch all the records of the emp and load it into an object. I wanted to ask the object out of the loop to query for a specific deptno. I understand a query simpe SQL would be much faster in the scenario below, but the report itself used in our system uses several tables and some of them have millions of records from different sources as accounts suppliers, accounts receivable, accounting, etc. and they are treated differently for each source before that the result will be published the report. I took the table emp for example and wanted to know if the type of object can be queried for a specific column outside the loop.

    DECLARE

    CURSOR cur_emp IS SELECT * FROM EMP;

    TYPE emp_obj IS TABLE OF cur_emp % ROWTYPE INDEX BY PLS_INTEGER;

    l_emp_tab emp_obj;

    BEGIN

    OPEN cur_emp.

    LOOP

    Get the cur_emp COLLECT LOOSE l_emp_tab LIMIT 1000;

    EXIT WHEN l_emp_tab.count = 0;

    BECAUSE me IN 1.l_emp_tab.count

    Loop

    dbms_output.put_line (' Ename:' | l_emp_tab (i) .ename |', Deptno:' | .deptno l_emp_tab (i));

    END LOOP;

    END LOOP;

    -Can I ask specific employee to a deptno outside the loop FOR without using a temporary table

    -something like "SELECT * FROM TABLE (type_name) WHERE DEPTNO = x_Deptno.

    END;

    /

    In a collection of table selection is not effective, there are better ways to do it.

    Why not create a view?

    create view...

    Select * from source1 Union all the

    Select * from source2 Union all the

    Select * from source3

    -or-

    Using ref cursor return... clause, so you can make conditional cursors

    If somecondition then

    Open the NEWS for

    Select * source1;

    on the other

    Open the NEWS for

    Select * from source2.

    end if;

    -or-

    Dynamics based SQL ref cursor

    DECLARE

    TYPE EmpCurTyp IS REF CURSOR;

    v_emp_cursor EmpCurTyp;

    employees emp_record % ROWTYPE;

    v_stmt_str VARCHAR2 (200);

    v_e_job employees.job%TYPE;

    BEGIN

    -Dynamic SQL statement with placeholder:

    v_stmt_str: = ' SELECT * FROM employees WHERE job_id =: I;

    -Open the cursor & specify bind argument in the USING clause:

    V_emp_cursor OPEN FOR v_stmt_str with the HELP of 'MANAGER ';

    -Extraction of the lines of result set one at a time:

    LOOP

    SEEK v_emp_cursor INTO emp_record;

    EXIT WHEN v_emp_cursor % NOTFOUND;

    END LOOP;

    -Close the cursor:

    CLOSE V_emp_cursor;

    END;

    /

    -or-


    Load in an intermediate table (as a temporary table)

  • How to pass the number object type to bind the variable in a select statement

    Hello

    I have a scenario like,

    UI, we store the values in the type of object, and this object type must be spent in a select query to retrieve the data accordingly.

    Is it possible to do so.

    If this isn't the case, please let me know how to take the values of object type and pass to the select query.

    Kind regards

    I found it,

    Object_name ('parameters1', 'parameter2');

  • Define a map or ORDER method for the object type

    Hi gurus

    I created an object and then its type and then I use this object and type based on line, see below:

    Create the object

    CREATE OR REPLACE

    TYPE test_object

    IS

    OBJECT

    (

    next_appearance_dt DATE, - next_appearance_dt

    youth_adult VARCHAR2 (5) - youth_adult

    ) ;


    /

    Create the object Type

    CREATE or REPLACE TYPE t_docket_object IS TABLE OF THE test_object;

    /

    Create function Pipeline

    FUNCTION to CREATE or REPLACE f_report (p_dt date, p_c_cd VARCHAR2)
    return t_test_object pipeline
    IS
    BEGIN
    FOR J IN)
    Select distinct test_object)
    next_appearance_dt,--862,
    'YOUTH '.
    ) AS test_object
    Jen.next_appearance base
    WHERE 1 = 1
    AND (base.next_appearance_dt = p_dt)
    AND (base.circuit_point_cd = p_c_cd)
    - and cse.information_id = 322
    -ORDER 15 - alias_name
    )

    loop
    PIPE ROW (J.test_object);
    END loop;
    END;

    /

    Run function

    SELECT * FROM TABLE (F_REPORT (TO_DATE('25-sep-2015','dd-mon-yyyy'),'1 '))

    Error

    ORA-22950: cannot ORDER objects without map or ORDER method

    ORA-06512: at "F_REPORT", line 5

    22950 00000 - "cannot ORDER objects without map or ORDER method.

    * Cause: an object type must have a defined for map or ORDER method

    all comparisons other than equality and inequality comparisons.

    * Action: Define a map or ORDER method for the object type

    I know the reason of this error and the reason is that I use the clause separate in my pipeline service, but do not know how to get rid of this error...

    Confuse you the type of table with the object type. He forge

    Select test_object (next_appearance_dt) test_object

    Not:

    Select t_test_object (next_appearance_dt) test_object

    Then:

    SQL > CREATE OR REPLACE
    FUNCTION f_report (DATE p_dt 2,
    3 P_C_CD VARCHAR2
    4                   )
    5 t_test_object of RETURN
    6 IN PIPELINE
    7 EAST
    BEGIN 8
    9 FOR (IN) v_rec
    10 WITH () DID
    11. SELECT TO_DATE('01-jan-2015','dd-mon-yyyy') NEXT_APPEARANCE_DT
    the double 12
    13                                  )
    14 select test_object (next_appearance_dt) test_object
    15                          from  t
    16                      ) LOOP
    PIPE 17 ROW (v_rec.test_object);
    18 END OF LOOP;
    END 19;
    20.

    The function is created.

    SY.

  • How to fill the value in the nested table by using the object type


    Hi gurus

    I created an object type and able to fill the values in it, now I want to create a nested table type of this object and fill it but looks like I'm doing something wrong, see my code below.

    Code example

    CREATE or REPLACE TYPE countries_o
    AS
    OBJECT
    (
    COUNTRY_ID TANK (2 BYTES),
    COUNTRY_NAME VARCHAR2 (40 BYTE),
    REGION_ID NUMBER);
    /

    create or replace type countries_t is table of the countries_o;

    /

    CREATE OR REPLACE

    ABC of the PROCEDURE

    IS

    v_print countries_t; -: = arr_countries_t('01','Aus',1);

    BEGIN

    v_print: = countries_t('01','A',11);

    DBMS_OUTPUT. Put_line (v_print. COUNTRY_ID | v_print. COUNTRY_NAME | v_print. REGION_ID);

    END;

    /

    Error

    • Error (6.3): PL/SQL: statement ignored
    • Error (6,12): PLS-00306: wrong number or types of arguments in the call to 'COUNTRIES_T '.
    • Error (7.3): PL/SQL: statement ignored
    • Error (7.32): PLS-00302: component 'COUNTRY_ID' must be declared

    Thanks in advance

    Concerning

    Muzz

    Hi user,

    Here is another method that you can try-

    CREATE OR REPLACE

    ABC of the PROCEDURE

    IS

    v_print countries_t: = countries_t (countries_o('01','A',11));

    BEGIN

    DBMS_OUTPUT. Put_line (v_print (1).) COUNTRY_ID | v_print (1). COUNTRY_NAME | v_print (1). REGION_ID); -you're accessinf the first element of the nested table, which in turn points to the object.

    END;

    In the sections of the declaration you have assigned values to the nested table.

    Kind regards
    Maxou

  • How to return data using the object type?

    Hello all - I have an obligation to return the values object type.

    In the same way as

    list - Plan1, Subplan1, Fund1, 2 Fund Fund 3

    list - Plan2, Subplan2, Fund2

    list - plane3, Subplan3, not funds


    To achieve this I wrote below proc but its giving as response below which is does not correspond with my requirement. Someone has an idea how to write code to get the list of funds against each plan in each line?



    Output:

    PDB01. () T_T_CONTRACT

    PDB01. T_O_CONTRACT ('p1', 's1', PDB01. T_O_FUND ('p1', 's1', 'f1')),

    PDB01. T_O_CONTRACT ('p1', 's1', PDB01. T_O_FUND ('p1', 's1', 'f2')),

    PDB01. T_O_CONTRACT ('p1', 's1', PDB01. T_O_FUND ('p1', 's1', 'f3')),

    PDB01. T_O_CONTRACT ('p2', 's2', PDB01. T_O_FUND ('p2', 's2', 'f2')),

    PDB01. T_O_CONTRACT ('p3', 's3', PDB01. T_O_FUND (NULL, NULL, NULL))

    )




    DROP TYPE T_T_fund;

    create or replace

    TYPE T_O_fund

    AS OBJECT)

    argument plan_id Varchar2 (128).

    subplan_id Varchar2 (128).

    fund_id Varchar2 (128)

    )

    No final;

    /

    create or replace

    type T_T_FUND

    as the table of T_O_FUND;

    /

    type of projection T_T_CONTRACT;

    create or replace

    TYPE T_O_contract

    AS OBJECT)

    argument plan_id Varchar2 (128).

    SUBPLAN_ID varchar2 (128).

    ov_fund T_o_fund

    )

    no final;

    /

    create or replace

    type T_t_contract as the T_O_contract table;

    /

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

    / * Remove T_T_FUND;

    DROP TYPE T_O_fund;

    type of projection T_T_CONTRACT;

    DROP TYPE T_O_contract; * /

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

    create or replace

    procedure test_cursor (o_c1 OUT sys_refcursor) is

    V_T_T_FUND T_T_FUND;

    v_T_t_contract T_t_contract;

    Start

    WITH (CONTRACTS AS

    SELECT "p1" PLAN_ID, "s1" SUBPLAN_ID FROM DUAL UNION ALL

    SELECT "p2" PLAN_ID, 's2' SUBPLAN_ID FROM DUAL UNION ALL

    SELECT "p3" PLAN_ID, 's3' SUBPLAN_ID FROM DUAL

    ),

    Fund)

    Select "p1" PLAN_ID, SUBPLAN_ID 's1', 'f1' FUND_ID of all the DOUBLE union

    Select "p1" PLAN_ID, SUBPLAN_ID 's1', 'f2' FUND_ID of all the DOUBLE union

    Select plan_id "p1", "s1" subplan_id argument, "f3" fund_id Union double all the

    Select the argument plan_id 'p2', 's2' subplan_id, 'f2' double fund_id

    )

    Select T_O_contract (c.PLAN_ID, c.SUBPLAN_ID, T_o_FUND (f.PLAN_ID, f.SUBPLAN_ID, f.FUND_ID))

    TO COLLECT FEES IN BULK

    in v_T_t_contract

    c CONTRACTS, FUND F

    where C.PLAN_ID = F.PLAN_ID

    and c.SUBPLAN_ID = f.SUBPLAN_ID (+);

    Open the O_C1 for

    SELECT 't' TYP, v_T_t_contract contract_LST

    FROM DUAL;

    end;

    /

    impression o_test

    You can declare the attribute OV_FUND as T_T_FUND data type:

    create or replace type t_o_contract as object (
      plan_id     varchar2(128)
    , subplan_id  varchar2(128)
    , ov_fund     t_t_fund
    );
    /
    

    You will be able to do this:

    with contracts as (
      select 'p1' plan_id, 's1' subplan_id from dual union all
      select 'p2' plan_id, 's2' subplan_id from dual union all
      select 'p3' plan_id, 's3' subplan_id from dual
    ),
    funds as (
      select 'p1' plan_id , 's1' subplan_id, 'f1' fund_id from dual union all
      select 'p1' plan_id , 's1' subplan_id, 'f2' fund_id from dual union all
      select 'p1' plan_id , 's1' subplan_id, 'f3' fund_id from dual union all
      select 'p2' plan_id , 's2' subplan_id, 'f2' fund_id from dual
    )
    select t_o_contract(
             c.plan_id
           , c.subplan_id
           , cast(
               multiset(
                 select t_o_fund(f.plan_id, f.subplan_id, f.fund_id)
                 from funds f
                 where f.plan_id = c.plan_id
                 and f.subplan_id = c.subplan_id
               )
               as t_t_fund
             )
           )
    from contracts c ;
    
  • How to upgrade an array of objects?

    Dear friends,

    I have a number of objects stored in a table.
    It seems that the table does not point to objects, but has copies.
    The element of the array is only updated with the notation table [index] prop, not with the object.prop notation.

    It would be possible to always use the prop table [index] notation for an update of the issues, but I want to understand why the other method does not work. And of course, there should be no copy...

    var objArray = [oObject0, oObject1, oObject2];    
    
    function oObjTpl (name, scheme, start, incr, current, decimals, items) { // 'prototype' definition
      this.Name =       name;
      this.Scheme =     scheme;                       // numermic | roman | ROMAN | text
      this.Start =      start;                        // start value
      this.Incr =       incr;                         // increment, may be a formula string
      this.Current =    current;                      // Last inserted value or item
      this.Decimals =   decimals;                     // relevant only for numeric scheme
      this.Items =      items;                        // array of list items, relevant only for text scheme
    }
    
    var items0 = ["one","two", "three", "four", "five", "six", "zz", "seven", "eight", "nine", "ten"]; 
    var oObject0 = new oObjTpl ('CountingEN', 'text',     1,  1, undefined, undefined, items0);
    var oObject1 = new oObjTpl ('oObject1',  'numeric', 17, -1, undefined,         0, undefined);
    var oObject2 = new oObjTpl ('oObject2',  'roman',    1,  1, undefined,         0, undefined);
    
    // replace the zz by soemething else
    oObject0.Items[6] = "AAAA";       // this does not update objArray
    $.writeln (objArray[0].Items);
    
    objArray[0].Items[6] = "BBBB";    // this updates objArray
    $.writeln (objArray[0].Items);
    
    oObject0.Items[6] = "CCCC";       // update of objArray effective in next run
    $.writeln (objArray[0].Items);
    

    When you run the script 3 times, I get this console output:

    one,two,three,four,five,six,zz,seven,eight,nine,ten
    one,two,three,four,five,six,BBBB,seven,eight,nine,ten
    one,two,three,four,five,six,BBBB,seven,eight,nine,ten
    Result: undefined
    one,two,three,four,five,six,CCCC,seven,eight,nine,ten
    one,two,three,four,five,six,BBBB,seven,eight,nine,ten
    one,two,three,four,five,six,BBBB,seven,eight,nine,ten
    Result: undefined
    one,two,three,four,five,six,CCCC,seven,eight,nine,ten
    one,two,three,four,five,six,BBBB,seven,eight,nine,ten
    one,two,three,four,five,six,BBBB,seven,eight,nine,ten
    Result: undefined
    

    Thank you Apollo, but this has not been around.

    But I found that the order of definitions is crucial here. The following works as it should:

    function oSeries (name, scheme, start, incr, current, decimals, items) { // 'prototype' definition
      this.Name =       name;
      this.Scheme =     scheme;                       // numermic | roman | ROMAN | text
      this.Start =      start;                        // start value
      this.Incr =       incr;                         // increment, may be a formula string
      this.Current =    current;                      // Last inserted value or item
      this.Decimals =   decimals;                     // relevant only for numeric scheme
      this.Items =      items;                        // array of list items, relevant only for text scheme
    //return this;      // ahs no effect
    }
    
    var items0 = ["one","two", "three", "four", "five", "six", "zz", "seven", "eight", "nine", "ten"];
    var oSeries_0 = new oSeries ('CountingEN', 'text',     1,  1, undefined, undefined, items0);
    var oSeries_1 = new oSeries ('oSeries_1',  'numeric', 17, -1, undefined,         0, undefined);
    var oSeries_2 = new oSeries ('oSeries_2',  'roman',    1,  1, undefined,         0, undefined);
    
    var aSeries = [oSeries_0, oSeries_1, oSeries_2];    
    
    var a1 = aSeries[2].Scheme;      // roman
    $.writeln (a1);
    
    // replace the zz by octogon
    oSeries_0.Items[6] = "AAAA";   // this does not update aSeries
    $.writeln (aSeries[0].Items);
    
    aSeries[0].Items[6] = "BBBB";  // this updates aSeries
    $.writeln (aSeries[0].Items);
    
    oSeries_0.Items[6] = "CCCC";   // update of aSeries effective in next run
    $.writeln (aSeries[0].Items);
    /*
    one,two,three,four,five,six,AAAA,seven,eight,nine,ten
    one,two,three,four,five,six,BBBB,seven,eight,nine,ten
    one,two,three,four,five,six,CCCC,seven,eight,nine,ten
    */
    

    The order is now: implement the objects and then set up the array of objects.

  • Arrays are objects — really?

    Dear experts and gurus,

    More I read the more I am confused. Every now and then the talk is "JS arrays are objects and where they are passed by reference. However, simple experiences leave my perplexed: it is the same as for light (depending on the view, it behaves as waves or particles):

    gaSomething = ["a","b", "c"];
    Update (gaSomething);
    alert (gaSomething.join("\n"));         // the global array has changed
    
    DeleteItem (gaSomething, "7");
    alert (gaSomething.join("\n"));         // the global array has not changed
    
    function Update (array) {
      for (var j= 0; j < 9; j++) {
        array.push(j+1); 
      }
    }
    
    function DeleteItem (array, item) {
      var index = IsInArray (array, item);
      var lower = array.slice (0, index);   // lower part
      var upper = array.slice (index+1);    // upper part
      var locArray    = lower.concat(upper);
      array = locArray;                     // transfer data
    alert ("in DeleteItem:\n" + array.join("\n"));
    }
    


    The only safe assumption is that JS arrays are not treated like objects and are therefore passed by value. It is so difficult to implement functions to remove items from several bays: for each table a separate function is necessary!

    Any ideas for a general DeleteItem function?

    Hi Klaus,

    It's very dangerous!

    1 array.length = array.length - 1 means: remove the last item in an array

    Array.Length = array.length - 5 removes the last 5 items in a table

    Delete array [index] Deletes only the VALUE of the element.

    When you sort, it's the end of the array and so you have managed to delete.

    My code in my last post IS WRONG:

    It must be:

    1. for (var j = 9; > 5; j - j) {}
    2. Array.Slice (j, 1);
    3. }

    However, I want to remove an item in the table. Unfortunately, there is no function of welding in'RE...

    It's slice - do Splice not!

    Need to remove reverse items.

    Try this function. It removes 3 and 2 points

    function DeleteItem (array, index)
    {
     $.writeln(array);
     for (var j=3 ; j > 1; j --)
        {
        $.writeln("delete: " + array[j]);
        array.splice(j,1);
        $.writeln(array);
        }  
    
    }
    
  • Impdp ORA-39083 error: INDEX could not create with object type error:

    Hi Experts,

    I get the following error when importing schema HR after a fall it. The DB is r12.1.3 11.2.0.3 & ebs


    I did export with this command.

    patterns of HR/hr = hr = TEST_DIR dumpfile = HR.dmp logfile directory expdp = expdpHR.log statistics = none

    that the user HR with the option drop waterfall.


    And try to import it HR schemas in the database by the following.

    Impdp System/Manager schemas = hr = TEST_DIR dumpfile = HR.dmp logfile directory = expdpHR.log statistics = none

    Here is the error

    imported 'HR '. "" PQH_SS_PRINT_DATA "0 KB 0 rows

    ... imdoor 'HR '. "" PQH_TJR_SHADOW "0 KB 0 rows

    . . imported 'HR '. "" PQH_TXN_JOB_REQUIREMENTS "0 KB 0 rows

    . . imported 'HR '. "" PQH_WORKSHEET_BUDGET_SETS_EFC "0 KB 0 rows

    . . imported 'HR '. "" PQH_WORKSHEET_DETAILS_EFC "0 KB 0 rows

    . . imported 'HR '. "" PQH_WORKSHEET_PERIODS_EFC "0 KB 0 rows

    . . imported 'HR '. "" PQP_ALIEN_TRANSACTION_DATA "0 KB 0 rows

    . . imported 'HR '. "" PQP_ANALYZED_ALIEN_DATA "0 KB 0 rows

    . . imported 'HR '. "" PQP_ANALYZED_ALIEN_DETAILS "0 KB 0 rows

    . . imported 'HR '. "" PQP_EXCEPTION_REPORTS_EFC "0 KB 0 rows

    . . imported 'HR '. "" PQP_EXT_CROSS_PERSON_RECORDS "0 KB 0 rows

    . . imported 'HR '. "" PQP_FLXDU_FUNC_ATTRIBUTES "0 KB 0 rows

    . . imported 'HR '. "" PQP_FLXDU_XML_TAGS "0 KB 0 rows

    . . imported 'HR '. "" PQP_GAP_DURATION_SUMMARY "0 KB 0 rows

    . . imported 'HR '. "" PQP_PENSION_TYPES_F_EFC "0 KB 0 rows

    . . imported 'HR '. "" PQP_SERVICE_HISTORY_PERIODS "0 KB 0 rows

    . . imported 'HR '. "" PQP_VEHICLE_ALLOCATIONS_F_EFC "0 KB 0 rows

    . . imported 'HR '. "" PQP_VEHICLE_DETAILS_EFC "0 KB 0 rows

    . . imported 'HR '. "" PQP_VEHICLE_REPOSITORY_F_EFC "0 KB 0 rows

    . . imported 'HR '. "" PQP_VEH_ALLOC_EXTRA_INFO "0 KB 0 rows

    . . imported 'HR '. "" PQP_VEH_REPOS_EXTRA_INFO "0 KB 0 rows

    Processing object type SCHEMA_EXPORT/TABLE/SCHOLARSHIP/OWNER_GRANT/OBJECT_GRANT

    Processing object type SCHEMA_EXPORT/TABLE/SCHOLARSHIP/CROSS_SCHEMA/OBJECT_GRANT

    Object type SCHEMA_EXPORT/TABLE/COMMENT of treatment

    Object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC of treatment

    Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC

    Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX

    Processing object type SCHEMA_EXPORT/TABLE/INDEX/FUNCTIONAL_INDEX/INDEX

    Object type SCHEMA_EXPORT/TABLE/CONSTRAINT/treatment

    Object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS of treatment

    Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_INDEX/INDEX_STATISTICS

    Object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY of treatment

    Object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT of treatment

    Object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS treatment

    Processing object type SCHEMA_EXPORT/TABLE/INDEX/DOMAIN_INDEX/INDEX

    ORA-39083: Type what INDEX failed to create object error:

    ORA-29855: an error has occurred in the execution of routine ODCIINDEXCREATE

    ORA-20000: Oracle text error:

    DRG-50857: error oracle in drvxtab.create_index_tables

    ORA-00959: tablespace "APPS_TS_TX_IDX_NEW" does not exist

    Because sql is:

    CREATE INDEXES ' HR'.»» IRC_POSTING_CON_TL_CTX' ON 'HR '. "" INDEXTYPE IRC_POSTING_CONTENTS_TL "("NAME") IS"CTXSYS. "' CONTEXT ' PARALLEL 1

    Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA

    Work 'SYSTEM '. "" SYS_IMPORT_SCHEMA_01 "completed with error (s 1) at 11:16:07

    SQL > select count (parameter), object_type from dba_objects where owner = 'HR' group by object_type.

    OBJECT_TYPE COUNT (OBJECT_NAME)

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

    INDEX 37 PARTITION

    SEQUENCE OF 799

    TABLE 12 PARTITION

    LOB 70

    4 BODY PACKAGE

    PACKAGE OF 4

    3 RELAXATION

    2936 INDEX

    TABLE OF 1306

    Could you please suggest.

    Thank you

    MZ

    MZ,

    I get the following error when importing schema HR after a fall it. The DB is r12.1.3 11.2.0.3 & ebs


    Export and import of individual patterns of Oracle E-Business Suite stocked are not supported as this will violate referential integrity (except for custom schemas provided, you have no dependencies).

    Thank you

    Hussein

Maybe you are looking for