Insertion using an Object

I have created an object with 4 Columns
create or replace object
emp_id     number
emp_name   varchar2
dept_id    number
emp_sal    number
)I will be getting the values input to the proc as
1,Apple,10,100000# 2,Ball,20,20000#3,Cat,30,300000I want to insert this in emp table which is of same structure.
How can I do that

Are you looking at something like this:
SQL> ed
Wrote file afiedt.buf
  1  create or replace type  my_emp_object as object
  2  (
  3  emp_id     number,
  4  emp_name   varchar2(100),
  5  dept_id    number,
  6  emp_sal    number
  7* )
SQL> /
Type created.
SQL> create table my_emp(emp_Det my_emp_object);
Table created.
SQL> ed
Wrote file afiedt.buf
  1* insert into my_emp VALUES(my_emp_object(1,'ABCD',10,10000))
SQL> /
1 row created.
SQL> ed
Wrote file afiedt.buf
  1* insert into my_emp VALUES(my_emp_object(2,'XYZW',20,12345))
SQL> /
1 row created.
SQL> select * from my_emp
  2  /
EMP_DET(EMP_ID, EMP_NAME, DEPT_ID, EMP_SAL)
MY_EMP_OBJECT(1, 'ABCD', 10, 10000)
MY_EMP_OBJECT(2, 'XYZW', 20, 12345)
SQL>
SQL> ed
Wrote file afiedt.buf
  1  create or replace procedure my_proc1(my_emp_obj my_emp_object) IS
  2  BEGIN
  3  INSERT INTO my_emp values(my_emp_obj);
  4  commit;
  5* end;
SQL> /
Procedure created.
SQL> exec my_proc1(my_emp_object(3,'QWERTY',30,12000));
PL/SQL procedure successfully completed.
SQL> select * from my_emp;
EMP_DET(EMP_ID, EMP_NAME, DEPT_ID, EMP_SAL)
MY_EMP_OBJECT(1, 'ABCD', 10, 10000)
MY_EMP_OBJECT(2, 'XYZW', 20, 12345)
MY_EMP_OBJECT(3, 'QWERTY', 30, 12000)
SQL>

Similar Messages

  • Inconsistent datatypes error when inserting into a object

    I am trying to insert some test data into the table emp.I have managed to succesfully create the objects and types but when I try to insert into the emp table I get a inconsistent datatypes error however I have checked the datatypes and they all seem fine. Can anyone help me.
    thanks
    CREATE OR REPLACE TYPE Address_T AS object
    (ADDR1                VC2_40,
    ADDR2               VC2_40,
    CITY_TX          VC2_40,
    COUNTY_CD          VC2_40,
    POST_CD          VC2_40);
    CREATE OR REPLACE TYPE PERSON_T AS OBJECT (
    LNAME_TX           NAME_T,
    FNAME_TX           NAME_T,
    BIRTH_DATE          DATE,
    TELEPHONE          VC2_20,
    EMAIL               VC2_40);
    CREATE OR REPLACE TYPE EMP_T AS OBJECT (
    EMP_ID     NUMBER (10),
    PERSON     PERSON_T,
    ADDRESS ADDRESS_T,
    HIRE_DATE DATE)
    CREATE TABLE EMP OF EMP_T
    (EMP_ID NOT NULL PRIMARY KEY);
    INSERT INTO EMP VALUES (1,           
    PERSON_T('PETCH',
    'GAVIN',
    '23-JAN-80',
    '(01964)550700',
    '[email protected]'),
    ADDRESS_T('67 CANADA',
    'WALKINGTON',
    'BEVERLEY',
    'EAST YORKSHIRE',
    'HU17 7RL'),
    '11-FEB-02'
    ERROR at line 1:
    ORA-00932: inconsistent datatypes

    Gavin,
    What is your VC2_40 and NAME_T type definition? Your insert used these as varchar2, which is a built-in type not a user-defined type. If you explicitly define these to be varchar2's, the insert statement works fine.
    Regards,
    Geoff
    I am trying to insert some test data into the table emp.I have managed to succesfully create the objects and types but when I try to insert into the emp table I get a inconsistent datatypes error however I have checked the datatypes and they all seem fine. Can anyone help me.
    thanks
    CREATE OR REPLACE TYPE Address_T AS object
    (ADDR1                VC2_40,
    ADDR2               VC2_40,
    CITY_TX          VC2_40,
    COUNTY_CD          VC2_40,
    POST_CD          VC2_40);
    CREATE OR REPLACE TYPE PERSON_T AS OBJECT (
    LNAME_TX           NAME_T,
    FNAME_TX           NAME_T,
    BIRTH_DATE          DATE,
    TELEPHONE          VC2_20,
    EMAIL               VC2_40);
    CREATE OR REPLACE TYPE EMP_T AS OBJECT (
    EMP_ID     NUMBER (10),
    PERSON     PERSON_T,
    ADDRESS ADDRESS_T,
    HIRE_DATE DATE)
    CREATE TABLE EMP OF EMP_T
    (EMP_ID NOT NULL PRIMARY KEY);
    INSERT INTO EMP VALUES (1,           
    PERSON_T('PETCH',
    'GAVIN',
    '23-JAN-80',
    '(01964)550700',
    '[email protected]'),
    ADDRESS_T('67 CANADA',
    'WALKINGTON',
    'BEVERLEY',
    'EAST YORKSHIRE',
    'HU17 7RL'),
    '11-FEB-02'
    ERROR at line 1:
    ORA-00932: inconsistent datatypes

  • Using Date objects in SQL statements

    Hi, I am wondering if it is possible to use Date objects while trying to retrieve entries from an access database with fields set as "Date/Time" fields, as opposed to "Text"? If so, do I need to reformat it before inserting it into the SQL statement, or can I just leave it as a Date object, and call up the variable name?
    For example - "SELECT * FROM database WHERE startDate = ' " + dateObject + ' ". And do i need quotes round this value?
    Thanks in advance.

    I had some problems by just fetching a date and pushing it back to a MS SQL Database.
    I used the following reformating step to fix it:
    if (o instanceof Timestamp)
    String time = o.toString().substring(8,10)+"."+o.toString().substring(5,7)+"."+o.toString().substring(0,4)+" "+o.toString().substring(11,19);
    ht.put(columnName, time);
    o is the object i receve from the select statement and ht is a Hashtable where i put my data.
    To write the data back i now can use:
    UPDATE table SET columnname = 'valueOfColumn'
    This means i use the value i created above in Quotes to write it back.
    Format of Timestamp.toString() is something like yyyy-mm-dd hh:mm:ss.xx
    Format used by MS SQL (and i think by Access to) 'dd.mm.yyyy hh:mm:ss'

  • Querying for a script insert multiple selected objects...

    Is there a script or plugin which insert multiple selected objects in one new text frame with one click?
    And is there a script or plugin which extract the content of anchored text frame out it's frame and replace it with it's frame. and extract selected text and insert it inside a new anchored text frame in it's place? (like convert text to table - convert table to text, but instead table we use text frame)

    Hi,
    Using OMB scripting to set attribute properties in a data mapping sort of defeats the purpose of utilizing a graphical user interface to define and set properties for a data mapping? Surely the GUI data mapping tool was created to get away from writing scripts and scripting would also require that you know the name of the data mapping, table operator and the set of attribute names for which you have to write one line of script to set each property value, i.e. 90 lines to set 90 attribute values.
    Cheers,
    Phil

  • How to use swf object

    Hi have been trying to get my head around how to use swf object, I know very little javascript and so am having difficulty in modifying the code to suit my needs.  This is my page which I have used dreamweaver cs3 and have used insert>media>flash and it is working well but does not validate.  I would really appreciate if somebody could write the exact html code I need to convert this to swf object.
    http://www.kimberleywebdesign.com.au/Links.html

    You should be able to just declare a variable outside of the onComplete function and assign it the loaded object when the file loads...
    var loadedSWF:MovieClip;
    function loadComplete(e:Event):void {
         removeChild(old_mc);
         addChild( DisplayObject(LoaderInfo(e.target).content) );
         loadedSWF = MovieClip(e.currentTarget.content);
    function doStuffToSWF(){
          loadedSWF.something....

  • How can i execute multiple database operations using multiple objects

    i have data in files which i need to read/parse and insert/update the database. can someone tell me how can i read multiple statements at a time and process using multiple objects.

    This doesn't seem like too much of a JDBC question or at least the answer as I see it isn't unique or specific to JDBC.
    If you want to run multiple processes within your single program then you need to use Java threads. I would recommend you read up on how to properly code Java threads and if you have questions unique to your multi-threaded JDBC implementation come back and ask those questions.
    You may also want tot take advantage of a transaction manager that includes a database connection pool that will handle most of the complexity for you. Depending on the flexibility of your architecture you may not have to do any thread coding at all when using a transaction manager.

  • ALV Tree Report without using ABAP Objects

    Hi all,
    I want to know the name of a function module to create ALV Tree in SE38 as a report. I am required to create this ALV Tree Report without using ABAP OBJECTS. Can u pls help me as early as possible.

    Hi
    see this link
    http://www.sapdev.co.uk/reporting/alv/alvtree.htm
    *& Report  ZBCALV_TREE
    REPORT  ZBCALV_TREE.
    class cl_gui_column_tree definition load.
    class cl_gui_cfw definition load.
    data tree1  type ref to cl_gui_alv_tree.
    data mr_toolbar type ref to cl_gui_toolbar.
    include <icon>.
    include bcalv_toolbar_event_receiver.
    include bcalv_tree_event_receiver.
    data: toolbar_event_receiver type ref to lcl_toolbar_event_receiver.
    data: gt_VBAK  type VBAK occurs 0,      "Output-Table
          gt_fieldcatalog type lvc_t_fcat, "Fieldcatalog
          ok_code like sy-ucomm.           "OK-Code
    start-of-selection.
    end-of-selection.
      call screen 100.
    *&      Module  STATUS_0100  OUTPUT
          text
    module STATUS_0100 output.
      SET PF-STATUS 'MAIN'.
    if tree1 is initial.
        perform Zinit_tree.
      endif.
      call method cl_gui_cfw=>flush.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Form  Zinit_tree
          text
    -->  p1        text
    <--  p2        text
    form Zinit_tree .
    perform Zbuild_fieldcatalog.
    create container for alv-tree
    data: l_tree_container_name(30) type c,
            l_custom_container type ref to cl_gui_custom_container.
      l_tree_container_name = 'TREE1'.
    if sy-batch is initial.
        create object l_custom_container
          exporting
                container_name = l_tree_container_name
          exceptions
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5.
        if sy-subrc <> 0.
          message x208(00) with 'ERROR'.                        "#EC NOTEXT
        endif.
      endif.
    create tree control
      create object tree1
        exporting
            parent              = l_custom_container
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
            item_selection      = 'X'
            no_html_header      = ''
            no_toolbar          = ''
        exceptions
            cntl_error                   = 1
            cntl_system_error            = 2
            create_error                 = 3
            lifetime_error               = 4
            illegal_node_selection_mode  = 5
            failed                       = 6
            illegal_column_name          = 7.
      if sy-subrc <> 0.
        message x208(00) with 'ERROR'.                          "#EC NOTEXT
      endif.
    create Hierarchy-header
      data l_hierarchy_header type treev_hhdr.
      perform zbuild_hierarchy_header changing l_hierarchy_header.
    create info-table for html-header
      data: lt_list_commentary type slis_t_listheader,
            l_logo             type sdydo_value.
      perform Zbuild_comment using
                     lt_list_commentary
                     l_logo.
    repid for saving variants
      data: ls_variant type disvariant.
      ls_variant-report = sy-repid.
    create emty tree-control
      call method tree1->set_table_for_first_display
        exporting
          is_hierarchy_header = l_hierarchy_header
          it_list_commentary  = lt_list_commentary
          i_logo              = l_logo
          i_background_id     = 'ALV_BACKGROUND'
          i_save              = 'A'
          is_variant          = ls_variant
        changing
          it_outtab           = gt_VBAK "table must be emty !!
          it_fieldcatalog     = gt_fieldcatalog.
    create hierarchy
      perform Zcreate_hierarchy.
    add own functioncodes to the toolbar
      perform zchange_toolbar.
    register events
      perform zregister_events.
    endform.                    " Zinit_tree
    *&      Form  Zbuild_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    form Zbuild_fieldcatalog .
    get fieldcatalog
      call function 'LVC_FIELDCATALOG_MERGE'
        exporting
          i_structure_name = 'VBAK'
        changing
          ct_fieldcat      = gt_fieldcatalog.
      sort gt_fieldcatalog by scrtext_l.
    change fieldcatalog
      data: ls_fieldcatalog type lvc_s_fcat.
      loop at gt_fieldcatalog into ls_fieldcatalog.
        case ls_fieldcatalog-fieldname.
          when 'AUART' .
            ls_fieldcatalog-no_out = 'X'.
            ls_fieldcatalog-key    = ''.
        endcase.
        modify gt_fieldcatalog from ls_fieldcatalog.
      endloop.
    endform.                    " Zbuild_fieldcatalog
    *&      Form  zbuild_hierarchy_header
          text
         <--P_L_HIERARCHY_HEADER  text
    form zbuild_hierarchy_header changing
                                   p_hierarchy_header type treev_hhdr.
      p_hierarchy_header-heading = 'Hierarchy Header'.          "#EC NOTEXT
      p_hierarchy_header-tooltip =
                             'This is the Hierarchy Header !'.  "#EC NOTEXT
      p_hierarchy_header-width = 30.
      p_hierarchy_header-width_pix = ''.
    endform.                    " zbuild_hierarchy_header
    *&      Form  Zbuild_comment
          text
         -->P_LT_LIST_COMMENTARY  text
         -->P_L_LOGO  text
    form Zbuild_comment   using
                           pt_list_commentary type slis_t_listheader
                           p_logo             type sdydo_value.
    data: ls_line type slis_listheader.
    LIST HEADING LINE: TYPE H
      clear ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY:  NOT USED FOR THIS TYPE
      ls_line-info = 'ALV-tree-demo: flight-overview'.          "#EC NOTEXT
      append ls_line to pt_list_commentary.
    STATUS LINE: TYPE S
      clear ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = 'valid until'.                             "#EC NOTEXT
      ls_line-info = 'January 29 1999'.                         "#EC NOTEXT
      append ls_line to pt_list_commentary.
      ls_line-key  = 'time'.
      ls_line-info = '2.00 pm'.                                 "#EC NOTEXT
      append ls_line to pt_list_commentary.
    ACTION LINE: TYPE A
      clear ls_line.
      ls_line-typ  = 'A'.
    LS_LINE-KEY:  NOT USED FOR THIS TYPE
      ls_line-info = 'actual data'.                             "#EC NOTEXT
      append ls_line to pt_list_commentary.
      p_logo = 'ENJOYSAP_LOGO'.
    endform.                    " Zbuild_comment
    *&      Form  Zcreate_hierarchy
          text
    -->  p1        text
    <--  p2        text
    form Zcreate_hierarchy .
    data: ls_vbak type vbak,
          lt_vbak  type vbak occurs 0.
    get data
      select * from vbak into table lt_vbak
                            up to 200 rows .                "#EC CI_NOWHERE
      sort lt_vbak by AUART.
    add data to tree
      data: l_AUART_key type lvc_nkey.
    loop at lt_vbak into ls_vbak.
        on change of ls_vbak-AUART.
          perform Zadd_AUART_line using   ls_vbak
                                  changing l_AUART_key.
        endon.
      endloop.
    calculate totals
      call method tree1->update_calculations.
    this method must be called to send the data to the frontend
      call method tree1->frontend_update.
    endform.                    " Zcreate_hierarchy
    *&      Form  Zadd_AUART_line
          text
         -->P_LS_vbak  text
         -->P_0379   text
         <--P_L_AUART_KEY  text
    form Zadd_AUART_line  using    p_ls_vbak type vbak
                                   p_relat_key type lvc_nkey
                         changing  p_node_key type lvc_nkey.
      data: l_node_text type lvc_value,
            ls_vbak type vbak.
    set item-layout
      data: lt_item_layout type lvc_t_layi,
            ls_item_layout type lvc_s_layi.
      ls_item_layout-t_image = '@3P@'.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      append ls_item_layout to lt_item_layout.
    add node
      l_node_text =  p_ls_vbak-AUART.
      data: ls_node type lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      call method tree1->add_node
        exporting
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_vbak
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        importing
          e_new_node_key   = p_node_key .
    endform.                    " Zadd_AUART_line
    *&      Form  zchange_toolbar
          text
    -->  p1        text
    <--  p2        text
    form zchange_toolbar .
    get toolbar control
      call method tree1->get_toolbar_object
        importing
          er_toolbar = mr_toolbar.
      check not mr_toolbar is initial.
    add seperator to toolbar
      call method mr_toolbar->add_button
        exporting
          fcode     = ''
          icon      = ''
          butn_type = cntb_btype_sep
          text      = ''
          quickinfo = 'This is a Seperator'.                    "#EC NOTEXT
    add Standard Button to toolbar (for Delete Subtree)
      call method mr_toolbar->add_button
        exporting
          fcode     = 'DELETE'
          icon      = '@18@'
          butn_type = cntb_btype_button
          text      = ''
          quickinfo = 'Delete subtree'.                         "#EC NOTEXT
    add Dropdown Button to toolbar (for Insert Line)
      call method mr_toolbar->add_button
        exporting
          fcode     = 'INSERT_LC'
          icon      = '@17@'
          butn_type = cntb_btype_dropdown
          text      = ''
          quickinfo = 'Insert Line'.                            "#EC NOTEXT
    set event-handler for toolbar-control
      create object toolbar_event_receiver.
      set handler toolbar_event_receiver->on_function_selected
                                                          for mr_toolbar.
      set handler toolbar_event_receiver->on_toolbar_dropdown
                                                          for mr_toolbar.
    endform.                    " zchange_toolbar
    *&      Form  zregister_events
          text
    -->  p1        text
    <--  p2        text
    form zregister_events .
    define the events which will be passed to the backend
      data: lt_events type cntl_simple_events,
              l_event type cntl_simple_event.
    define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_click.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
      append l_event to lt_events.
      call method tree1->set_registered_events
        exporting
          events                    = lt_events
        exceptions
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      if sy-subrc <> 0.
        message x208(00) with 'ERROR'.                          "#EC NOTEXT
      endif.
    set Handler
      data: l_event_receiver type ref to lcl_tree_event_receiver.
      create object l_event_receiver.
      set handler l_event_receiver->handle_node_ctmenu_request
                                                            for tree1.
      set handler l_event_receiver->handle_node_ctmenu_selected
                                                            for tree1.
      set handler l_event_receiver->handle_item_ctmenu_request
                                                            for tree1.
      set handler l_event_receiver->handle_item_ctmenu_selected
                                                            for tree1.
    endform.                    " zregister_events
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module USER_COMMAND_0100 input.
    ok_code  = sy-ucomm.
    clear sy-ucomm.
    case ok_code.
        when 'EXIT' or 'BACK' or 'CANC'.
          perform Zexit_program.
        when others.
          call method cl_gui_cfw=>dispatch.
      endcase.
      clear ok_code.
      call method cl_gui_cfw=>flush.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  Zexit_program
          text
    -->  p1        text
    <--  p2        text
    form Zexit_program .
      call method tree1->free.
      leave program.
    endform.                    " Zexit_program
    <b>Reward if usefull</b>

  • Inserting non-serializable objects

    Is there any way to insert non-serializable objects into a database? (Or to convert them to bytes?)

    Is there any way to insert non-serializable objectsinto a database?
    A joke right?No, it's not a joke. It would be a pretty bad one if it were.
    Yes, there is a way. Create a table that corresponds
    to the object where each attribute in the object
    corresponds to field in the object. Add a unique key
    if one doesn't exist.I wish it were that simple. I don't have access to those attributes...
    >
    To create an object insert a row into the table. To
    load the object use the unique key to query for the
    row. To 'delete' the object delete the row from the
    table.BTW, the object in question is the java.awt.geom.Area object (http://java.sun.com/j2se/1.3/docs/api/java/awt/geom/Area.html ).
    The only way I can think of to insert an object that doesn't map to a SQL type is to convert it to bytes through serialization, and insert it as RAW data.
    I've extended Area to add a name and made my class serializable. However, since Area is not serializable, the only data I can retrieve after deserializing is the name I added (from my understanding of serialization, I have to save Area's data myself, but can't since I don't have access to it, so the deserialization process calls the Area() constructor which initializes the object to empty).

  • Create a user and use  the objects of another Shema

    Hi all oracle`s gurus
    i need a little help .....
    i, create a shema named "a" that the owner is user_dba and here there are all objects of the aplication but i want all other users of the app can use those objects; the users are created in the database ,
    Thanks

    I would be very leary about granting privileges to PUBLIC, particularly privileges other than SELECT, because most systems end up getting a few special-purpose accounts that shouldn't see everything.
    The standard approach is
    - Create a role
    CREATE ROLE my_application_role;- Grant appropriate privileges to that role. This generally takes the form of a PL/SQL block initially
    BEGIN
      FOR x IN (SELECT * FROM dba_tables WHERE owner = <<schema owner>>)
      LOOP
        EXECUTE IMMEDIATE
          'GRANT select, insert, update, delete ' ||
          '    ON <<schema owner>>.' || x.table_name ||
          '    TO my_application_role';
      END LOOP;
    END'- Grant that role to the user(s) that will be connecting to the database,
    GRANT my_application_role TO some_user- Create appropriate public synonyms for the various objects. Again, this can be a PL/SQL block and can be combined with the block that grants privileges
    BEGIN
      FOR x IN (SELECT * FROM dba_tables WHERE owner = <<schema owner>>)
      LOOP
        EXECUTE IMMEDIATE
          'CREATE PUBLIC SYNONYM ' || x.table_name ||
          '    FOR <<schema owner>>.' || x.table_name;
      END LOOP;
    END'As an alternative to public synonyms, you can set the CURRENT_SCHEMA attribute (potentially in a login trigger) to SCHEMA_OWNER when the users you want to access these objects log in.
    Justin

  • Problem inserting XML into object view

    Hi all,
    My environment is :
    Windows NT 4.0
    Oracle 8i 8.1.5
    (NLS_CHARACTERSET = EL8MSWIN1253)
    Apache 1.3.11 Web Server
    Apache JServ 1.1
    XSQL v 0.9.9.1 and XML parser for Java v2,
    XMLSQL that come with it
    I've created an object view as following :
    create table schedules (
    schedule_id varchar2(20),
    description varchar2(100),
    constraint pk_schedule_id primary key (schedule_id)
    create table schedule_details (
    schedule_id varchar2(20),
    starting_time date,
    duration number,
    constraint pk_schedule_dtls primary key (schedule_id, starting_time),
    constraint fk_schedule_id foreign key (schedule_id) references schedules (schedule_id)
    create or replace type schedule_detail_t as object (
    starting_time varchar2(20),
    duration number
    create or replace type schedule_detail_list as table of schedule_detail_t;
    create or replace type schedule_details_t as object (
    schedule_id varchar2(20),
    description varchar2(100),
    details schedule_detail_list
    create or replace view schedule_details_view of schedule_details_t
    with object OID (schedule_id)
    as select schedule_id, description,
    cast(multiset(select schedule_detail_t (to_char(starting_time, 'hh24:mi'), duration) as Detail
    from schedule_details
    where schedule_details.schedule_id = schedules.schedule_id
    ) as schedule_detail_list )
    from schedules;
    And I'm trying to insert using putXML this
    <?xml version = "1.0" encoding = "ISO-8859-1"?>
    <ROWSET>
    <ROW>
    <SCHEDULE_ID>S1112</SCHEDULE_ID>
    <DESCRIPTION>Working 08:00 to 20:00</DESCRIPTION>
    <DETAILS>
    <DETAILS_ITEM>
    <STARTING_TIME>08:00</STARTING_TIME>
    <DURATION>12</DURATION>
    </DETAILS_ITEM>
    </DETAILS>
    </ROW>
    </ROWSET>
    The error I get is
    oracle.xml.sql.OracleSQLXMLException:
    non supported oracle-character-set-174
    Note: no rows have been inserted
    at oracle.xml.sql.dml.OracleXMLSave.insertXML
    When I'm posting using XSQL the XML doesn't get inserted with no error message.
    But when I try this for a change
    <?xml version = "1.0" encoding = "ISO-8859-1"?>
    <ROWSET>
    <ROW>
    <SCHEDULE_ID>S1111</SCHEDULE_ID>
    <DESCRIPTION>Working 08:00 to 20:00</DESCRIPTION>
    </ROW>
    </ROWSET>
    Trying to insert into table (this time) "schedules" using putXML it works ...
    It works on tables and it doesn't work on object views.
    Any piece of advice will be highly appreciated.
    Nick

    No known limitations. Please post the sample DDL to create your object types and object view, along with an example of the example XML document you're trying to insert.

  • Insert using parallel

    what does this last statement mean?  it is as though the query runs just like without any hints.
    oracle doc:
    Using Parallel Execution
    Examples of Distributed Transaction Parallelization
    This section contains several examples of distributed transaction processing.
    Example 1 Distributed Transaction Parallelization
    In this example, the DML statement queries a remote object:
    INSERT /* APPEND PARALLEL (t3,2) */ INTO t3 SELECT * FROM t4@dblink;
    The query operation is executed serially without notification because it references a remote object.

    Randolf,
    As far as I have a real db link why not test it myself  (see my questions at the end of this thread)
    SQL> insert /*+ append parallel(lcl) */ into local_tab lcl select /*+ parralel(dst) */ dst.* from distant_tab dst;
    51 rows created.
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    SQL_ID  1nhmuzb4ayq7x, child number 0
    insert /*+ append parallel(lcl) */ into local_tab lcl select /*+
    parralel(dst) */ dst.* from distant_tab dst
    Plan hash value: 2098243032
    | Id  | Operation        | Name          | Rows  | Bytes | Cost (%CPU)| Time     | Inst   |IN-OUT|
    |   0 | INSERT STATEMENT |               |       |       |    57 (100)|          |        |      |
    |   1 |  LOAD AS SELECT  |               |       |       |            |          |        |      |
    |   2 |   REMOTE         | distant_tab   |    51 |  3009 |    57   (0)| 00:00:01 | XLCL~  | R->S |
    Remote SQL Information (identified by operation id):
       2 - SELECT /*+ OPAQUE_TRANSFORM */ "DST_ID","NAME_FR","NAME_NL","DST_UIC_CODE","DST_VOI
           C_CODE","BUR_UIC_CODE","BUR_VOIC_CODE","INFO_NEEDED","TRANSFERRED","VALID_FROM_DATE",
        "VALID_TO_DATE","SORTING","SO_NEEDED" FROM "distant_tab" "DST" (accessing'XLCL_XDST.WORLD' )
    Let enable parallel DML and repeat the same insert
    SQL> alter session enable parallel dml;
    Session altered.
    SQL> insert /*+ append parallel(lcl) */ into local_tab lcl select /*+ parralel(dst) */ dst.* from distant_tab dst;
    51 rows created.
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    SQL_ID  1nhmuzb4ayq7x, child number 1
    insert /*+ append parallel(lcl) */ into local_tab lcl select /*+ parralel(dst) */ dst.* from distant_tab dst
    Plan hash value: 2511483212
    | Id  | Operation               | Name          | Rows  | Bytes | Cost (%CPU)| Time     | TQ/Ins |IN-OUT| PQ Distrib |
    |   0 | INSERT STATEMENT        |               |       |       |    57 (100)|          |        |      |            |
    |   1 |  PX COORDINATOR         |               |       |       |            |          |        |      |            |
    |   2 |   PX SEND QC (RANDOM)   | :TQ10001      |    51 |  3009 |    57   (0)| 00:00:01 |  Q1,01 | P->S | QC (RAND)  |
    |   3 |    LOAD AS SELECT       |               |       |       |            |          |  Q1,01 | PCWP |            |
    |   4 |     PX RECEIVE          |               |    51 |  3009 |    57   (0)| 00:00:01 |  Q1,01 | PCWP |            |
    |   5 |      PX SEND ROUND-ROBIN| :TQ10000      |    51 |  3009 |    57   (0)| 00:00:01 |        | S->P | RND-ROBIN  |
    |   6 |       REMOTE            | distant_tab   |    51 |  3009 |    57   (0)| 00:00:01 | XLCL~  | R->S |            |
    Remote SQL Information (identified by operation id):
       6 - SELECT /*+ OPAQUE_TRANSFORM */ "DST_ID","NAME_FR","NAME_NL","DST_UIC_CODE","DST_VOIC_CODE","BUR_UIC_COD
           E","BUR_VOIC_CODE","INFO_NEEDED","TRANSFERRED","VALID_FROM_DATE","VALID_TO_DATE","SORTING","SO_NEEDED"
           FROM "distant_tab" "DST" (accessing 'XLCL_XDST.WORLD' )
    SQL> select * from local_tab;
    select * from local_tab
    ERROR at line 1:
    ORA-12838: cannot read/modify an object after modifying it in parallel
    SQL> select
      2      dfo_number,
      3      tq_id,
      4      server_type,
      5      process,
      6      num_rows,
      7      bytes,
      8      waits,
      9      timeouts,
    10      avg_latency,
    11      instance
    12  from
    13      v$pq_tqstat
    14  order by
    15      dfo_number,
    16      tq_id,
    17      server_type desc,
    18      process
    19  ;
    DFO_NUMBER      TQ_ID SERVER_TYP PROCES   NUM_ROWS      BYTES      WAITS   TIMEOUTS AVG_LATENCY   INSTANCE
             1          0 Producer   QC             51       4451          0          0           0          1
             1          1 Consumer   QC              1        683         14          6           0          1
    This time parallel DML has been used
    What If I create a trigger on the local_tab table and repeat the insert?
    SQL> create or replace trigger local_tab_trg
      2  before insert on local_tab
      3  for each row
      4  begin
      5   null;
      6  end;
      7  /
    Trigger created.
    SQL> insert /*+ append parallel(lcl) */ into local_tab lcl select /*+ parralel(dst) */ dst.* from distant_tab dst;
    51 rows created.
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    SQL_ID  1nhmuzb4ayq7x, child number 1
    insert /*+ append parallel(lcl) */ into local_tab lcl select /*+
    parralel(dst) */ dst.* from distant_tab dst
    Plan hash value: 1788691278
    | Id  | Operation                | Name          | Rows  | Bytes | Cost (%CPU)| Time     | Inst   |IN-OUT|
    |   0 | INSERT STATEMENT         |               |       |       |    57 (100)|          |        |      |
    |   1 |  LOAD TABLE CONVENTIONAL |               |       |       |            |          |        |      |
    |   2 |   REMOTE                 | distant_tab |    51 |  3009 |    57   (0)| 00:00:01 | XLCL~ | R->S |
    Remote SQL Information (identified by operation id):
       2 - SELECT /*+ OPAQUE_TRANSFORM */ "DST_ID","NAME_FR","NAME_NL","DST_UIC_CODE","DST_VOIC_CODE",
           "BUR_UIC_CODE","BUR_VOIC_CODE","INFO_NEEDED","TRANSFERRED","VALID_FROM_DATE","VALID_TO_DATE","S
           ORTING","SO_NEEDED" FROM "distant_tab" "DST" (accessing 'XLCL_XDST.WORLD' )
    Parallel run has been disabled by the existence of this trigger in both distant and local database
    SQL> drop trigger local_tab_trg;
    Trigger dropped.
    Now I want to test an insert using only the append hint as shown below
    SQL> insert /*+ append */ into local_tab lcl select /*+ parralel(dst) */ dst.* from distant_tab dst;
    51 rows created.
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    SQL_ID  4pkxbmy8410s9, child number 0
    insert /*+ append */ into local_tab lcl select /*+ parralel(dst) */
    dst.* from distant_tab dst
    Plan hash value: 2098243032
    | Id  | Operation        | Name          | Rows  | Bytes | Cost (%CPU)| Time     | Inst   |IN-OUT|
    |   0 | INSERT STATEMENT |               |       |       |    57 (100)|          |        |      |
    |   1 |  LOAD AS SELECT  |               |       |       |            |          |        |      |
    |   2 |   REMOTE         | distant_tab |    51 |  3009 |    57   (0)| 00:00:01 | XLCL~    | R->S |
    Remote SQL Information (identified by operation id):
       2 - SELECT /*+ OPAQUE_TRANSFORM */ "DST_ID","NAME_FR","NAME_NL","DST_UIC_CODE","DST_VOI
           C_CODE","BUR_UIC_CODE","BUR_VOIC_CODE","INFO_NEEDED","TRANSFERRED","VALID_FROM_DATE","V
           ALID_TO_DATE","SORTING","SO_NEEDED" FROM "distant_tab" "DST" (accessing
           'XLCL_XDST.WORLD' )
    SQL> select * from local_tab;
    select * from local_tab
    ERROR at line 1:
    ORA-12838: cannot read/modify an object after modifying it in parallel
    Question 1 : What does this last ORA-128838 means if the execution plan is not showing a parallel DML insert?
    Particularly when I repeat the same insert using a parallel hint without the append hint
    SQL> insert /*+ parallel(lcl) */ into local_tab lcl select /*+ parralel(dst) */ dst.* from distant_tab dst;
    51 rows created.
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    SQL_ID  40uqkc82n1mqn, child number 0
    insert /*+ parallel(lcl) */ into local_tab lcl select /*+ parralel(dst)
    */ dst.* from distant_tab dst
    Plan hash value: 2511483212
    | Id  | Operation               | Name          | Rows  | Bytes | Cost (%CPU)| Time     | TQ/Ins |IN-OUT| PQ Distrib |
    |   0 | INSERT STATEMENT        |               |       |       |    57 (100)|          |        |      |            |
    |   1 |  PX COORDINATOR         |               |       |       |            |          |        |      |            |
    |   2 |   PX SEND QC (RANDOM)   | :TQ10001      |    51 |  3009 |    57   (0)| 00:00:01 |  Q1,01 | P->S | QC (RAND)  |
    |   3 |    LOAD AS SELECT       |               |       |       |            |          |  Q1,01 | PCWP |            |
    |   4 |     PX RECEIVE          |               |    51 |  3009 |    57   (0)| 00:00:01 |  Q1,01 | PCWP |            |
    |   5 |      PX SEND ROUND-ROBIN| :TQ10000      |    51 |  3009 |    57   (0)| 00:00:01 |        | S->P | RND-ROBIN  |
    |   6 |       REMOTE            | distant_tab   |    51 |  3009 |    57   (0)| 00:00:01 | A1124~ | R->S |            |
    Remote SQL Information (identified by operation id):
       6 - SELECT /*+ OPAQUE_TRANSFORM */ "DST_ID","NAME_FR","NAME_NL","DST_UIC_CODE","DST_VOI
           C_CODE","BUR_UIC_CODE","BUR_VOIC_CODE","INFO_NEEDED","TRANSFERRED","VALID_FROM_DATE","V
           ALID_TO_DATE","SORTING","SO_NEEDED" FROM "distant_tab" "DST" (accessing'XLCL_XDST.WORLD' )
    SQL> select * from local_tab;
    select * from local_tab
    ERROR at line 1:
    ORA-12838: cannot read/modify an object after modifying it in parallel
    "in that particular case the REMOTE data was joined to some local data and there was an additional BUFFER SORT operation in the execution plan, which (in most cases) shows up when a serial to parallel distribution (S->P) is involved in an operation with further re-distribution of data, and the BUFFER SORT had to buffer all the data from remote before the local operation could continue - defeating any advantage of speeding up the local write operation by parallel DML. A serial direct path insert was actually faster in that particular case."
    Question 2 : Isn’t this a normal behavior of distributed DML where the driving site is always the site where the DML operation is done? And this is why the BUFFER SORT had to buffer all the data from remote to the driving site (local site here)?
    http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/
    Best regards
    Mohamed Houri

  • How to use an Object Type from Another Database

    Hi,
    I have this requirement that I need to call a stored procedure from another DB (db1) but I am having a problem with this because one of the input parameters uses an object type defined in that DB (db1). Is it possible to use an object type from another database? TIA!

    Sven W. wrote:
    At least for queries, but I think also for procedure arguments..You (both) probably missed my post?
    We can't use a remote type as procedure argument, even with the same OID.
    It's OK for query on a remote object column though :
    SQL> conn remote_user@remote_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> create table mytable (col1 mytype);
    Table créée.
    SQL> insert into mytable values (mytype(777));
    1 ligne créée.
    SQL> create or replace function myfunc (p_in in mytype) return number
      2  is
      3  begin
      4   return p_in.att1;
      5  end;
      6  /
    Fonction créée.
    SQL> disconn
    Déconnecté de Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> conn my_user@local_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> select * from mytable@test_dbl;
    COL1(ATT1)
    MYTYPE(777)
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype@test_dbl(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype@test_dbl(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 26 :
    PLS-00331: référence non valide à REMOTE_USER.MYTYPE@TEST_DBL.WORLD
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 9 :
    PLS-00306: numéro ou types d'arguments erronés dans appel à 'MYFUNC'
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored

  • Get JBO-27023 exception when programmatically inserting in view object

    I am using Jdev 11 R2 (11.1.2.3.0) JSF2 & Facelet
    In some use case I require to read information from some external source (a web service in this case)
    and Programmatically insert into Oracle DB
    I use below code to get view object from application module
    //from ADFUtils
         public static ApplicationModule getApplicationModuleForDataControl(String name) {
    return (ApplicationModule)JSFUtils.resolveExpression("#{data." + name + ".dataProvider}");
         public static ViewObject getViewObject(String appModCtrlNam, String viewObjCtrlNam) {
    ApplicationModule am = getApplicationModuleForDataControl(appModCtrlNam);
    return am.findViewObject(viewObjCtrlNam);
         ViewObjectImpl testVW =
    (ViewObjectImpl)ADFUtils.getViewObject("AppModuleDataControl", "View1");
    Row testRow = testVW.createRow();
         testRow.setAttribute("property1",value1);
         testRow.setAttribute("property2",value1);
         testRow.setAttribute("property3",value1);
         testRow.setAttribute("property4",value1);
         testVW.insertRow(testRow);
         and finally commit bounded task flow
         TaskFlowUtils taskFlowUtils = new TaskFlowUtils();
    taskFlowUtils.commitTaskFlow();
         public void commitTaskFlow() {
    getDataControlFrame().commit();
    public DataControlFrame getDataControlFrame() {
    BindingContext bindingContext = oracle.adf.controller.binding.BindingUtils.getBindingContext();
    String dataControlFrameName = bindingContext.getCurrentDataControlFrame();
    DataControlFrame dataControlFrame = bindingContext.findDataControlFrame(dataControlFrameName);
    return dataControlFrame;
         There are some inner objects so I need to repeat this logic for some other view objects (don't put it here to make post shorter)
         Every thing is OK but when number of record I read from that external source increased I will receive
         JBO-27023: Failed to validate all rows in a transaction.
         And system can not commit transaction
         What I mean about the increase in number of records is totaly 50 records not 10000 records
         I mean if I run my method with 3-5 records it is working fine , if I run it with 50 records I will receive JBO-27023
         I am using a method in application module to get sequence from DB and transaction in bounded task flow defined as "Always Begin New Transaction"
         Any idea where is wrong or what is work around?
         Thanks
         Mohsen

    Hi Frank
    I saw that blog from Jobinesh as he mentioned
    public String someAction() {
    BindingContainer bindings = getBindings();
    OperationBinding ob = bindings.getOperationBinding("doSomething");
    Object result = ob.execute();
    if (!ob.getErrors().isEmpty()) {
    return "error";
    return "success";
    But in my use case I need to insert into view objects programmatically not executing a method in app module
    What is they best way of doing this?Should I put this inserts as method in app module?
    and where I can find new version of ADFUtils?
    Appreciate your comments
    Regards
    Mohsen

  • Populating multiple textboxes using a objects assigned to a combobox

    Here I have attached the code I used to populate multiple textboxes using a object which selected dynamically using a combo box at run time. but it gives me an error that saying the object reference not set to an instance. Any suggestions?
    CounterTotal[] arrayOfObjects =
    CounterTotal[])idComboBox.Tag;
    CounterTotalaCounterTotal =
                    arrayOfObjects[idComboBox.SelectedIndex];               
                    idComboBox.Text =
    Convert.ToString(aCounterTotal.id);
                    descriptionTextBox.Text = aCounterTotal.description;
                    totalValueLabel.Text =
    Convert.ToString(aCounterTotal.total);
                    dateCreatedDateTimePicker.Text =
    Convert.ToString(aCounterTotal.dateCreated);
                    feeTextBox.Text =
    Convert.ToString(aCounterTotal.fee);

    Please use the "Insert Code Block" button when posting code (it's the button to the right of the "HTML" button, the one with the < >) . It's much easier to read:
    CounterTotal[] arrayOfObjects =(CounterTotal[])idComboBox.Tag;
    CounterTotalaCounterTotal = arrayOfObjects[idComboBox.SelectedIndex];
    idComboBox.Text = Convert.ToString(aCounterTotal.id);
    descriptionTextBox.Text = aCounterTotal.description;
    totalValueLabel.Text = Convert.ToString(aCounterTotal.total);
    dateCreatedDateTimePicker.Text = Convert.ToString(aCounterTotal.dateCreated);
    feeTextBox.Text = Convert.ToString(aCounterTotal.fee);
    Which statement is causing that exception? You should be able to see, while debugging, which object is null ... that should be a clue to you as to which object you need to fix (create an instance of).
    ~~Bonnie DeWitt [C# MVP]
    http://geek-goddess-bonnie.blogspot.com

  • Implicit and explicit Type conversion using Type object in heap

    Hi,
    I am surprised how Implicit and explicit Type conversion works using Type object in heap. for example when implicit type conversion occur what pointer it returns to object and similarly with explicit type conversion.

    Hello,
    >> I am surprised how Implicit and explicit Type conversion works using Type object in heap.
    For Implicit conversions: Typical examples are conversions from smaller to larger integral types, and conversions from derived classes to base classes. For the first one, the reference would be different which means it would return a different pointer to
    a new object. For the reference type, it actually points to the same memory location, you could use the object.ReferenceEquals() to check it.
    For Explicit conversions (casts):Typical examples include numeric conversion to a type that has less precision or a smaller range, and conversion of a base-class instance to a derived class. For first one, it would perform the same with implicit conversions.
    While for the conversion of conversion of a base-class instance to a derived class, actually, there's no built-in way to do this conversion.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • More or less activated in Alaska

    All right, 2 days into this thing and I have dealt with 10 AT&T people - with about a 50% chance of getting someone helpful. Okay, so I ordered an iPhone and had it shipped to Anchorage - Knowing full well of the situation I would endure trying to ge

  • Not seeing any events on a calendar I subscribed to

    Several of us at the office use iCal to keep track of each other's calendars. A new employee published hers and we all subscribed. Most of us have her calendar listed in the left panel now and the URL is correct, but none of her events are showing on

  • Client side configuration

    Hi Everybody, Thanks to all of the oracle experts. We installed oracle 10.2 RAc database on the server side using 2 nodes on solaris 10. Raw devices are used for clusterware installation. ASM is configured for database shared files. Now i want to con

  • "Service Error" Is there a fix?

    I think if i get the ipod updater to work than maybe iTunes 5 will work with my ipod, but i cant get that thing to work. I have a ipod w/ click wheel and i realllly want to update it. Ive tryed everything about reinstalling and stuff, but nothing has

  • Exchanging photos between mac air and iPod touch

    I have recently switched to using mac.  I want to find out how to transfer pic from ipod touch to mac air and from air to ipod touch without using the itune sync. Also, before i used the sync. in itune to transfer pics from mac to ipod touch before a