Assistance in creation of objects Table nested in a column

Hi all

In our project requirement, we are supposed to create a table1 consisting of such object1 of the column and Object1 has a nested object (object2) as one of the column.

We are able to create the table (table-name is op_sam) for object1

create or replace type testobj1 as an object (number of c1, c2 number);
create or replace type t_testobj in the testobj1 table;

create table op_sam (obj_id varchar2 (100), workobj t_testobj)
store workobj table nested as nested_tab back as a value;

We strive to store op_sam as an object in an another table prepop

We have created the object for the op_sam

create or replace type op_sam_obj as an object (obj_id varchar2 (100), workobj t_testobj);
create or replace type t_op_sam_obj in the op_sam_obj table;



We gave the following script to create the table with the column as t_op_sam_obj

create table prepop (ob_id varchar2 (20), t_op_sam_obj object2)
nested table object2 store like nested_tab1 back as a value;


ORA-22913: must specify the name of the table for the nested table column or attribute · nested tables ·

could you please suggest me to fix this?

Hello

Each object of type table needs a nested table.
Subject: object2 has a nested table object: workobj
Then, who also has a nested table clause.

CREATE
     TABLE prepop
     (
          ob_id VARCHAR2(20)
     , object2 t_op_sam_obj
     )
     nested TABLE object2 store AS nested_tab1
     (
          nested TABLE workobj store AS nested_tab2
     )
        return as value
;

This will create 3 tables:
nested_tab2 as an embedded table
nested_tab1 as an embedded table
prepop

Kind regards

Peter

Tags: Database

Similar Questions

  • Creation of object table references

    Hope that the title is clear enough, but what I want to do is create multiple tables to contain groups of clips (I use as buttons) that have similar functions, so that I can add event listeners using a loop statement, rather than a huge list to add and remove event listeners.

    I saw this method of work before, but I can't get my code works! It is probably a concept very noob, but I've been struggling with it for hours.

    OK, so in her extends video clip bit on my file I declare the array as such:

    public static var controlBtns:Array;

    Then in initialization function, I put the values in the table as such:

    controlBtns = new Array (submit_btn, zoomMinus, zoomPlus);

    In this same initialization function I yell to another custom function that adds to the elements of the array event listeners:

       for(var i = 0; i < controlBtns.length; i++)
       {
        trace(controlBtns[i].name);
        controlBtns[i].addEventListener(MouseEvent.ROLL_OVER, function(){controlBtns[i].nextFrame()});
        controlBtns[i].addEventListener(MouseEvent.ROLL_OUT, function(){controlBtns[i].prevFrame});
        controlBtns[i].mouseChildren = true;
        controlBtns[i].buttonMode = true;
       }
    


    The track seems out of all object names (as they appear in the library) and then I get this error:

    TypeError: Error #1010: a term is undefined and has no properties.

    That is kind of obvious that I can not access the movie clip instance names I put in place in the table.

    I have tried to put quotation marks around the names in the table, which makes them chains but then I can't access properties of strings - what is pretty obvious to.

    There is something really simple that I'm missing here?

    Thank you much in advance flash users...

    It would be much better way:

    // in the loop
    controlBtns[i].addEventListener(MouseEvent.ROLL_OVER, onRollOver);
    controlBtns[i].addEventListener(MouseEvent.ROLL_OUT, onRollOut);
    
    // later
    function onRollOver(e:MouseEvent):void {
         e.currentTarget.nextFrame();
    }
    
    function onRollOut(e:MouseEvent):void {
         e.currentTarget.prevFrame();
    }
    
  • Flashback work table with a deleted column

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    AMT for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production

    Hello

    I have the following problem.

    I accidentally dropped a column containing the data of a table and to restore the state table, it was before I did.

    I found a reference on the internet which States that you can use flashback to retrieve a table to a set in the past point, even if you deleted a column.
    Flashback Table
    
    Just as the flashback query helps to retrieve rows of a table, FLASHBACK TABLE helps to restore the state of a table to a certain point in time - even if a table structure change has occurred since then. The following simple command will take us to the table state at the specified timestamp:
    
    SQL> FLASHBACK TABLE Employee TO 
               TIMESTAMP ('13-SEP-06 8:50:58','DD-MON-YY HH24: MI: SS');
    
    Reference - http://www.orafaq.com/node/872
    My DBA has sent me the following information;
    Oracle Metalink note  
    
    Limitations and Restrictions on Flashback Table :
    
    Flashback Table operations are not valid for the following type objects: tables that are part of a cluster, materialized views, Advanced Queuing (AQ) tables, static data dictionary tables, system tables, remote tables, object tables, nested tables, or individual table partitions or subpartitions.
    
    The following DDL operations change the structure of a table, so that you cannot subsequently use the TO SCN or TO TIMESTAMP clause to flash the table back to a time preceding the operation: upgrading, moving, or truncating a table; adding a constraint to a table, adding a table to a cluster; modifying or dropping a column; adding, dropping, merging, splitting, coalescing, or truncating a partition or subpartition (with the exception of adding a range partition).
    
    You cannot rollback a FLASHBACK TABLE statement. However, you can issue another FLASHBACK TABLE statement and specify a time just prior to the current time. Therefore, it is advisable to record the current SCN before issuing a FLASHBACK TABLE clause.
    Then my return of flame using DBA in this situation or not?

    Ben

    >
    Is the ORAFAQ, a site with a good reputation for more information.
    >
    I found that it is quite reliable. But when ANY site talking about a newly introduced feature, it must trigger at least one indicator "attention". There may be so many variables affecting the functioning of a new feature or is used unless you see a working example, you must create your own test case.

    As I said some things, like your question above, can be easily verified, so there is no reason to rely on any document to see if it works.
    >
    Is anyway to cancel this kind of thing or it is unrecoverable?
    >
    Almost nothing is "sunk", if you have the right type of backup. For a deleted column, you have an export of the table before the fall.

    Recommended for small changes DDL (for example related to an incremental update) is to take an export of the affected table.

  • Nested in the object table

    Hi gurus,

    SQL > select * from v version $;

    BANNER

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

    Oracle Database 10g Release 10.2.0.4.0 - Production 64-bit

    PL/SQL Release 10.2.0.4.0 - Production

    CORE 10.2.0.4.0 Production

    AMT for Linux: release 10.2.0.4.0 - Production

    NLSRTL Version 10.2.0.4.0 - Production

    SQL >

    I want a table nested in the object. Here's my implementation

    CREATE or REPLACE TYPE test_language_obj AS OBJECT

    (returned VARCHAR2 (3),)

    Description varchar2 (50)

    )

    /

    CREATE or REPLACE TYPE test_language_tab AS TABLE OF THE test_language_obj;

    /

    CREATE or REPLACE TYPE test_Region_obj () AS OBJECT

    get rid of the VARCHAR2 (6).

    r_date DATE,

    lang_tab test_language_tab,

    CONSTRUCTOR FUNCTION test_Region_obj RETURNS RESULTS of AS SELF);

    /

    CREATE or REPLACE TYPE test_Region_tab AS TABLE OF THE test_Region_obj;

    /

    When I run the suite of applications, it works fine

    Select test_language_obj ('001', 'This is the English language code') of double

    But when I run the following question

    SELECT Test_Region_obj ('111 ', sysdate, (select test_language_obj ('001', 'This is the English language code') of double)) double

    It gives following error

    ORA-06553: PLS-306: wrong number or types of arguments in the call to 'TEST_REGION_OBJ '.

    My goal is to get all languages within the region.

    Anyone can point out what I'm missing here?

    Thanks in advance.

    The problem is that your test_Region_obj does not contain an object of test_language_obj but a collection of test_language_obj objects.

    If the constructor of test_Region_obj waiting for the 3rd Argument of type test_language_tab instead of test_language_obj.

    HTH

    Roger

  • Nested table and tables nested inside (CREATE TABLE)

    Hi all

    I have a problem of creation of a table with some types defined by the user at several levels (and therefore the nested tables).

    All first of all objects:
    type top_object is object (
        text_top varchar2(100),
        table_a a_object_tbl,
        table_b b_object_tbl
    );
    
    type a_object_tbl is table of a_object;
    type a_object is object (
      text_a varchar2(100)
    );
    
    type b_object_tbl is table of b_object;
    type b_object is object (
      text_b varchar2(100),
      table_c c_object_tbl,
      table_d d_object_tbl
    );
    
    type c_object_tbl is table of c_object;
    type c_object is object (
      text_c varchar2(100)
    );
    
    type d_object_tbl is table of d_object;
    type d_object is object (
      text_d varchar2(100)
    );
    Shortly: the SUPERIOR object contains tables A and B. B includes tables C and D.


    Well, now I want to create a table that contains the TOP level object.
    My attempt:
    create table multilevel_table (
      some_value varchar2(100),
      data top_object
    )
    NESTED TABLE top_object.table_a STORE AS data1,
    NESTED TABLE top_object.table_b STORE AS data2
    (NESTED TABLE table_c STORE AS data3,
    NESTED TABLE table_c STORE AS data4);
    Of course, this does not (otherwise I would not have asked you ;)). If I jump the 'second level', so just deleting table_b top_object and, therefore, the "inner nested table' it works.
    But on this scenario more complex I don't know the right way or the syntax.

    I would be grateful if I get any help or suggestion on your part!

    + 1 for recommendation of Hoek of simply not using TABLEs IMBRIQUEES for persistent structures.

    But:

    create table multilevel_table (
      some_value varchar2(100),
      data top_object
    )
    NESTED TABLE data.table_a STORE AS data1,
    NESTED TABLE data.table_b STORE AS data2
    (NESTED TABLE table_c STORE AS data3,
     NESTED TABLE table_d STORE AS data4) ;
    
  • On the Table nested

    Hi all

    Why the following SQLs are unable to work? He told me that:

    ERROR on line 1:
    ORA-02320: failure in the creation of the table of storage for the nested table column
    ACCESS_G
    ORA-22913: must specify the name of the table for the nested table column or attribute

    SQL:

    CREATE or REPLACE TYPE el_type () AS OBJECT
    ip_address VARCHAR2 (16));
    /

    CREATE or REPLACE TYPE el_tab_type AS TABLE OF THE el_type;
    /

    CREATE or REPLACE TYPE re_type () AS OBJECT
    re_name VARCHAR2 (16).
    el_g el_tab_type);
    /

    CREATE or REPLACE TYPE re_tab_type AS TABLE OF THE re_type;
    /

    CREATE TABLE actual_info)
    profile_name VARCHAR2 (16).
    access_g re_tab_type)
    TABLESPACE DBdata
    NESTED TABLE access_g STORE AS access_tab;
    /

    You have a table nested within a nested table, so you must specify the storage
    for both tables nested.
    Tom tells how do:
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:2969385152046

    URS

  • Table nested @ schema - level how to extract the first clue?

    Hello

    My version of oracle database: 11g

    I present to you the code here and here are the steps by which I created a table and theres a regular column to the number, but the 2nd column is a nested table.

    (1) create or replace type s_def_NT_DepEmployees is table of the varchar2 (100);

    2)

    create the table employees_NT_test

    (number of department_id

    c_of_s_def_NT_DepEmployees s_def_NT_DepEmployees)

    nested as NTs_c_of_s_def_NT_DepEmployees table c_of_s_def_NT_DepEmployees store

    (3) now, I inserted 2 records:

    insert into employees_NT_test values (1, s_def_NT_DepEmployees ('Rahul', 'Myra'));

    insert into employees_NT_test values (2, s_def_NT_DepEmployees ('Rashi', 'Gaurav'));

    (4) now get me this sql allows employees of department_id: 1

    Select column_value

    table (select c_of_s_def_NT_DepEmployees in the employees_NT_test where department_id = 1);

    Output:

    Rahul

    Myra

    Now my question: I want to just choose the first clue: IE: rahul (and not myra) and it should be compatible such that if I select the two departments I should get my output like:

    Department_id | employees

    1                    | Rahul

    2                    | Rashi

    PS: I am looking for a sql query, I hope I presented my question clearly, if there are doubts please let me know.

    Thanks in advance

    Rahul

    Now my question: I want to just choose the first clue: IE: rahul(and not myra) and should be consistent

    You can only do in a deterministic manner, given the current design.

    Unlike PL/SQL, SQL has no way to access the items in the collection of their indices.

    We can think about using ROWNUM (or ROW_NUMBER) in a subquery, but the SCOREBOARD operator and later join operations do not guarantee that the order will remain the same in the different calls.

    You must redefine the collection 's_def_NT_DepEmployees' as an array of objects, and this object would include an index attribute explicitly on which you can filter.

    The alternative is to create a function that takes the collection and the index for the arguments and returns the element at index - but even in this case I'm not sure that oracle could rebuild deterministically collection either.

    Why use a table nested at all?

  • help join you a table nested with ordinary table

    IM creating a nested table object prtcnpt_info codelist. In a block anonymous im saying t_code as type nested table codelist.
    Now when I try to join the table nested to ordinary table oracle DB and I get the error: PL/SQL: ORA-00904: "COLUMN_VALUE": invalid identifier.
    Please help me on this and provide link tutorial about this concepts... Here is the code I wrote

    -Start code.
    create or replace type prtcnpt_info as an object (identification number
    , name varchar2 (200)
    (, code varchar2 (30));


    create type codelist is the prtcnpt_info table;


    declare
    t_code codelist.
    Start

    Select prtcnpt_info (b.pid, b.name, pt.code) in bulk collect into t_code
    party pt
    mc_code b
    where pt.cd in ("AAA", "BBB")
    and pt.ptype_id = b.pt_type_id;


    INSERT INTO table (ID
    RUN_ID
    DATA
    P_ID
    )
    SELECT id
    run_id
    data
    prtct.id-> 1
    IN table_2 t2
    , (by selecting column_value in table (t_code)) prtct
    WHERE prtct.id = t2. P_ID; -> 2

    end;

    -End code;
    also of the anonymous block
    1 = > is this right until you get the id value (b.pid) of the tablet_code nested as prtct alias?
    2 = > is this right until you reach the nested with ordinary table table? I want to join the id column in the tables.

    Published by: 914912 on April 30, 2012 02:11

    Write the insert like this and try

    insert into table
    (
           id
         , run_id
         , data
         , p_id
    )
     select id,
         run_id,
         data,
         prtct.id
       from table_2 t2
         table(t_code) prtct
      where prtct.id = t2.p_id;
    
  • Object Table of XMLType vs single column of XMLType Table

    What are the differences between the XMLType table object and a table with a single column of XMLType?

    It's

    CREATE TABLE XMLType xml_table;

    and

    CREATE TABLE xml_table (xml_field XMLTYPE);

    That should be used and when? Both may be declared to be aware of schema.

    The main difference is that an XMLType object array allows the use of the XML DB Repository to store and retrieve XML content.
    The relationship between a resource and its content is maintained by a "pointer" (REF XMLType) line in the XMLType table:

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb03usg.htm#ADXDB4223
    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb03usg.htm#BJFBDEJE

    Tables based on the patterns of XMLType (including the associated nested structure) can also be created automatically through recording scheme, which is very convenient when the pattern becomes complex.
    In addition, a registred schema-compliant documents that go into the repository automatically stored in the table by default (see the annotation xdb:defaultTable).
    We can also use ACLs to control access to specific rows in a table of object XMLType.

    This is not possible with XMLType columns in a relational table.

  • How to create a foreign key constraint on a table nested column

    Dear Experts,
    I create 2 tables using the object type. the VESSEL_PARAM table contains the list of the parameters allowed.
    The table VESSEL_TYPE containe single item we list some parameters.

    On this table, I love the column VESSEL_PARAM table VESSEL_PARAM to check if the settings are and the reference value is allowed.
    How to create a foreign key?
    Here my script that generates this runtime error: 00904. 00000 - '% s: invalid identifier' on this line

    ALTER TABLE VESSEL_PARAM_TAB ADD CONSTRAINT FK_VESSEL_TYPE FOREIGN KEY (NAME, DATA_VALUE)
    REFERENCES VESSEL_PARAM (PARAM_NAME, LIST_PARAM_VALUE. DATA_VALUE)
    CREATE OR REPLACE TYPE OBJ_PARAM_VALUE AS OBJECT 
    ( 
      DATA_VALUE  VARCHAR2(20)
     ,DESCRIPTION VARCHAR2(125)
    ) NOT FINAL;
    /
    
    CREATE OR REPLACE TYPE LIST_PARAM_VALUE AS TABLE OF OBJ_PARAM_VALUE;
    /
    
    -- derive object subtype from object supertype
    CREATE OR REPLACE TYPE OBJ_PARAM_NAME UNDER OBJ_PARAM_VALUE (
      NAME VARCHAR2(30)
    )NOT FINAL;
    /
    
    CREATE OR REPLACE TYPE LIST_PARAM_NAME AS TABLE OF OBJ_PARAM_NAME;
    /
    
    Prompt create table VESSEL_PARAM;
    CREATE TABLE VESSEL_PARAM (
       PARAM_NAME   VARCHAR2(20) NOT NULL
      ,PARAM_DESC   VARCHAR2(125)
      ,PARAM_VALUE  LIST_PARAM_VALUE
      ,CONSTRAINT PK_VESSEL_PARAM PRIMARY KEY (PARAM_NAME)
    ) 
    NESTED TABLE PARAM_VALUE STORE AS PARAM_VALUE_TAB
    TABLESPACE CMS_ADMDATA;
    /
    ALTER TABLE PARAM_VALUE_TAB ADD CONSTRAINT UN_PARAM_VALUE_TAB UNIQUE (DATA_VALUE);
    /
    SHOW ERROR;
    
    Prompt create table CMS_ADM.VESSEL_TYPE;
    CREATE TABLE CMS_ADM.VESSEL_TYPE (
      VESSEL_TYPE  VARCHAR2(20) NOT NULL
     ,VESSEL_DESC  VARCHAR2(125)
     ,VESSEL_PARAM LIST_PARAM_NAME
     ,CONSTRAINT PK_VESSEL_TYPE PRIMARY KEY (VESSEL_TYPE)
    -- ,CONSTRAINT FK_VESSEL_TYPE FOREIGN KEY (VESSEL_PARAM) 
    --        REFERENCES VESSEL_PARAM (PARAM_NAME)
    ) 
    NESTED TABLE VESSEL_PARAM STORE AS VESSEL_PARAM_TAB
    TABLESPACE CMS_ADMDATA;
    /
    ALTER TABLE VESSEL_PARAM_TAB ADD CONSTRAINT UN_VESSEL_PARAM_TAB UNIQUE (NAME);
    ALTER TABLE VESSEL_PARAM_TAB ADD CONSTRAINT FK_VESSEL_TYPE FOREIGN KEY (NAME,DATA_VALUE) 
            REFERENCES VESSEL_PARAM (PARAM_NAME,LIST_PARAM_VALUE.DATA_VALUE)
    /
    SHOW ERROR;
    Thank you

    Salvatore

    Could you please indicate your answer as correct if you judge them correct.

    Best regards

    Mohamed Houri

  • Record table Nested sorting

    Hello

    Can you help me to sort (based on join date) below table nested using the TABLE function?

    declare
    type is rendered
    (emp_id char (20),
    date of join_d);
    type emp_tbl_type is table of SheikYerbouti;

    non_sorted emp_tbl_type;
    asc_sorted emp_tbl_type;
    Start
    -create sample data

    non_sorted (1) .emp_id: = '1';
    non_sorted (1) .join_d: = sysdate + 5;
    non_sorted (2) .emp_id: = '2';
    non_sorted (2) .join_d: = sysdate + 1;
    non_sorted (3) .emp_id: = '3';
    non_sorted (3) .join_d: = sysdate + 7;
    non_sorted (4) .emp_id: = '4';
    non_sorted (4) .join_d: = sysdate + 7;

    for me in non_sorted.first... loop of non_sorted. Last

    dbms_output.put_line ('Emp ID :'|| non_sorted (i) .emp_id |) ' Date :'|| non_sorted (i) .join_d);
    end loop;

    Select emp_id, join_d
    LOOSE COLLECTION asc_sorted
    table (cast (non_sorted AS emp_tbl_type))
    order of join_d;
    -can you sort these data and move it to asc_sorted

    because me in 1... loop asc_sorted. Count

    dbms_output.put_line ('Emp ID :'|| asc_sorted (i) .emp_id |) ' Date :'|| asc_sorted (i) .join_d);
    end loop;


    end;

    Thank you!

    Thanks I fixed the issue after reading the oracle documentation.

    declare

    non_sorted emp_tbl_type: = emp_tbl_type();
    asc_sorted emp_tbl_type: = emp_tbl_type();

    / * cursor asc_cur is
    Select emp_id, join_d
    table (CAST (non_sorted AS emp_tbl_type))
    order of join_d; */

    Start
    -create sample data
    non_sorted.extend;
    non_sorted (1): = emp_rec('1',sysdate+5);
    non_sorted.extend;
    non_sorted (2): = emp_rec('2',sysdate+1);
    non_sorted.extend;
    non_sorted (3): = emp_rec('3',sysdate+7);
    non_sorted.extend;
    non_sorted (4): = emp_rec('4',sysdate+3);

    for me in non_sorted.first... loop of non_sorted. Last

    dbms_output.put_line ('Emp ID :'|| non_sorted (i) .emp_id |) ' Date :'|| non_sorted (i) .join_d);
    end loop;

    dbms_output.put_line ('* UNSORTED data ');

    Select emp_rec (emp_id, join_d)
    bulk collect into asc_sorted
    table (CAST (non_sorted AS emp_tbl_type))
    order of join_d;

    dbms_output.put_line ('* UNSORTED data ');
    because me in 1... loop asc_sorted. Count

    dbms_output.put_line ('Emp ID :'|| asc_sorted (i) .emp_id |) ' Date :'|| asc_sorted (i) .join_d);
    end loop;

    end;

    THX

  • function not returning object table properly

    Rather than return a table, my function returns this:

    SCHEMA_OWNER. TBL_SUMS ([SCHEMA_OWNER. SUMS_OBJ])

    Did anyone see a syntax error in my function or the DOF of my table and object types?

    It is a stripped down, simplified version of my function:

    create or replace FUNCTION "F_TEST" (number of p_skey, p_start_date date, p_end_date date)
    RETURN tbl_sums

    IS

    tmp_A NUMBER;
    tmp_B NUMBER;

    l_tbl tbl_sums: = tbl_sums();

    BEGIN

    SELECT SUM (FieldA), SUM (FieldB)
    in tmpA, tmpB
    FROM MaTable where SKEY = p_skey
    and DATE_VALUE > = p_start_date
    and DATE_VALUE < p_end_date;.

    l_tbl.extend;
    l_tbl (l_tbl. (Count()): = sums_obj (p_start_date, p_end_date, p_skey, tmpA, tmpB);
    Return l_tbl;

    END;

    My models are:

    create or replace type sums_obj is object (DATE start_date, end_date DATE, skey NUMBER, SumA, SumB NUMBER);
    create or replace type tbl_sums is table of the sums_obj;


    Thank you!

    >
    RETURN tbl_kpi
    >
    What is 'tbl_kpi '? Which is not defined anywhere. Your original post said:
    >
    RETURN tbl_sums
    >
    We cannot help you if you don't publish what you actually use. Cut & paste is ok, but you have to paste the correct code.

    Your function returns a TABLE, but it is NOT in the PIPELINE. For example, if you query the DOUBLE function you will get a DATASET as a result.

    If you query the function AS A TABLE, you will get the "content" of the table.

    If you make your function a PIPELINED function then you use PIPE ROW to return each line but the function is always declared to return a TABLE. This is perhaps what is confusing you.

    Try the following code to see what the difference is.

    Here are two SQL types based on the EMP table in the scott schema.

    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
      )
      /
    
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    /
    

    Now - here's a function (similar to yours) that returns him EMP_TABLE_TYPE. NOTE: the function IS NOT PIPELINED

    CREATE OR REPLACE function SCOTT.get_emp1( p_deptno in number )
      return emp_table_type
      as
    tb emp_table_type;
    BEGIN
      select emp_scalar_type(empno, ename, job, mgr, hiredate, sal, comm, deptno)
        bulk collect into tb from emp where deptno = p_deptno;
      return tb;
    end;
    /
    

    If I simply select the function itself twice I get this:

    select get_emp1(20) from dual
    
    GET_EMP1(20)
    (DATASET)
    

    I can use TOAD or sql developer to examine this dataset and see the documents.

    But I can actually query the records by using the TABLE function:

    select * from table(get_emp1(20))
    
    EMPNO     ENAME     JOB     MGR     HIREDATE     SAL     COMM     DEPTNO
    7369     SMITH     CLERK     7902     12/17/1980     800          20
    7566     JONES     MANAGER     7839     4/2/1981     2975          20
    7788     SCOTT     ANALYST     7566     4/19/1987     3000          20
    7876     ADAMS     CLERK     7788     5/23/1987     1100          20
    7902     FORD     ANALYST     7566     12/3/1981     3000          20
    

    This is a similar function. It returns the same EMP_TABLE_TYPE, but it is a PIPELINED function.

    -- pipelined function
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
      /
    

    The ONLY way I can query this function is using the TABLE function:

    select * from table(get_emp(20))
    
    EMPNO     ENAME     JOB     MGR     HIREDATE     SAL     COMM     DEPTNO
    7369     smith     CLERK     7902     12/17/1980     800          20
    7566     jones     MANAGER     7839     4/2/1981     2975          20
    7788     scott     ANALYST     7566     4/19/1987     3000          20
    7876     adams     CLERK     7788     5/23/1987     1100          20
    7902     ford     ANALYST     7566     12/3/1981     3000          20
    

    The query of the PIPELINED function is the same and the result set is the same.

    The difference is that the PIPELINED function returns ONE LINE at a time and does NOT need to accumulate a large amount of data in a collection before returning. This collection uses the memory of expensive PGA and the more data you have the more memory it uses.

    Your function (and my only similar) return NO data until it has produced ALL of this. And he uses this expensive PGA memory. What is the point to create your collection at a time line and wait until you have everything before send it back you?

    You can easily modify your function and add PIPELINED to the declaration. Then, use the PIPE ROW clause to return each row that it is produced. Which will eliminate the need of collecting (and memory) within the service.

    You can also then follow up calls to function if you need to.

    See 'Use of functions Table in pipeline and parallel' in the data cartridge Developer Guide
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28425/pipe_paral_tbl.htm

    There is little use for your function that is not in the pipeline, but returns a type of table, unless you used to store the array type in a column of an object table.

    There are many uses for PIPELINED functions.

  • Bulk collect into a Table nested with Extend

    Hi all
    I want to get all the columns of the table emp and dept. So I use bulk collect into the concept of nested table.

    *) I wrote the function in three different ways. EX: 1 and 2 (DM_NESTTAB_BULKCOLLECT_1 & DM_NESTTAB_BULKCOLLECT_2) does not give the desired result.
    *) It only gives the columns of the EMP table. That means it takes DEPT & columns of the EMP table, but it only gives columns of table EMP.
    ) I think, there is something problem with nested table Extend.
    ) I want to know infested.
    Can we use bulk collect into a table nested with extend?
    If it is yes then fix the below codes (EX: 1 & EX: 2) and can you explain me please?


    Codes are given below *.

    CREATE OR REPLACE TYPE NEST_TAB IS TABLE OF THE VARCHAR2 (1000);

    EX: 1:
    ----
    -Bulk collect into a Table nested with Extend-
    CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_1
    RETURN NEST_TAB
    AS
    l_nesttab NEST_TAB: = NEST_TAB();
    BEGIN
    FOR tab_rec IN (SELECT table_name
    From user_tables
    WHERE table_name IN ('EMP', 'Department')) LOOP
    l_nesttab.extend;

    SELECT column_name
    bulk collect INTO l_nesttab
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name
    ORDER BY column_id;
    END LOOP;

    RETURN l_nesttab;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END DM_NESTTAB_BULKCOLLECT_1;

    SELECT *.
    TABLE (DM_NESTTAB_BULKCOLLECT_1);

    OUTPUT:
    -------
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO

    * Only the EMP table columns are there in the nested table.
    -----------------------------------------------------------------------------------------------------

    EX: 2:
    -----
    -Bulk collect in the nested with Extend based on County - Table
    CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_2
    RETURN NEST_TAB
    AS
    l_nesttab NEST_TAB: = NEST_TAB();
    v_col_cnt NUMBER;
    BEGIN
    FOR tab_rec IN (SELECT table_name
    From user_tables
    WHERE table_name IN ('EMP', 'Department')) LOOP
    SELECT MAX (column_id)
    IN v_col_cnt
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name;

    l_nesttab. Extend (v_col_cnt);

    SELECT column_name
    bulk collect INTO l_nesttab
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name
    ORDER BY column_id;
    END LOOP;

    RETURN l_nesttab;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END DM_NESTTAB_BULKCOLLECT_2;

    SELECT *.
    TABLE (DM_NESTTAB_BULKCOLLECT_2);

    OUTPUT:
    -------
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO

    * Only the EMP table columns are there in the nested table.
    -------------------------------------------------------------------------------------------

    EX: 3:
    -----

    -Collect in bulk in a nested Table to expand aid for loop.
    CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_3
    RETURN NEST_TAB
    AS
    l_nesttab NEST_TAB: = NEST_TAB();
    TYPE local_nest_tab
    THE VARCHAR2 ARRAY (1000);
    l_localnesttab LOCAL_NEST_TAB: = LOCAL_NEST_TAB();
    NUMBER x: = 1;
    BEGIN
    FOR tab_rec IN (SELECT table_name
    From user_tables
    WHERE table_name IN ('EMP', 'Department')) LOOP
    SELECT column_name
    bulk collect INTO l_localnesttab
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name
    ORDER BY column_id;

    BECAUSE me IN 1.l_localnesttab. COUNTING LOOP
    l_nesttab.extend;

    L_NESTTAB (x): = L_LOCALNESTTAB (i);

    x: = x + 1;
    END LOOP;
    END LOOP;

    RETURN l_nesttab;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END DM_NESTTAB_BULKCOLLECT_3;

    SELECT *.
    TABLE (DM_NESTTAB_BULKCOLLECT_3);

    OUTPUT:
    ------
    DEPTNO
    DNAME
    LOC
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO

    * Now, I got the desired result set. DEP. and columns of the Emp Table are in the nested Table.




    Thank you
    Ann

    COLLECTION BULK cannot add values to an existing collection. It can only crush.

  • EDM campaign... tables nested?

    Hello wonderful people.

    Wondering if anyone could help me with this little doozy...

    one of my clients wants to do an EDM for them. I did like they ask (they wanted as jpg)
    and their it staff have rewritten for me as follows:

    "Most browsers are able to solve problems with these bays, but e-mail clients cope so well." To remedy this, it may be preferable to use tables nested, instead of spanning columns and different lines. for example. "make every line contains a single < td > element and when several are required and then creating a new nested table.

    Here is a screenshot of how it will look like. Is this good? I would have thought the hotspots on the web address, Twitter and Facebook logos could have sufficed.

    Picture 13.png

    The nested tables the way forward for such things?

    Cheers!

    Michael

    Hi Michael, yes you are right the nested tables are the way to go if she'll send using e-mail clients.

    There are a few things to take note however:

    • Use hotspots with care, gmail can not detect hot spots that mean the redirect url does not work... Yahoo, hotmail, and outlook work very well
    • When the code using nested table there is a few rules to follow, such as use inline css, nested tables, no divs, no background image ( is fine but not the background css and html selector)
    • So in your design, I can see the baby with the background images and text... propably will not work unless u export all in one picture.
    • It is important to note images will leave a white space between the two for hotmail user, so be sure to add to the css

    style = "" display: block; "." You can google for more info...

    • An other things is that you need to know how your customers send email Ferragamo, as the use of this software?... for outlook 2003 is more stable, outlook 2007 and especially will probably screw up your layout. If your client uses the third-party e-mail provider then it should be fine...

    and the list continues... I know html email is annoying

  • How to upload an image or a file in flash as a blob in an object table.

    How to upload an image or a file in flash as a blob in an object table.

    What are all the possible ways, we can do it.

    A search on the forum (or google) would be my first choice, as this issue appears from time to time.

    Then, without the knowledge of your environment (jdev version and battery technology), it is difficult to give a profound response.
    All I can say is that it is possible.

    Timo

Maybe you are looking for