Inserting data from the user-defined Type

Hi all

I have the following type
create or replace type answer_obj is object (all_employee_seq integer,questionseq varchar2(10),text_answer varchar2(4000),optionseq varchar2(10));

create or replace type answer_tbl is table of answer_obj;
I have the procedure (within a package) that pulls in the python papers.
TYPE answer_tbl_type IS TABLE OF question_answer%ROWTYPE
                               INDEX BY PLS_INTEGER;

PROCEDURE submit_survey (p_answers IN OUT answer_tbl)
   IS
      l_answers_tbl   answer_tbl_type;
   BEGIN
      FOR i IN p_answers.FIRST .. p_answers.LAST
      LOOP
         l_answers_tbl (i).all_employee_seq := p_answers (i).all_employee_seq;
         l_answers_tbl (i).questionseq := p_answers (i).questionseq;
         l_answers_tbl (i).text_answer := p_answers (i).text_answer;
         l_answers_tbl (i).optionseq := p_answers (i).optionseq;
      END LOOP;


      FORALL idx IN l_answers_tbl.FIRST .. l_answers_tbl.LAST
         INSERT INTO QUESTION_ANSWER
              VALUES l_answers_tbl (idx);
   
   END;
My question is, is it better to insert the data directly from the (record) (records) argument using for LOOP INSERT or the conversion of the argument in an associative array and a FORALL?
As you can see, it's a FOR LOOP to set the values in the array and then by the FORALL.

I think the above is even faster because of the first LOOP IS done in memory and real integration is carried out with FORALL.
I want to get as many opinions.


See you soon,.
Joel

Hello

Because you created the SQL Types, what just to do this within your procedure?

INSERT INTO QUESTION_ANSWER (all_employee_seq, questionseq, text_answer, optionseq)
SELECT all_employee_seq, questionseq, text_answer, optionseq
FROM TABLE(p_answers);

Tags: Database

Similar Questions

  • List of tables of objects or the user-defined type columns

    Hello

    SQL > select * from v version $;

    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE Production 11.2.0.2.0
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    I have n number of tables in my db, since I have several
    tables containing "user defined type columns.
    so, how can I get/list db objects that contains the user-defined type columns only.
    Please suggest me on this

    Kind regards
    Faiz

    Dear Sir

    I have n number of tables in my db,from that i have several
    tables which contains"user defined type columns"
    so how could i get/list the db objects which contains user defined type columns only.
    Kindly suggest me on this
    

    Use this

    select
          tab.table_name
        , tab.column_name
        , tab.data_type
    from
        user_tab_columns tab
      , user_types typ
    where
        tab.data_type = typ.type_name
    order by
        tab.table_name
        ;
    

    Best regards

    Mohamed Houri

  • My browser is running do not. I uninstall, install several times. Uninstall cookies, delete the data from the user, install in another user - no reaction. What's wrong? Help, please

    My browser is running do not. I uninstall, install several times. Uninstall cookies, delete the data from the user, install in another user - no reaction. What's wrong? Help, please

    Start Firefox in Safe Mode {web link} by holding down the < shift >
    (Mac options)
    key and then from Firefox. Is always the problem?

    Start your computer in safe mode with network. Then launch Firefox.
    Try the sites secure web. Is always the problem?

    Start the computer in Mode safe;
    Free online encyclopedia

  • Question of the user defined Type (UDT)

    Hello

    The attached file is NEITHER sample to call a VB6 vi.

    The following is declared in the declaration section:

    ' Global declarations
    Dim lvapp As LabVIEW.Application
    Dim vi LabVIEW.VirtualInstrument

    When I paste these statement in another project (that I'm working on), I get an error 'undefined user-defined type '.

    Can someone point out to me were in the sample, these type definitions are declared?

    Thank you

    Rafi

    PS the attachment is indeed xxx.rar and not xxx.zip.  I changed the name because .rar has not been accepted.  Please rename .rar

    Thank you

    I forgot to mark references to my project

    Project--> references--> LabView. Type library of xxx

    Thank you

  • Set initial value as the number of sequence/date/from the user

    Hi guys, I created a datablock and set up the user interface to allow users to insert all the data they need, however my table has a:

    ID - which is uniqe with each entry of the table is then gernerate by a sequence (that I created on the database), but when I put seq.nextval in the initial value on the datablock it says that I can not do that, so how can I use the sequence to insert the value in this field in the database. It's my first key in my whichobviosuly database my users cannot enter data for, on the contrary, it is generated automatically.

    User - in the same way in the datablock is a user field that has the user that inserted record, I know I can set the default for this field, but how to make the user automatically insert through forms on the database.

    Same again how put SYSDATE is automatically entered in the field date when the user submits the file?

    Any help on this would be GREATLY appreciated.

    Thanks in advance.

    Published by: user13390506 on August 5, 2010 04:11

    The DUAL table:
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/queries009.htm#sthref3198

    With: new, you reference the column should be inserted (in a trigger to update you: old and: where new: old contains the value before and: new value after the update of the column)

    Regarding your real problem: without a few pieces of code fails and you did, it's a little difficult to say what happened here. If you could get better answers by sharing.

    Sharing also the Versions of database (4 digits) and Versions of forms is important in order to obtain a response apropriate.

    Anyway: you seem to be new to the whole forms / SQL / PL/SQL stuff, so I might suggest:
    http://Tahiti.Oracle.com is a very good starting point for SQL and PL/SQL. This isn't a RTFM but rather a Council. Once you got used to you will like it. For my part, I could not live without tahiti: D.

    Cheers.

  • Querying the user-defined types

    I have a chart in which one of the columns is a user-defined data type:
    SQL> describe my_table
    ...
    USER_DATA    MYTYPE
    The type 'MYTYPE' is a simple object that contains a field: a CLOB called MESSAGE:
    SQL> describe mytype
    Name       Null?    Type
    ------     -----    ----
    MESSAGE          CLOB
    When I do a "select *...» "in this table, the USER_DATA column appears as"MYTYPE (oracle.sql.CLOB@898c2d).

    I know that for CLOB and BLOB fields, Developer SQL let me double click on the value and display the content. But for type like this defined by the user that contains a field, I can't navigate the data members of type. I find myself wanting to do something like a 'select user_data.message from my_table", but this is not a valid syntax. Is there a way to query a given specific member of this type defined by the user with the rest of the columns in the table, I can display the CLOB member instead of a representation of the object? If not, is it possible to configure SQL Developer to allow me to browse the data members of types defined by the user? TOAD has a feature like that but I would only use SQL Developer and it is a table that I work with on a regular basis.

    csimons,

    Try this:

    select  t1.user_data.message
    from    eimgr.aq_rtv_docs_out_table t1
    where   rownum = 1;
    

    See you soon

    Edited by: Frenchwood on September 22, 2009 22:38

  • How to extract specific data from the user to view?

    Hello

    I have a requirement I need to display only the Session_user-specific data in the table. Scenario is that if the user belongs to a specific region should be able to see data for that specific region only.

    I think passing the session_user view query name but don't know if it of possible or not. If possible how to do this.

    What is the best way to achieve this?

    Thank you

    Angelica

    Hello

    If you use the ADF for authentication security, the user name is then accessible from the context of the ADF in British Colombia ADF. You can then

    1. create a view of the criteria in British Colombia ADF to a specific view

    2. set the display criteria to use a variable binding

    3. use groovy to add the value of the bind variable

    -set the type of value of 'Expression '.

    -Add adf.context.securityContext.userName

    4. go in the Module--> Application data model

    5 Select the instance of the View object

    6. press on "change."

    7. Select the view test

    If you download the example in this article: Oracle ADF: security for everyone so you see that users have a profile page containing data for the authenticated user. Sound by using the method described above

    If you do not use ADF security you can always use this approach. Instead of providing the value of the variable bind using Groovy you can run the view object using executeWithParams operation in this case, you can read the value of the authenticated user to the side view ADF. The binding variable would not be set to the Expression in this case though.

    Frank

  • Write and read data from the user's local file system

    Hello

    I write my first extension for dreamweaver. My extension should backup the data on the local file system of the user. I know that I can use DWfile.read () and DWfile.write () as described in Chapter 2 of the Dreamweaver API reference. I store the data using the XML format. What is the best way to read and parse the XML data in the file? What is the best way to write the XML data in the file?

    If you recommend one format other than XML, I'm open to suggestions. The data are only a few configuration information for the extension which should be persisted.

    Thank you

    mitzy_kitty

    How will the data be used? If it is used by JavaScript, use JSON format which includes js. If you use XML, then you will need to find an XML parser to read the data.

    Randy

  • Create the trigger to insert data from one user to another user in same Databas

    Dear Sir, I created a trigger as follows

    CREATE OR REPLACE TRIGGER TRIGGER1
    BEFORE INSERTING
    ON table1
    FOR EACH LINE
    BEGIN
    INSERT IN THE TEST. TABLE2
    VALUES (: NEW.) COLUMN1,: NEW. COLUMN2,: NEW. COLUMN3,: NEW. COLUMN4);
    END;
    /

    I want here to insert my user to user Test data. In this Situation when I Execute The above Trigger it shows error PL/SQL: ORA-00942: table or view does not exist

    Help, please

    What do you mean by run the trigger?
    Do you compile?
    Can be open as a TEST and do the following and try to compile your code of the trigger again.

    grant insert on TEST.TABLE2 to youruser;
    

    See you soon,.
    Manik.

  • Bug report, loss of data from the user [iOS]

    Nasty bug with user data loss: I put the phone to sleep so that in Acrobat. I then switched back on it, although he was in portrait orientation, not landscape in which she was recently in (if that matters). Acrobat has shown a message "a system error has occurred" and then all my hands-free the past 2-3 days where lost marks. Note: markings more aged 2 or 3 days are preserved, but even more is lost than just my last reading session. iPhone 6s more with iOS 9.1 and version Acrobat from November 13, 2015. Date of update to Acrobat looks suspiciously close to the date after which I lost everything

    Hi Orlin,

    We just released Acrobat Reader for iOS version 15.3.0 on January 5, 2016.

    This version includes the fix for the failure you have encountered.

    Would you please try it and let us know if it works for you?

    Thank you!

  • call a DLL that has the user-defined types

    I am trying to call a function in a DLL that is

    int32 system_config(&recCfg, &pulseCfg, errMsg)
    

    recCfg is a structure consisting of 3 double rooms and 2 integers

    and pulseCfg is a structure consisting of just Boolean

    I don't know how to set the input parameters for this call the library feature.

    LabVIEW sees as

    void system_config(void)
    

    I see the only choice of Numeric, Array, String, waveform, digital waveforms, digital data, ActiveX, Adapt to Type and pointer to Instance data for arg1.  ActiveX seems to be the only one to use?

    NYC says:

    I am trying to call a function in a DLL that is

    int32 system_config(&recCfg, &pulseCfg, errMsg)
    

    recCfg is a structure consisting of 3 double rooms and 2 integers

    and pulseCfg is a structure consisting of just Boolean

    Actually contrary to what Simon says you can do in this case. But your line you are showing is unfortunately very unclear, because he does not understand the real typedef for your clusters. So I have to go by what you write in prose that is... Well... not very detailed.

    The first is simply a cluster in LabVIEW with 3 floats to double precision, followed of 2 integers. You find yourself what bitsize integer, you need, as you do not show the typedef in the cluster. In order to connect to a cluster in a CLN you must configure this setting as to adapt to the Type. But be careful who does not work for clusters containing strings or arrays at all. Tables and chains of LabVIEW are something completely different than what awaits a C DLL. You can configure the parameters of function to be C compatible pointers to arrays and strings and LabVIEW will make sure to do the conversion on every call, but you cannot configure the CLN to convert strings and tables within a cluster.

    The second group is really equivalent to a simple Boolean value passed by reference. As you do not show the actual type of the Boolean value, it is difficult to recommend this type of data to use in LabVIEW. Windows BOOL is a 32-bit integer and C++ bool is usually a 8-bit value which would coincide with the Boolean LabVIEW 8-bit use. You cannot configure a Boolean setting directly in the NLCS, so you can either use an integer of size accordingly or create this cluster with a single LabVIEW boolean anyway (if your bool is a bool C++ and not something else) and do the same as for the previous cluster/structure parameter.

  • I need to insert data from the parent to the child table inheritance

    Hi everyone I m using jdeveloper 12

    I have this use EDC:

    I m trying to have mini-programm in which i

    create porject, used to create and assign an employee as the project manager:

    It is therefore my phyiscal using uml data model

    cap1.PNG

    cap2.PNG

    My problem is: I need to see the values in the employee table, choose an employee id s and with the form create in this table: Project Manager: insert the employee with the s project id id

    but when I navigate to the form it is already full of I don't know why

    I did not understand your problem clearly.

    Could you please explain the problem with some screen shots and step by step flow?

    See you soon

    AJ

  • The data of the user of a Flex application recovery

    Hello! I need to use an application Flex (not a form guide) in the workspace.

    I am able to make a Flex application that is activated in the workspace, but I do not know how to retrieve data from the user.

    I know that if I use a form Guide, I can use a custom renderer Service that can retrieve data from the user, but how can I do the same if I don't use form Guide, but a pure SWF (variable type is form)?

    Thank you

    Alessio

    There is a way you can get the information of the user of the Flex application. You can get the user name, e-mail address and such things.

    You can see the following blog on how to do it: http://michael.omnicypher.com/2008/12/get-current-user-for-workspace-enabled.html

    If you need other data, you may need to make a call service or remote Web access once the Flex form has loaded.

    In the next version of LiveCycle, you will be able to use the same concept as the service rendered.

    Jasmine

  • retrieving data from columns of user defined type

    Abstract types, I learned the other day. So I created an abstract type and a table.

    Create the student_ty as an object type
    (name varchar2 (20), number of roll);

    create table result)
    Student student_ty,
    (total);



    I also inserted data. But I'm having some trouble with the rretrieval of data. Suppose I want to choose only the roller and the name of the student as described in the type of studen. So I used the follwing query: -.

    Select result student.name;

    But it's not working. But when I use something like this: -.
    Select r.total, r.student.name in result r;


    This works perfectly. My question is that it is a rule that oracle needed to use an alias, whenever retrieve values for a user defined type data?. Help, please.
    Thanks in advance.

    Yes, you can use an alias when the type of object in a table like this.

    select r.student.name, r.student.roll, r.total
      from result r
    
  • Slow response from the user interface with acquisition of data of type long time

    Hi all

    I have a question to ask more out of curiosity than necessity right now. I've built a program that acquires data from the accelerometer and the Treaty in a number of ways: filtering, FFT, FRFS, things like that, but the answer of the UI is still slow, because I need a resolution of frequency of 0.2 Hz for my data domain, which means that the sample acquisition time is 5s and all this awaits before execution.

    My question is this: is there a way to completely isolate the user interface of data acquisition so that it responds immediately?

    I tried a design model of producer consumer with queues, but found everything to be always waiting for samples to be taken. Maybe it was exactly as I did.

    Thank you

    Phil

    If you need to sample for 5 seconds in order to have enough data to analyze, so unless you can "predict the future" and "knowing" the five seconds of data, simply wait for the data that arrives.  Using parallel loops of producer-consumer will allow data acquisition to proceed (for the next 5 seconds of data) while you do the analysis, but you still have to wait for the data to be analyzed.

    Note that the previous paragraph assumes you are collecting data in 5 seconds 'chunks' and analyze each "chunk" (independent) on arrival.  You could also do something like having a "second 5 sliding window" which moves, say, a second at a time, giving your FFT a finer resolution of 'time' (at the expense of their independence).  This would be a (slight) change in your loop of producer (you want to taste in 1 second pieces, accumulate 5 these pieces) and the consumption loop (start analyzing, spewing a FFT every second, while replacing the older "chunk" with the most recent - a queue with loss can do for you).

    Bob Schor

Maybe you are looking for

  • Mega problems with 6.0 upgrade, possible to roll back?

    No problems before the update. Many sites act as they load, but is then filtered white saying transfer... because a lot can click on stop and reload and they will be, but not all. Many sites will load but without loading flash - there was a cap nine

  • Skype will not stop crashing and does not.

    Today, I logged on to my computer and launched Skype as usual. Everything was fine until the program has stopped responding. Think nothing of it because it is not a rare ocorance on windows I have just re-opend Skype. Short minute in Skype but still

  • site blocked Windows cannot check the xp Publisher Help

    Hi, I have a security camera (ip camera) and Windows keeps giving me this message so I can't log on to it.   I go to the site (ip address), I connect with my username etc, then I get the message telling me her active x add on has been blocked, I leav

  • Question of QSettings

    Let say that my config file is empty. If I do that QSettings settings; qDebug()

  • uiapp starting from Ribbon and bb app menu

    Hi I'm new here - apologies if it's a clear message I have a developed gui application and work - typical boot sequence - MyApp extends UIApplication and the MyApp main() method creates a new instance of the app and call app.enterEventDisplatcher ();