Can plsql return table of object type

Dear All,
I am trying to return a set of data using object type.
But i am able to return only a single row but I want to return multiple rows.
I am trying to create the procedure which will return the table of object type but I am not able to assign value to table of object type.
Any ideas will be appreciated.
Regards
Abhishek

ArchitectView wrote:
The intention is to create a tree structure of data.Is this structure stored in the database? If so, then what data model is used? Relational? Hierachical? Object?
Each of these have pros and cons. The object model has many when persisted in a database as it nowhere near as flexible and robust as relational. Simple example, you can define an object class called Address. You can define a collection class called addressList. You can make that collection class a column in the Customers table. This allows you to store multiple addresses for a customer - as part of the same row for a customer.
However, there is a data modeling issue here. How do you index the region code in the address to do region based sales and marketing queries? There is a performance issue here - every time a customer row is read, the Addresses column is also read and this column contains a collection of addresses... Expensive I/O wise.
If relational data model was used, there would have been an Addresses table. It would have had a region index. And every time you read a customer row, all the addresses of that customer is not automatically read into memory too.
This Pl/SQL is to be called by another program which will accept the tree structure.So PL/SQL is to deliver a tree structure class?
You have mentioned about the design being not optimal, please elaborate.
I am doing these steps to improve performance.
i already have a java code which creates the data in the tree form {common data model -  XML} .
I am thinking that if I create the structure in database , it will be better for performance.What makes sense to me (performance, usability and data modeling wise) is to use a relational design to store the tree data in Oracle. Each tree item will have a unique identifier and an optional parent identifier. The latter will be a foreign key constraint to the unique identifier.
The PL/SQL procedure can use a hierachical SQL to select the relevant root nodes from the tree table (i.e. start with tree items that have null parent identifiers) and transform this into a XML and supply XML output.
This allows Java to call this PL/SQL procedure, and get XML in response.
An alternative would be to not use XML, but instead define the tree structure as Java expects it, using SQL advance data types (i.e. classes). But instead of using that for store of the tree's data, the PL/SQL proc uses it to transform the tree data (selected via a hierarchical query) into this class object structure.
The Java client then needs to have wrapper classes for these SQL classes - and when it calls the PL/SQL proc, it gets a class structure returned that it can natively use on its side.
This a tad more complex to do than the XML interface - but could be faster as the Java layer does not need to transform the XML into a local data structure... it gets an equivalent data structure directly from PL/SQL.
The only issue ito performance I can see, is attempting to use such an object structure also as data storage (Oracle table) structure. This is usually less than optimal. Fair to say, that relational data modeling still reigns supreme ito usability, integrity and performance. (at least within RDBMS products, like Oracle)

Similar Messages

  • Retriving data through stored procedure returning Table of object type

    I am trying to retrieve the data returned as a table(secret_tab_type) of object type(secret_type). Now we can get the secret_tab_type table through
    rset = (ResultSet) cstmt.getObject(1); but how to map the SQL object type to Java object type ??
    FUNCTION Fetchthat(
    secretinfo      out      SECRET_TAB_TYPE,
    message     OUT varchar2
    ) return number;
    These are the declaration of secret_type object and secret_tab_type(table returned by fetchthat procedure)
    create or replace type secret_type as object
    (secret_id number(3),
    secret_question varchar2(100),
    valid_flag char);
    create or replace type secret_tab_type as table of secret_type;

    Amit,
    Your question has been previously asked (and answered) on this forum. I suggest searching this forum's archives for the terms STRUCT and ARRAY.
    For your benefit, here are the results of my search:
    http://tinyurl.com/auvl8
    Good Luck,
    Avi.

  • Invoking stored procedure that returns array(oracle object type) as output

    Hi,
    We have stored procedures which returns arrays(oracle type) as an output, can anyone shed some light on how to map those arrays using JPA annotations? I tried using jdbcTypeName but i was getting wrong type or argument error, your help is very much appreciated. Below is the code snippet.
    JPA Class:
    import java.io.Serializable;
    import java.sql.Array;
    import java.util.List;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import org.eclipse.persistence.annotations.Direction;
    import org.eclipse.persistence.annotations.NamedStoredProcedureQuery;
    import org.eclipse.persistence.annotations.StoredProcedureParameter;
    * The persistent class for the MessagePublish database table.
    @Entity
    @NamedStoredProcedureQuery(name="GetTeamMembersDetails",
         procedureName="team_emp_maintenance_pkg.get_user_team_roles",
         resultClass=TeamMembersDetails.class,
         returnsResultSet=true,
         parameters={  
         @StoredProcedureParameter(queryParameter="userId",name="I_USER_ID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="employeeId",name="I_EMPLOYEEID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="TEAMMEMBERSDETAILSOT",name="O_TEAM_ROLES",direction=Direction.OUT,jdbcTypeName="OBJ_TEAM_ROLES"),
         @StoredProcedureParameter(queryParameter="debugMode",name="I_DEBUGMODE",direction=Direction.IN,type=Long.class)
    public class TeamMembersDetails implements Serializable {
         private static final long serialVersionUID = 1L;
    @Id
         private long userId;
         private List<TeamMembersDetailsOT> teamMembersDetailsOT;
         public void setTeamMembersDetailsOT(List<TeamMembersDetailsOT> teamMembersDetailsOT) {
              this.teamMembersDetailsOT = teamMembersDetailsOT;
         public List<TeamMembersDetailsOT> getTeamMembersDetailsOT() {
              return teamMembersDetailsOT;
    Procedure
    PROCEDURE get_user_team_roles (
    i_user_id IN ue_user.user_id%TYPE
    , o_team_roles OUT OBJ_TEAM_ROLES_ARRAY
    , i_debugmode IN NUMBER :=0)
    AS
    OBJ_TEAM_ROLES_ARRAY contains create or replace TYPE OBJ_TEAM_ROLES_ARRAY AS TABLE OF OBJ_TEAM_ROLES;
    TeamMembersDetailsOT contains the same attributes defined in the OBJ_TEAM_ROLES.

    A few things.
    You are not using a JDBC Array type in your procedure, you are using a PLSQL TABLE type. An Array type would be a VARRAY in Oracle. EclipseLink supports both VARRAY and TABLE types, but TABLE types are more complex as Oracle JDBC does not support them, they must be wrapped in a corresponding VARRAY type. I assume your OBJ_TEAM_ROLES is also not an OBJECT TYPE but a PLSQL RECORD type, this has the same issue.
    Your procedure does not return a result set, so "returnsResultSet=true" should be "returnsResultSet=false".
    In general I would recommend you change your stored procedure to just return a select from a table using an OUT CURSOR, that is the easiest way to return data from an Oracle stored procedure.
    If you must use the PLSQL types, then you will need to create wrapper VARRAY and OBJECT TYPEs. In EclipseLink you must use a PLSQLStoredProcedureCall to access these using the code API, there is not annotation support. Or you could create your own wrapper stored procedure that converts the PLSQL types to OBJECT TYPEs, and call the wrapper stored procedure.
    To map to Oracle VARRAY and OBJECT TYPEs the JDBC Array and Struct types are used, these are supported using EclipseLink ObjectRelationalDataTypeDescriptor and mappings. These must be defined through the code API, as there is currently no annotation support.
    I could not find any good examples or doc on this, your best source of example is the EclipseLink test cases in SVN,
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/plsql/
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/customsqlstoredprocedures/
    James : http://www.eclipselink.org

  • Varray, Nested Table and Object types in OWB r2

    Requirement:
    Flat file with repeating groups of nested content need to move into Object Relational ORACLE table (using varray or nested tables - no preference). The data will be loaded, then mapped/transformed into a richer O-R output to directly produce XML outputs.
    Problem:
    Generated PL/SQL "seems" to do the correct thing, but deployment errors show failures on mapping of collections (varrays, NTs or OTs) and in sqlplus recompiling the PKB still gives the errors. Is this a PL/SQL generator error, or is there a more meaningful example of using CONSTRUCT OBJECT operator than the embedded odcumentation - it is a simple type (single instance) and not a variable repeating group of nested data.
    Anyone had any success with these, or know of any collateral to assist in the process. Thanks.

    The process we are following is very simple. We are talking 10 columns from a source flat file table and wish to map this into a Varray/Nested table, with one column of Varchar2(10).
    When you create your map in OWB, select the construct object, you have to choose an object type - it does not allow you to select a VARAAY or NESTED table.
    I have then created an object defined in the same structure as the VARRAY/NESTED table - I have then made the VARRAY/NESTED table of this TYPE.
    Example:
    CREATE OR REPLACE TYPE "O_REL_PUB_INDEX" AS OBJECT (
    X_REL_PUB_INDEX_1 VARCHAR2(10))
    CREATE OR REPLACE TYPE "V_REL_PUB_INDEX" AS VARRAY(15) OF O_REL_PUB_INDEX
    In OWB you can then select O_REL_PUB_INDEX when creating the 'Contruct Object'.
    The problem I have is that when I map to my target column of type V_REL_PUB_INDEX and DEPLOY my map I get the following errors taken from OWB control centre
    Name
    Action
    Status
    Log
    TEST
    Create
    Warning
    ORA-06550: line 2931, column 9:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 3174, column 11:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    TEST
    Create
    Warning
    ORA-06550: line 401, column 7:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 643, column 13:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    TEST
    Create
    Warning
    ORA-06550: line 7221, column 9:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 7464, column 11:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    Any ideas? anyone succesfully mapped to either a VARRAY or an NESTED TABLE target column?

  • MASS - how to add more tables to object types

    I am setting up a variant in the MASS transaction and I need to add the VBUP / order line item status table to the Object Type  BUS2032 - sales orders.   How can I add another table to this?   Currently VBAK, VBKD and VBAP are available.
    Thank you,
    Lisa

    > Hi Lisa,
    > I feel you are tyring out something which cannot be
    > done.
    > MASS will allow you to make a large number of changes
    > at one go by creating a BDC.
    > Now if you cannot do the change manually then you
    > cant do it using MASS.
    >
    > So trying to maintain VBUP thru MASS will not work.
    > You may need to find out the field in VBAP which
    > would trigger the VBUP updation in your scenario.
    >
    > Reward points if this clarifies your question.
    > regards
    > Biju
    Hello Biju,
    MASS is doing what I want it to do.  I can upload a file of sales orders that have not been delivered.  I can then change the line item pricing date using MASS, and that will trigger the Carry Out New Pricing function. 
    I just wanted to add the delivery-status field to the select options screen in MASS.  I don't want to change the delivery-status field value.    I know that BUS2032 is SAP-delivered, but it it possible to copy that object to ZBUS2032 and then add the VBUP table for my selection criteria?
    Thank you,
    Lisa

  • Table for object type

    Hi,
    Can anyone give me the table(s) for the workflow object type. I want to use the object type as a select-option instead of using the tasks that are part of the object type. I couldn't find anything in the SDN workflow forum.
    Thanks,
    John

    Hi,
    What is a workflow object type?
    Pressing F1 and then technical infomation on an SAP workflow screen is usually enough to find the underlying check tables etc.
    Kind regards, Rob Dielemans

  • Nested Tables with Object Types

    Hi,
    Does someone know from which version on object Types can be referenced via database links ?
    I could not manage with Oracle 8.1.7 and needed this features as the only way to access
    a stored procedure array is via collection and using Object Types.
    But Object Types are not possible to access remotlely.
    Thanks in advance.
    brg robert

    Click on the link below and see if you can use that method as a way to work around the problem:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1252400357305

  • How to insert with select in table with object types

    I am in the proces of redesigning some tables, as i have upgraded from
    personal oracle 7 to personal oracle 8i.
    I have constructed an object type Address_type, which is one of the columns
    in a table named DestTable.
    The object type is created as follows:
    CREATE OR REPLACE TYPE pub.address_type
    AS OBJECT
    Street1 varchar2(50),
    Street2 varchar2(50),
    ZipCode varchar2(10));
    The table is created as follows:
    CREATE TABLE pub.DestTable
    (id INTEGER PRIMARY KEY,
    LastName varchar2(30),
    FirstName varchar2(25),
    Address pub.address_type);
    Inserting a single row is ok as i use the following syntax:
    Insert into DestTable(1, '******* ', 'Lawrence', pub.address_type(
    '500 Oracle Parkway', 'Box 59510', '95045'));
    When i try to insert values into the table by selecting from another table i
    cannot do it and cannot figure out what is wrong
    I have used the following syntax:
    Insert into DestTable
    id, name, pub.address_type(Street1, Street2, ZipCode))
    select
    id, lastname, firstname, street1, street2, ZipCode
    from SourceTable;
    I have also tried the following syntax:
    Insert into DestTable
    id, name, pub.address_type(Address.Street1, Address.Street2,Address.ZipCode))
    select
    id, lastname, firstname, street1, street2, ZipCode
    from SourceTable;
    What is wrong here ?
    null

    Magnus,
    1. Check out the examples on 'insert with subquery' in http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a85397/state21b.htm#2065648
    2. Correct your syntax that repeated the column definition after "insert into ..."
    Insert into DestTable
    id, name, pub.address_type(Street1, Street2, ZipCode))
    select
    id, lastname, firstname, street1, street2, ZipCode
    from SourceTable;
    Regards,
    Geoff
    null

  • Table or Object type - like #temp table in SQL Server

    Hi
    I need to create a temp table to hold certain data and then validate. What is the best way to do this oracle. Something similar to #temp tables in SQL Server.
    Thanks

    IN Oracle, you create the temporary table once, before you start your program. Then anyone can use that definition, but the system keeps the data isolated to eachr/session.
    The difference in using Oracle: all DDL, including creating temp tables, performs commits and aquires locks that you want to avoid. It creates unnecessary serialization, causes transactional consistency issues and puts Oracle's Read Consistent model at risk (of ORA-01555 errors).
    So, you (or the DBA) would "CREATE GLOBAL TEMPORARY TABLE ..." with the appropriate definition you want, and indicate whether you want the data deleted on commit, or on logoff.
    Then you write your procedure, similar to the way you would do it in SQL Server, but you would not bracket it with creating/dropping the temp table - no need.

  • How can i compare tables of same type and in different schemas

    Hi all,
    i have one table "employee" in schema 'Master'.
    And i have the same table +(total structure is same as master schema employee table with some additional columns).+ in Audit schema.
    So, when i do update or delete on the "master.employee" table the previous record (entire record) will go into
    "Audit.employee" table, and my "master.employee" table is having the existing record.
    So now, i want to generate one excel report containing or comparing the existing record from master and previous record from Audit. And my Input fields are " schema_name " and "Table_name".
    Ex. i will give masters.employee.
    So it has to search the same table in Audit schema compare the values and generate output.

    Hello,
    Here is the Oracle Forms forum, and your question has really nothing to do with this product.
    Please, send this kind of question in the database forum, you would increase your chances to get the appropriate answer.
    Francois

  • How to return new blob object?

    Hi,
    I am trying to find documentation on how to return a custom abstract data type (ADT) using the CREATE TYPE... and BLOB interface.
    How can I return a new object type defined inside a blob. Can I return a blob (without initializing the lob locator first)?
    Please advise.

    Hi,
    Please check the below link.
    http://docs.oracle.com/cd/E24693_01/appdev.11203/e17126/create_type.htm
    Regards,
    Sailaja

  • Require help on Array of Nested tables and Oracle Object type

    Hi All,
    I have a scenario where I have some millions of records received from a flat file and the record is stored in Table as below:
    Tablename: FILE_RECORD
    Rows:
    FILE_REG_ID = 1
    RECORD_NBR = 1     
    PROCESSED_IND = U
    RECORD= 00120130326006A
    FILE_REG_ID = 1
    RECORD_NBR = 2     
    PROCESSED_IND = U
    RECORD= 00120130326003
    1) I have to read these records at once and
    a) Split the RECORD column to get various other data Eg: Fld1=001, Fld2=20130326, Fld3 = 003
    b) send as an Array to Java.
    2) Java will format this into XML and sent to other application.
    3) The other application returns a response as Successful or Failure to Java in XML
    4) Java will send RECORD_NBR and the corresponding response as Success or Failure back to PLSQL
    5) PLSQL should match the RECORD_NBR and update the PROCESSED_IND = P.
    I 'm able to achieve this using SQL Table type by creating a TYPE for Each of the fields (Flds) however the problem is Java cannot Access the parameters as the TYPE are of COLUMN Types
    Eg: For RECORD_NBR
    SUBTYPE t_record_nbr IS FILE_RECORD.T010_RECORD_NBR%TYPE;
    Can you please let me know how I can achieve this to support Java, I know one way that is by creating an OBJECT TYPE and a TABLE of the OBJECT TYPE.
    Eg: T_FILE_RECORD_REC IS OBJECT
    FILE_REG_ID number(8), RECORD_NBR number (10), PROCESSED_IND varchar2(1), RECORD varchar(20)
    Create type T_FILE_RECORD_TAB IS TABLE OF T_FILE_RECORD_REC
    However I'm facing a problem to populate an Array of records, I know I'm missing something important. Hence please help.
    It would be helpful to provide some guidelines and suggestions or Pseudo or a Code to achieve this. Rest all I can take up further.
    Thanks in advance,

    I know once way that is creating a OBJECT TYPE and a TABLE of OBJECT TYPE, howeve I feel I'm missing something to achieve this.You're right, you need SQL object types created at the database level. Java doesn't know about locally defined PL/SQL types
    However you can do without all this by creating the XML directly in PL/SQL (steps 1+2) and passing the document to Java as XMLType or CLOB.
    Are you processing the records one at a time?

  • Function not returning table object correctly

    Instead of returning a table, my function is returning this:
    SCHEMA_OWNER.TBL_SUMS([SCHEMA_OWNER.SUMS_OBJ])
    Does anyone see a syntax error in my function or the ddl of my table and object types?
    This is a stripped down, simplified version of my function:
    create or replace FUNCTION "F_TEST" (p_skey number, 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)
    into tmpA, tmpB
    from myTable 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 types are:
    create or replace type sums_obj is object (start_date DATE, end_date DATE, skey NUMBER, SumA NUMBER, SumB NUMBER);
    create or replace type tbl_sums is table of sums_obj;
    Thanks!

    >
    RETURN tbl_kpi
    >
    What is 'tbl_kpi'? That isn't defined anywhere. Your original post said this:
    >
    RETURN tbl_sums
    >
    We can't help you if you don't post what you are really using. Cut & Paste is ok but you have to paste the correct code.
    Your funtion is returning a TABLE but it is NOT PIPELINED. So if you query the function from DUAL you will get a DATASET as the result.
    If you query the function AS A TABLE you will get the 'contents' of the table.
    If you make your function a PIPELINED function then you use PIPE ROW to return each row but the function is still declared to return a TABLE. Maybe that is what is confusing you.
    Try the following sample 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 is a function (similar to yours) that returns that 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 just select the function itself from DUAL I get this:
    select get_emp1(20) from dual
    GET_EMP1(20)
    (DATASET)I can use TOAD or sql developer to examine that dataset and see the records.
    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          20This 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 by 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          20The query of the PIPELINED function is the same and the result set is the same.
    The difference is that the PIPELINED function returns ONE ROW at a time and does NOT need to accumulate a lot of data in a collection before returning it. That collection uses expensive PGA memory and the more data you have the more memory it uses.
    Your function (and my similar one) doesn't return ANY data until it has produced ALL of it. And it uses that expensive PGA memory. What is the point of creating your collection one row at a time and waiting until you have it all before you return it?
    You could easily modify your function and add PIPELINED to the declaration. Then use the PIPE ROW clause to return each row as it is produced. That will eliminate the need for the collection (and memory) within the function.
    You can also then chain the function calls together if you need to.
    See 'Using Pipelined and Parallel Table Functions' in the Data Cartridge Developer's 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 pipelined but returns a table type unless you were storing that table-type in an object column of a table.
    There are many uses for PIPELINED functions.

  • How can I fill a table of objects from cursor with select * bulk collect???

    Hi All, I have a TYPE as OBJECT
    create or replace type dept2_o as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    I can fill a table of objects from cursor with out select * bulk collect...., row by row
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    i integer;
    begin
    i:=0;
    dept_o_tab.extend(20);
    for rec in (select * from dept) loop
    i:=i+1;
    dept_o_tab(i):=dept2_o(
    deptno => rec.deptno,
    dname => rec.dname,
    loc =>rec.loc
    end loop;
    for k IN 1..i loop
    dbms_output.put_line(dept_o_tab(k).deptno||' '||dept_o_tab(k).dname||' '||dept_o_tab(k).loc);
    end loop;
    end;
    RESULT
    10 ACCOUNTING NEW YORK
    20 RESEARCH DALLAS
    30 SALES CHICAGO
    40 OPERATIONS BOSTON
    But I can't fill a table of objects from cursor with select * bulk collect construction ...
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    begin
    dept_o_tab.extend(20);
    select * bulk collect into dept_o_tab from dept;
    end;
    RESULT
    ORA-06550: line 6, column 39;
    PL/SQL: ORA-00947: not enough values ....
    How can I fill a table of objects from cursor with select * bulk collect???

    create or replace type dept_ot as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    create table dept
    (deptno number
    ,dname varchar2(14)
    ,loc varchar2(13)
    insert into dept values (10, 'x', 'xx');
    insert into dept values (20, 'y', 'yy');
    insert into dept values (30, 'z', 'zz');
    select dept_ot (deptno, dname, loc)
      from dept
    create type dept_nt is table of dept_ot
    declare
       l_depts dept_nt;
    begin
       select dept_ot (deptno, dname, loc)
         bulk collect
         into l_depts
         from dept
       for i in l_depts.first .. l_depts.last
       loop
          dbms_output.put_line (l_depts(i).deptno);
          dbms_output.put_line (l_depts(i).dname);
          dbms_output.put_line (l_depts(i).loc);    
       end loop;
    end;
    /

  • The main purpose of table T778T - Infotypes per object type

    What is the  main purpose of T778T - Infotypes per object type.
    How does it differ from other subdialogs/tables in T778V?
    Points will be awarded.
    Thanks
    Olekan Babatonde

    T778T -you can change the attributes of an infotype
    You can make the following settings:
    You can change the infotype names.
    You can assign infotypes to standard object types or to customer- specific object types.
    You can define another time constraint for an infotype.
    T778V -In this step, you make the settings that are required for creating relationships.
    You can make the following settings:
    You can create new relationships.
    You can control the response of the system (error messages, warnings, information) if the 100% mark is exceeded in the case of "weighted" relationships.
    You can show or hide the weighting percentage of a relationship and, if required, define additional data for a relationship. You can specify, for example, in the view 'Additional relationship info' whether the recursiveness
    You can define the object types that are allowed for each relationship and inverse relationship.
    You can set up external relationships.
    External relationships are relationships between external object types i.e. object types that are not stored in the PLOG database in Personnel Development and Planning. (See also the step "Maintain object types").
    You can enter a time constraint for each relationship.
    You can change the "alias" name (semantic abbreviation) of a relationship.

Maybe you are looking for

  • Training and Event Management booking date

    Hi, I am working on Training and Event Management cube 0PE_C01. One of the requirements of a query is to show the booking date of the course. I have looked in business content for other cubes i have checked info object and 0event, i have also checked

  • Can't turn my iPod OFF!

    For the last week or so my iPod won't turn off, which is a bit of a twist on the regular "I can't turn my iPod on" posts. Until now it would turn itself off after about five minutes unused, or I could turn it off by holding down play/pause, but now i

  • Image sizing after using extractor in PE 4

    I have been using extractor to eliminate backrgounds and then dragging and dropping the foreground onto another background. The problem is that sometimes the foreground image is either too large or too small for the background chosen. Is there a way

  • Plug-ins from ps to cc ps

    I have a plug-in for creating my blog posts currently operating with my PS on a laptop. I want to move over to CC but I don't know if the plug in will work. Will it and how do you maintain plug-ins in something that isn't physically there on your com

  • Exported jpegs not read by CS2

    When I export a jpeg to my desktop at level 7, 480x480 size, Preview and Bridge can see it, but Photoshop CS2 cannot open it. I get this message: Could not complete your request because of a program error. Is this normal? Roger