About Object Types

Hi, may someone help me please. I am converting a Firebird base to oracle, and I had one problem because such Firebird base use Domains (that would be a user data type) for every table. So I created Object types on Oracle very seems with Firebird domains and try to create a table, when I define a colunm that is Object type to be Primary Key I got a message ORA-02329 column of datatype ADT cannot be unique or a primary key. Is there some way to create a primary key with Object Data Tipe ?

Dear,
Generally it is not a good idea at all to create tables having column that are defined as object type or collection. This is because of the hidden work done by Oracle behind the scene and that you will not be informed on. You will be confronted to performance problem and in some occasions to lock and deadlocks
It is instead advisable to use object types and collection into PL/SQL
Hope this helps
Mohamed Houri

Similar Messages

  • OSB to Object Types: difference between NULL value and not available

    Hello all,
    I have a question about Object Types. More specifically, how to differentiate between an empty value (null) and a string not available.
    This is my case:
    I have created an object type with three parameters.
    CREATE OR REPLACE TYPE OSB_EMP_OBJ_TYPE AS OBJECT
    (EMP_ID NUMBER
    ,DEPT_ID NUMBER
    ,ORDER_ID NUMBER
    ,CONSTRUCTOR FUNCTION OSB_EMP_OBJ_TYPE
    RETURN self as result
    /I would like to see what happens when I put an empty string into emp_id, NULL into DEPT_ID and nothing into ORDER_ID.
    To do so I have this test script:
    declare
      p_emp OSB_EMP_OBJ_TYPE := OSB_EMP_OBJ_TYPE();
    begin
      p_emp.EMP_ID := '';
      p_emp.DEPT_ID := null;
    --  p_emp.ORDER_ID := null;
      if p_emp.EMP_ID is null
      then
        dbms_output.put_line('Empty');
      end if;
      if p_emp.DEPT_ID is null
      then
        dbms_output.put_line('NULL');
      end if;
      if p_emp.ORDER_ID is null
      then
        dbms_output.put_line('Not available');
      end if;
    end;The result of this is:
    Empty
    NULL
    Not availableIt seems that Oracle treats all three situations alike. What I would like to achieve is a way to see that p_emp.ORDER_ID was not initialized.
    To elaborate a bit: in our production system this procedure would be called from OSB and the object type would by the input for that procedure. Our database version is 10.2.0.5.0.
    Our procedures look something like this:
    procedure p_procedure ( p_emp in osb_emp_obj_type )
    is
    begin
      do_something;
    end;Can anyone tell me if there is a way to achieve this, so I can see whether or not a value in the object type was filled?
    Thanks in advance!

    Darn...
    Eventually we want to use this for an update procedure. The client gets all current data from the database by calling a webservice that (using OSB) selects the data from our database. What we want to achieve is that the client can update that data, by returning only the changed fields to an update procedure.
    We then handle an empty tag to update the field to null, and we ignore missing tags.
    OSB itself can handle this, but PL/SQL can't.
    I'm now thinking of adding an indicator to each optional field (clear_field_yn). OSB can still check for empty tags or missing tags. When a tag is empty, it's corresponding indicator will be set to 'Y'. If the tag is missing, then it will be set to 'N'.
    Is that a solution to consider, or is there a much simpler approach possible?

  • How could I retrieve metadata about Array Type and Table Type?

    I use DatabaseMetaData.getUDTs() method for obtain metadata about Object Types, but this method doesn't work with Array Type and Table Type.

    JJ,
    Go into the diagrams of the DBTools List Columns and DBTools Get Properties respectively. When you inspect this diagram, you will see the raw ActiveX properties and methods called to get the size information. The value of -1 means the requested recordset is already closed. This is the sort of thing that is controled by the driver (ODBC, OLE DB, Jet, etc) you are using. Notice that you can right click on the property and invoke nodes and get more information about these specific items directly from the ADO online help.
    Crystal

  • E5 - unable to open. object type not supported

    hi. 
    2 Month back i brought Nokia E-5 Mobile and after few weeks i upgraded the Memory from 2Gb to 8GB. After copying all files from 2gb to 8gb am not able to open or install any existing programs and files. Even maps are not working. When trying to open or install the files am getting this erro " unable to open object type not supported " . Kindly help on this error.
    Thanks
    Velavan

    I have never attempted what you did, so can't say for certain, but I don't think memory card data is meant to be copied from one card to another (unless we're talking about data files like pictures or mp3's).  I don't understand what you mean by being unable to install files.  Are you trying to reinstall the programs that aren't working?  If your 2GB card still works normally, I suggest you format the 8 GB card, reinstall the programs to the empty card, and re-download the maps data.  If the programs still give you trouble, you may need to uninstall them from the 2 GB card first, but I don't think that should be necessary.  I hope that helps.

  • S/A bridge problem: No object type found for the message

    Hi all,
    I've been spending days looking into the following problem. I have a RFCXIFile scenario. The R3 system sends data via an RFC to XI and XI post the data as a flat file on a certain server using FTP.
    This scenario worked just fine for 1 exception. I could only run this scenario once. The second time I got timeouts when checking the data sent to my RFC destination using SM58. When I reactivated my RFC communcation channel I could again send 1 RFC to the system. All subsequent tries would fail.
    I guess this is due to the fact that I use a synchonous call (RFC) to an asynchronous one. Thus the adapter is still waiting for the response from the XI system and will not accept any further new calls from R3.
    So I figure let's use this pattern called the S/A bridge. So I designed everything according to guides and examples and I'm quite certain everything is configured right but when I run the scenario I get the following message:
    <i> <!--  Call Adapter
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIAdapter</SAP:Category>
      <SAP:Code area="BPE_ADAPTER">UNKNOWN_MESSAGE</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>No object type found for the message. Check that the corresponding process is activated</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error></i>
    It seems that the adapter cannot find any integration process to send the message into!?
    I've looked at numerous threads on sdn and tried all kinds of stuff (looked at the cache==> code 0 = OK , tried to reactivate my integration process, checked the interface determination,...), but to no avail. Does anybody has an idea what could be wrong ?
    Any help would be greatly appreciated for I'm all out of clues....
    Bob

    First of all, Thank you for trying to help me out here.
    Some answer to your suggestions/questions:
    The IP has return code 0 in SXI_CACHE. so that doesn't seem to be the problem.
    I've checked the BPM for syntax errors. I doesn't have any.
    I've reimported the BPM into the integration directory.
    And did a full cache refresh in SXI_CACHE. Return code is (stays) zero, so that's OK.
    I've already included the error message from SXI_MONI. It is in the last step ("Call Adater") that the error occurs.
    The other steps execute just fine...
    The RFC communcation channel accepts the incoming RFC call and puts into the pipeline, so no problems with the communication channel either. the problem is actually when the pipeline is trying to forward the message into an IP trhough the BPE_ADAPTER (according to SXMB_MONI).
    Therefore I'm not able to go to into PE, because the workflow is never started. the BPE_ADAPTER does not find any active process for the interface determination i've entered.
    So i can not debug the IP in the PE and check container variables, like some of you mentioned.
    Maybe some more information about the scenario:
    The RFC is called from an R3 system to XI over the interface "CONTROL_RECIPE_DOWNLOAD", which is an imported RFC, with a request and response message type.
    Then I got a receiver and interface determination with lead the incoming RFC message to the IP, into interface "XI_ERP_MF_MD_CONTROL_RECIPE_REQ_AI_MI".
    This is an abstract synchronous interface based on the request and response types of the "CONTROL_RECIPE_DOWNLOAD" imported RFC.
    This interface is used the first step (receive) of my BPM as the synchronous interface to open the S/A bridge.
    The message (container var)  used in this step is
    name: CORREQ
    Category: Abstract interface
    type: "XI_ERP_MF_MD_CONTROL_RECIPE_REQ_AI_MI"
    The interface "XI_ERP_MF_MD_CONTROL_RECIPE_REQ_AI_MI" is an abstract, asynchronous interface based on the request type of the "CONTROL_RECIPE_DOWNLOAD".
    Then there are 2 send steps for putting the flat files into place and finally i close the the S/A bridge using message:
    name: CORRES
    Category: Abstract interface
    type: "XI_ERP_MF_MD_CONTROL_RECIPE_RES_AI_MI"
    The interface "XI_ERP_MF_MD_CONTROL_RECIPE_RES_AI_MI" is an abstract, asynchronous interface based on the response type of the "CONTROL_RECIPE_DOWNLOAD".
    I hope this information gives you guys a better understanding of hte problem.
    Really looking forward to see more suggestions and to solve this nasty problem ...
    Regards,
    Bob

  • 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?

  • How to include the ordinary program in the BOR object type program

    Hi Guys, while i am trying to include a program in the BOR object type program. It is showing the following error:
    "Statement 'INCLUDE Z_ERC_SEARCH_VALOFACT_MACRO .' is not permitted in BOR".
    then, i tried to add  "<" and ">" to enclose it, but it wants the access key to create it.   anyone knows how to add the ordinary program in the BOR object type program.

    It's correct that we CAN'T insert our INCLUDES in BOR program. We CAN only use TYPE-POOLS there. So you can create Type Group with TYPES, CONSTANTS and DEFINE statements, and then use them in BOR programs.
    Using DEFINE you can construct MACROs with parameters and call your code there. It's limited, and not the easiest way, but some things can be achieved this way. Also forget about using Code Patterns while editing Type Group.
    Note: Use TYPE-POOLS statement after INCLUDE statement in BOR program .
    Best regards,
    Tomas.

  • Problem Instanciating BO - No default attribute defined for the object type

    Hello Experts,
    I am instanciating the BO BUS2038 to ZBUS2038 and when I click in u201Cto implementedu201D and follow u201Cto releasedu201D the message No default attribute defined for the object type is appearing!
    Can anybody help, please?

    Hello everyone,
    it appears to me, that no one has a clue about the "default attribute" and is widely guessing what can be done about that.
    I feel deeply sorry for that, Marcos.
    At first: You don't really need to care about the missing default attribute. If it's missing, the object's instance key will be used instead. Skip the warning message.
    Secondly: The default attribute is used to display the instance within the "Object links & Attachments" under the work item preview when using the SAP Business Workflow.
    Thirdly: You can select any existing attribute of your business object type to be the default attribute, by navigating to the "Basic data" (it's the heat-icon within the object builder), use tab "Defaults" and use the Input Help on the field "Attribute".
    There you'll go.
    Best wishes,
    Florin

  • Object Type Problem

    Hi
    I faced some problems with O8(Release 8.0.5.0.0) object types.
    Look at the following definition:
    CREATE TYPE T_JMJX AS OBJECT( LBNO NUMBER(3),...);
    CREATE TYPE LIST_JMJX AS TABLE of T_JMJX;
    CREATE TABLE JXGC.JMJXJL
    (JMJX LIST_JMJX,...)
    NESTED TABLE JMJX STORE AS N_JMJXJL;
    One day when I opened Schema Manager,I got a shock: TABLE JXGC.JMJXJL
    has four colunms with the same name !!
    name     schema datatype
    JMJX     none LIST_JMJX
    JMJX     none LIST_JMJX
    JMJX     none LIST_JMJX
    JMJX     JXGC LIST_JMJX
    And I query USER_TAB_COLUMNS, it do have 4 records.
    But in SQL*Plus I type 'decs JMJXJL',the column JMJX appears only once.
    Other tables that has object type columns face the same problem.
    This doesn't has any infection on my applications.
    The real problem comes when one day I want to move the user JXGC to an
    other server.
    Export was done successfully but has a curious phenomenon:
    Exporting NJMJXJL(the Nested Table)......19678 Exported
    The number of rows Exported is about four times than the rows it
    should has.
    When Impport goes to the tables that have object type columns ,I got
    the following errors:
    Importing Table JMJXJL ........
    IMP-00009: abnormal end of export file
    Import terminated successfully with warnings.
    Please help me to solve this problem.Thanks a lot!

    Stone,
    You need to go to metalink.oracle.com to file an iTAR on this.
    Regards,
    Geoff
    Hi
    I faced some problems with O8(Release 8.0.5.0.0) object types.
    Look at the following definition:
    CREATE TYPE T_JMJX AS OBJECT( LBNO NUMBER(3),...);
    CREATE TYPE LIST_JMJX AS TABLE of T_JMJX;
    CREATE TABLE JXGC.JMJXJL
    (JMJX LIST_JMJX,...)
    NESTED TABLE JMJX STORE AS N_JMJXJL;
    One day when I opened Schema Manager,I got a shock: TABLE JXGC.JMJXJL
    has four colunms with the same name !!
    name     schema datatype
    JMJX     none LIST_JMJX
    JMJX     none LIST_JMJX
    JMJX     none LIST_JMJX
    JMJX     JXGC LIST_JMJX
    And I query USER_TAB_COLUMNS, it do have 4 records.
    But in SQL*Plus I type 'decs JMJXJL',the column JMJX appears only once.
    Other tables that has object type columns face the same problem.
    This doesn't has any infection on my applications.
    The real problem comes when one day I want to move the user JXGC to an
    other server.
    Export was done successfully but has a curious phenomenon:
    Exporting NJMJXJL(the Nested Table)......19678 Exported
    The number of rows Exported is about four times than the rows it
    should has.
    When Impport goes to the tables that have object type columns ,I got
    the following errors:
    Importing Table JMJXJL ........
    IMP-00009: abnormal end of export file
    Import terminated successfully with warnings.
    Please help me to solve this problem.Thanks a lot!

  • Passing Object types using JDBC

    I need to pass Oracle user-defined object types in and out of
    PL/SQL stored procedures. Is this possible???
    Thanks
    null

    Hi Tina,
    I just had another thought. JDBC for 8.0 doesn't support
    user-defined SQL types. This feature isn't implemented until 8i.
    Sorry about the false lead!
    So you'd have to wrapper your object in another PL/SQL method
    which 'explodes' the user-defined type, as:
    procedure can_call_from_jdbc (ename varchar2, empno number, ...)
    is...
    begin
    call my_procedure(employee_t(ename, empno, ...));
    end;
    Pierre
    Oracle Product Development Team wrote:
    : Hi Tina,
    : Yikes! I'm glad you asked; it made me realize that some info
    : that's supposed to be posted on our external site is missing.
    I
    : think it'll take about a week to push this to our external
    site.
    : I'll try to find you a version and email it to you directly.
    : Thanks!
    : Pierre
    : Tina Creighton (guest) wrote:
    : : I'm currently using version 8.04 with Objects option, I'm
    : trying
    : : to locate the oracle.jpub class. Is there a way to download
    : the
    : : new jdbc that works with objects. Thanks. Tina
    : : Oracle Product Development Team wrote:
    : : : Absolutely!
    : : : the easiest thing is first to use JPub to generate a Java
    : : object
    : : : which is an analogue to the SQL object you have. For
    : example,
    : : : if your SQL object is called 'EMPLOYEE_T', you can invoke
    : JPub
    : : : with:
    : : : $ jpub -sql=employee_t -url=jdbc:oracle:oci8:@
    : : -user=scott/tiger
    : : : or even
    : : : $ java oracle.jpub.Main -sql=employee_t
    : -url=jdbc:oracle:oci8:@
    : : : -user=scott/tiger
    : : : This'll give you a Java class used to represent Java
    : instances
    : : of
    : : : the SQL 'employee_t', featuring friendly setters and getter
    : for
    : : : the fields.
    : : : If you have PL/SQL programs which take arguments of type
    : : : employee_t, such as:
    : : : PROCEDURE P1 (N NUMBER, E EMPLOYEE_T) IS...
    : : : PROCEDURE P2 (N NUMBER, E OUT EMPLOYEE_T) IS...
    : : : PROCEDURE P3 (N NUMBER, E IN OUT EMPLOYEE_T) IS...
    : : : You can call them in a SQLJ program as:
    : : : main () {
    : : : employee_t e; // the class generated by JPub
    : : : #sql {call P1(1, :e);}
    : : : #sql {call P2(2, :out e);}
    : : : #sql {call P3(3, :in out e);}
    : : : to call your three PL/SQL procedures. After the call to P2
    : and
    : : : P3, your
    : : : variable 'e' will be populated with the contents of the new
    : : : employee_t value
    : : : that was output from the PL/SQL method.
    : : : (SQLJ is just a shorthand way of calling JDBC. SQLJ
    programs
    : : are
    : : : translated
    : : : into SQLJ programs by calling the "SQLJ Translator":
    : : : $ sqlj myfile.sqlj
    : : : Pierre
    : : : Tina creighton (guest) wrote:
    : : : : I need to pass Oracle user-defined object types in and
    out
    : of
    : : : : PL/SQL stored procedures. Is this possible???
    : : : : Thanks
    : : : Oracle Technology Network
    : : : http://technet.oracle.com
    : Oracle Technology Network
    : http://technet.oracle.com
    Oracle Technology Network
    http://technet.oracle.com
    null

  • Member function and member procedure inside an object type in Oracle.

    Hi All,
    Please do have a look at these codes and help me understand. I have no idea about this member function and member procedure. How do they work? Please explain me about this.
    Regards,
    BS2012
    create type foo_type as object (
      foo number,
      member procedure proc(p in number),
      member function  func(p in number) return number
    create type body foo_type as
      member procedure proc(p in number) is begin
        foo := p*2;
      end proc;
      member function func(p in number) return number is begin
        return foo/p;
      end func;
    end;
    /

    Methods are just like functions or procedures in a package, except they're not in a package, their part of an object type.
    The object has attributes (which are the variables declared in it).
    To use such an object you would do things like this...
    SQL> set serverout on
    SQL>
    SQL> declare
      2    v_foo foo_type;
      3    v_val number;
      4  begin
      5    v_foo := foo_type(20); -- instantiate the object and initialize the object attributes
      6    v_foo.proc(20); -- call the object method (proc)
      7    v_val := v_foo.func(4); -- call the object method (func)
      8    dbms_output.put_line(v_val);
      9  end;
    10  /
    10
    PL/SQL procedure successfully completed.The Type definition you've declared creates the object class, but not actually an object itself.
    To actually have an object you need to declare a variable of that object class type, and then instantiate it. When you instantiate the object you need to initialize all the attributes (generally you can pass null if required for each of them to initialize them).
    Once you have your object instantiated, you can call the methods within that object as demonstrated above, a bit like calling functions and procedures in a package, except they are methods within the object type itself, and therefore called directly by referencing them from the variable.
    The documentation goes into a lot more detail of objects if you look it up.

  • How to Create Object Type

    Hi.
    I am Creating Task i found options ... Object Type and  method .. i think we can use user define/Created .. my question is what T Code is to create New Object type and method ...  and further help or suggestion about its development
    Regards
    Amamd

    Hi,
    You should try to use Standard BO. Go to tcode SWO1 and you can do a search related to your requirements. If it exists a BO but it doesn't fullfill your requirements you can create a subtype of this BO by menu Settings > Delegate. In this way, you can inherit all of the BO and create your owns.
    Regards,

  • XDB Native Web Services - Collection of object types

    Hello,
    my DB 11g (11.1.0.6.0) is enabled to use XDB Native Web Services, everything works as it should. I already use it successfully to publish a web service with object types as OUT parameter. They are created as complex types in the XML response as described here: [http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_web_services.htm#CHDGBFID]
    But what I need is a collection of these object types, e.g.
    I have a type FLIGHT with some information elements (departure, arrival, date, time, price) and I have a web service function GET_AVAILABILITY with parameters departure, arrival and date. What I want is to return a collection of FLIGHT objects, it could be none, one or many flights for a request.
    For the moment I create another object type which contains a fix number of FLIGHT objects to work around the collection issue:
    create flight_tab_typ as object (
    fl1 flight_typ
    ,fl2 flight_typ
    ,fl3 flight_typ
    I tried to build a PL/SQL table of object type and also a VARRAY of object type but for both the WSDL of the web service cannot be build up correctly in the web browser. For me it seems that this is not supported by the Native Web Services.
    I know I can build up my own XMLTYPE with XML structure as OUT parameter but to use object types is much easier and it builds up the XML structure automatically.
    Does anybody know how to use collections (VARRAY or PL/SQL Tables) with the Native XML DB Web Services?
    Thanks,
    Andreas

    Hi flea,
    I use complex types with XDB native webservices. Here is an example. Using people/groups objects. I haven't compiled this so there may be some typos etc, but it should give you the idea.
    Beware!I have had problems with the created WSDL file in that it doesn't always include the namespace from all types. In many client packages ( JDevloper , SOAPUI etc) this causes a wsdl import failure.
    You can add the missing namespace by hand a load the WSDL file locally and then it should work. I haven't raised an SR with Oracle about this yet.
    Assume you create the following under SCoTT schema on machine host.com on port 8080.
    The webservice[WSDL] will be available from
    http://host.com:8080/orawsv/SCOTT/WEBSERVCIES/GET_GROUP[?wsdl]
    For other peoples sanity it took me a little while to realise the WSDL url is case specific. E.g. the schema, package and functions have to be UPPER case.
    create table people_groups_tab (group_name varchar2(40 char),first_name varchar2(40 char),last_name varchar2(40 char))
    insert into people_groups_tab values ('FINANCE','Joe','Bloggs')
    insert into people_groups_tab values ('FINANCE','Bob','Jones')
    insert into people_groups_tab values ('IT','Alan','Andrews')
    create or replace type person_obj
    as object
         first_name people_groups_tab.first_name%type
         ,last_name people_groups_tab.last_name%type
    create or replace type people_obj
    as table of person_obj
    create or replace type people_groups_obj
    as object
    group_name varchar2(40 char)
    people people_obj
    create or replace package webservices
    as
              function get_group
         p_group_name varchar2
              ) return people_groups_obj;
    end;
    create or replace package body webservices
    as
              function get_group
         p_group_name varchar2
              ) return people_groups_obj
    as
    l_group people_groups_obj;
              l_people people_obj;
    begin
              select person_obj
                        first_name
                        ,last_name
              bulk collect into l_people
              from people_groups_tab
              where group_name p_group_name;
              l_group := people_groups_obj(p_group_name,l_people);
              return l_group;
    end;
    end;
    /

  • Modifying Object type

    Hi
    How do I modify object type without droping table containing that object?
    Thanks a lot

    You haven't given a great deal of information about which version of Oracle you're talking about.
    However the simple answer is if it's not version 9i then you're going to have huge problems with object evolution, no version prior to 9i has allowed you to easily modify an object and maintain any data in associated object tables (there ARE horrendous workarounds but if you can move to 9i it WILL save you a tremendous amount of headaches/hacks).
    John.

  • Need some help on procedure calling procedure using object type reg

    dear all,
    i need to test one procedure by passing only one value but how do i pass single value. i am showing the details of few section on which i am working on. here is few details about the package.
    Description: package pkj_emp contains two procedure pkj_emp and procedure proc_rem.
    purpose:based on passing dname values to procedure pkj_emp, cursor cur_emp will fetch empid from emp table and then we are passing 4 empid records to procedure proc_rem using empid object type.Inside the procedure proc_rem it will delete all 4 records of table A,B,C and D at one short.
    Requirement:i need to test for only one value that means is it possible i can pass only one value using the cursor cur_emp.
    create or replace package pkj_emp
    TYPE obj_emp IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    procedure proc_emp(empid obj_emp);
    create or replace package body pkj_emp
    as
    procedure(
    dname varchar2;
    as
    cursor cur_emp is select emp_id from emp a,dept d
    where a.deptid=d.deptid
    and d.deptname=dname;
    begin
    count:=0;
                   for cur_emp_rec in cur_emp LOOP
                   empid(count) := cur_emp_rec.emp_id;
              IF (count = 4) THEN
                   proc_rem(empid); // calling another procedure
                   commit;
                   END IF;
                   count := count + 1;
                   END LOOP;
    end;
    proc_rem(
    empid obj_emp;
    is
    begin
    delete from A where emp_id in (empid(0),empid(1),empid(2),empid(3));
    delete from B where emp_id in (empid(0),empid(1),empid(2),empid(3));
    delete from c where emp_id in (empid(0),empid(1),empid(2),empid(3));
    delete from d where emp_id in (empid(0),empid(1),empid(2),empid(3));
    end;
    regards
    Laxman

    You have hardcoded your IN LIST in the REM procedure. I recommend changing the code to take a variable number of inputs. You could do something like the following:
    SQL> CREATE TABLE A (ID NUMBER);
    Table created.
    SQL> CREATE TABLE B (ID NUMBER);
    Table created.
    SQL> CREATE TABLE C (ID NUMBER);
    Table created.
    SQL> CREATE TABLE D (ID NUMBER);
    Table created.
    SQL> INSERT INTO A VALUES(7566);
    1 row created.
    SQL> INSERT INTO B VALUES(7902);
    1 row created.
    SQL> INSERT INTO C VALUES(7876);
    1 row created.
    SQL> INSERT INTO D VALUES(7369);
    1 row created.
    SQL> CREATE OR REPLACE TYPE EMP_TYPE AS TABLE OF NUMBER(4);
      2  /
    Type created.
    SQL> CREATE OR REPLACE PACKAGE PKJ_EMP
      2  AS
      3          PROCEDURE PKJ_EMP
      4          (
      5                  DNAME   IN      SCOTT.EMP.DEPTNO%TYPE
      6          );
      7 
      8          PROCEDURE REM
      9          (
    10                  pEMPList  IN      EMP_TYPE
    11          );
    12  END PKJ_EMP;
    13  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY PKJ_EMP
      2  AS
      3          PROCEDURE PKJ_EMP
      4          (
      5                  DNAME   IN      SCOTT.EMP.DEPTNO%TYPE
      6          )
      7          AS
      8                  pEMPList        EMP_TYPE := EMP_TYPE();
      9                  i               NUMBER := 1;
    10          BEGIN
    11                  FOR r IN
    12                  (
    13                          SELECT  EMPNO
    14                          FROM    SCOTT.EMP
    15                          WHERE   DEPTNO = DNAME
    16                  )
    17                  LOOP
    18                          pEMPList.EXTEND;
    19                          pEMPList(i) := r.EMPNO;
    20 
    21                          i := i + 1;
    22                  END LOOP;
    23 
    24                  REM(pEMPList);
    25          END PKJ_EMP;
    26 
    27          PROCEDURE REM
    28          (
    29                  pEMPList  IN      EMP_TYPE
    30          )
    31          AS
    32          BEGIN
    33                  DELETE FROM A WHERE ID IN (SELECT   COLUMN_VALUE FROM TABLE(pEMPList));
    34                  DELETE FROM B WHERE ID IN (SELECT   COLUMN_VALUE FROM TABLE(pEMPList));
    35                  DELETE FROM C WHERE ID IN (SELECT   COLUMN_VALUE FROM TABLE(pEMPList));
    36                  DELETE FROM D WHERE ID IN (SELECT   COLUMN_VALUE FROM TABLE(pEMPList));
    37          END REM;
    38  END PKJ_EMP;
    39  /
    Package body created.
    SQL> EXEC PKJ_EMP.PKJ_EMP(20);
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM A;
    no rows selected
    SQL> SELECT * FROM B;
    no rows selected
    SQL> SELECT * FROM C;
    no rows selected
    SQL> SELECT * FROM D;
    no rows selected
    SQL> spool off;HTH!

Maybe you are looking for