Package with multiple inserts

I am new to packages. I know how to do selects, but not inserts. I need to do inerts to multiple tables. One table I need to do to multiple Inserts. Is there a good example of this anywhere?

Let me lay this out. There is another piece.
first table..
table1id name
1 cars
2nd table
table2id table1id carMake
1 1 Ford
2 1 Chevy
3 1 Honda
3rd table
table3id table2id carModel
1 1 Mustang
2 1 Tarus
3 1 F-150
4 2 Impalla
5 2 Corvette
6 2 Caviler

Similar Messages

  • Package with multiple applets

    Hi
    I want to install 2 applets on real java card. They both are in the same package and cna use each other.
    How can i do this on JCOP ?
    and what if they are on difference packages and what if i am using some other lib as well ? do i need to install that lib too if yes then how ?
    BR
    Umer

    If your packages and applets are in one JCOP Java Card project, this should be handled for you. You can have multiple applets in a package, you can have multiple instances of a single applet, and you can have multiple packages with multiple applets as well as library packages.
    If you want to access an applet from another applet in the same package, it is like referencing any other class instance. If they are in different packages you need to use shareable objects. This is because of the applet firewall.
    Cheers
    Shane

  • PL SQL with multiple inserts, how to continue after exception is raised

    Hi,
    I have a simple PL SQL function with various inserts. ex:
    Insert Into "DI01"."DUA_DIM_UNITE_ADMIN" (Ide_Unite_Admin_Sk, Num_Unite_Admin, Des_Unite_Admin) Values ('-1', '00000000', 'Défaut');
    INSERT INTO "DI01"."DUA_DIM_UNITE_ADMIN" (IDE_UNITE_ADMIN_SK, NUM_UNITE_ADMIN, DES_UNITE_ADMIN) VALUES ('-2', 'S. O.', 'Sans Objet');
    Insert Into "DI01"."DCU_DIM_CATGR_UNSPS" (Ide_Catgr_Sk, Num_Code, Des_Code, Num_Catgr, Des_C.........
    I want to be able to run the function multiple times, and have all the inserts executed everytime, even if I get a ORA-00001 unique constraint (string.string) violated error in on of the inserts. That means that if I get an error in the first insert, I want the function to continue running and executing the consecutive inserts.
    I though of including each insert in a different block, like:
    BEGIN
    Insert......
    When Exception then null;
    END;
    BEGIN
    Insert......
    When Exception then null;
    END;
    But I have at least 50 inserts, so the final code becomes huge.
    Another solution is to use merge inseat of insert, but the code seems too complex for such a simple task.
    Is there any other solution for this that I am not seeing?
    Thank you for your time,
    Joao Moreira

    You can use DML error logging approach or FORALL SAVE EXCEPTIONS.
    Since you didn't mention the version I assume you are using 11g.
    Below is the sample code for DML error logging mechanism
    SQL> select * from v$version;
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production   
    PL/SQL Release 11.2.0.3.0 - Production                                         
    CORE 11.2.0.3.0 Production                                                     
    TNS for Linux: Version 11.2.0.3.0 - Production                                 
    NLSRTL Version 11.2.0.3.0 - Production                                        
    SQL> DROP TABLE tableA;
    Table dropped.
    SQL> DROP TABLE Err$_tableA;
    Table dropped.
    SQL>
    SQL> CREATE TABLE tableA
      2  (
      3     col1   NUMBER PRIMARY KEY,
      4     col2   NUMBER,
      5     col3   VARCHAR2 (10)
      6  );
    Table created.
    SQL>
    SQL> -- Create error log table
    SQL>
    SQL> BEGIN
      2     DBMS_ERRLOG.create_error_log (dml_table_name => 'TABLEA');
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> BEGIN
      2     FOR i IN (SELECT 1 AS col1 FROM DUAL
      3               UNION ALL
      4               SELECT 1 FROM DUAL)
      5     LOOP
      6        INSERT INTO tableA (col1)
      7             VALUES (i.col1)
      8                LOG ERRORS INTO Err$_tableA REJECT LIMIT UNLIMITED;
      9     END LOOP;
    10 
    11     COMMIT;
    12  END;
    13  /
    PL/SQL procedure successfully completed.
    SQL> column column_name format a30
    SQL> set linesize 300
    SQL> select * from tableA;
    SQL> select * from err$_tablea;
    Thanks,
    GPU

  • Please help with multiple insert query into nested table!!!!

    I am having a problem with inserting multiple references to objects into a nested table using the following query:
    INSERT INTO TABLE(SELECT Taken_by FROM courses WHERE course_number= 001)
    (SELECT REF(p) FROM persons p
    WHERE p.enroled_in = 'Computing for Business'
    The database says that p.enroled_in is an invalid identifier. I know why this is. This is because the field enroled_in is part of a subtype of person called student_type and the query above is not accounting for this properly. I would like to know the correct syntax to use so I can insert into the nested table wherever a student is enroled into the 'computing for business' course. My full schema is below:
    CREATE TYPE person_type;
    CREATE TYPE student_type;
    CREATE TYPE staff_type;
    CREATE TYPE course_type;
    CREATE TYPE module_type;
    CREATE TYPE address_type AS OBJECT
    Street VARCHAR2 (30),
    Town     VARCHAR2 (30),
    County VARCHAR2 (30),
    Postcode VARCHAR2 (9)
    CREATE TYPE person_type AS OBJECT
    Name VARCHAR2 (50),
    Address address_type,
    DOB     DATE
    ) NOT FINAL;
    CREATE TYPE staff_type UNDER person_type
    Staff_number NUMBER (2,0)
    ) FINAL;
    CREATE TYPE student_type UNDER person_type (
    Student_number NUMBER (2,0),
    Enroled_in VARCHAR2(50),
    MEMBER FUNCTION getAge RETURN NUMBER
    )NOT FINAL;
    CREATE OR REPLACE TYPE BODY student_type AS
    MEMBER FUNCTION getAge RETURN NUMBER AS
    BEGIN
    RETURN Trunc(Months_Between(Sysdate, DOB)/12);
    END getAge;
    END;
    CREATE TYPE module_type AS OBJECT
    Module_number VARCHAR2(6),
    Module_name VARCHAR2(50),
    Credit NUMBER(2,0),
    Taught_in VARCHAR2(50)
    CREATE TYPE students_tab AS TABLE OF REF person_type;
    CREATE TYPE modules_tab AS TABLE OF REF module_type;
    CREATE TYPE course_type AS OBJECT
    Course_number NUMBER (2,0),
    Course_name VARCHAR2(50),
    Dept_name VARCHAR2(50),
    Taken_by Students_tab,
    Contains Modules_tab
    CREATE TABLE modules OF module_type(
    constraint pk_modules primary key (Module_number)
    CREATE TABLE courses OF course_type(
    constraint pk_courses primary key (Course_number)
    NESTED TABLE Taken_by STORE AS students_nt,
    NESTED TABLE Contains STORE AS modules_nt;

    By the way I am using oracle 9i and trying to insert into the nested table data from a subtype (i.e student is a subtype of person)

  • Package for multiple inserts

    I have a development question for someone. First off, I am not a developer but can get my head around most things. Here is the potential scenario -
    If I have a schema that has a header table with primary key and date and detail table with foreign key (which is header primary key) and another sequence (which is also unique for each row of the detail table) making up the composite primary key. I want to create a form that will give a list of items with quantity and then insert the items into the detail table, one by one so that I can write a report that will put all the items under header no 00001 on the same report ( as an example below). So ideally what I want is
    Header Table
    Header_no Date
    00001 31/09/10
    Detail Table
    Header_no Detail_no Item_no Quantity
    00001 0000001 4 3
    00001 0000002 5 2
    00001 0000003 7 10
    What is the best way of doing this i.e. should I create a trigger that calls a package which will iterate an insert (and replace the changing values for Detail_no,Item_no and Quantity for the same Header_no) for each entry in the list until all entries are exhausted? I am assuming that is possible and not too difficult to do.
    Alternatively, I could have a table with very long rows and then have every item in my list as a column. This will create a lot of null values as a negative but will only require a single entry for each request and so I could do away with Header table. Not really in favor of this choice.
    I prefer the first option but am not sure if it is doable, although should be, and it will have less redundancy. Any advice is welcome. Thanks in advance.
    P.S. not sure if the format will come out as I want it to for the tables
    Edited by: user8025501 on Sep 27, 2010 12:57 PM

    I have another question. I want to print information from a report generated by some PL/SQL code to a page, what is the best way of doing this in Apex?

  • Util_File package with multiple users

    I am using util_file package to spool data into file . I have two users with different data . I have given access to both the users to execute util_file package .
    Now how does my stored procedure knows which user's data to take .
    Thanks,

    You are asking the wrong question. Your procedure doesn't need to know whose data to take. UTL_FILE file handles are private to the session.
    Your application design does need to keep different sessions writing to different files. You can't have both sessions open the same file for writing (or if you do, the results are unpredictable, particularly if both sessions attempt to write simultaneously.
    This is exactly the same as when you write to a file from a C program.
    Your best options are
    1) make the file name contain a username, and each user has his own file
    2) write all data to a single file, and protect each write
       - grab a user lock (use DBMS_LOCK package)
       - open the file for append
       - write to the file
       - close the file
       - release the lockHTH
    Regards Nigel

  • Help With Multiple Inserts

    We are running oracl 8i and trying to get this statement to update Unit_warr_test with 20 to 30 lines from the refence table spec_comp_warranty when there is no entries for a given unit_id in the unit_warr_test that matches the unit_main and then matches the spec_no column to the spec_comp_warr table from the unit_main table. Below is the script that we are running. Right now this script returns 85,000,000,000 rows. The spec_comp_warr table only has 46,000 rows in it and the unit_main only has 7,000 rows. there is no reference between spec_comp_warranty table other than the spec_no and each spec has 20 to 30 rows in spec_comp_warranty. Any Ideas on how to get this script to run and insert the 20 30 rows in unit_warr_test when the unit is not in unit_warr_test by matching the spec_no?
    insert into unit_warr_test (COMPONENT,
    DIST_USAGE,
    DURATION,
    EXP_DT,
    EXP_USAGE,
    INVOICE,
    PART,
    TIME_USAGE,
    UNIT_ID,
    U_SYSTEM,
    VENDOR_NO,
    WARR_EXCLUDE_FL,
    RECORD_TYPE,
    ON_WARRANTY_CLAIM,
    POSSIBLE_WARRANTY_CLAIM)
    select
    a.component,
    NULL,
    a.DURATION,
    NULL,
    '0',
    NULL,
    a.PART,
    NULL,
    b.unit_id,
    a.u_system,
    a.vendor_no,
    a.warr_exclude_fl,
    'E',
    'N',
    'N'
    from SPEC_COMP_WARRANTY a, UNIT_MAIN b, UNIT_WARR c
    where b.unit_id <> c.unit_id
    and a.spec_no = b.spec_no and b.spec_no is not null

    It looks like your generating a Cartesian product. Try
    FROM   spec_comp_warranty A, unit_main B
    WHERE   a.spec_no = b.spec_no
    AND    b.spec_no IS NOT NULL
    AND     NOT EXISTS (SELECT c.unit_id
                    FROM  UNIT_WARR c
                    WHERE c.unit_id = c.unit_id )Cheers, APC

  • Installing multiple packages with pkgadd...

    hi there,
    sorry about this silly question but I am having some problem to install multiple packages with pkgadd. Basically I have packages with this form "apache-2.4.3-sol10-sparc-local" and not with pkg extension. So, checking the man page pkgadd -d /packages/dire/ all suppose to work, but it doesn't.
    I am sure I am doing a very simple error but couldn't figure out.
    It will be appreciated if someone help.
    Cheers!

    Hi.
    pkgadd -d - used for install many packeges from one location.
    location may be:
    1. Directory
    2. Separete file.
    You have many files that contetns packages. You can't do it with one commands, or you should previos converst all packages to one file ( man pkgtrans).
    You should use command:
    pkgadd -d <path>/apache-2.4.3-sol10-sparc-local all
    pkgadd -d <path>/gmp-4.2.1-sol10-sparc-local all
    pkgadd -d <path>/libtool-2.4.2-sol10-sparc-local all
    pkgadd -d <path>/ readline-6.2-sol10-sparc-local all
    pkgadd -d <path>/coreutils-8.19-sol10-sparc-local all
    pkgadd -d <path>/libgcc-3.4.6-sol10-sparc-local all
    pkgadd -d <path>/openldap-2.4.32-sol10-sparc-local all
    pkgadd -d <path>/sasl-2.1.25-sol10-sparc-local all
    pkgadd -d <path>/db-4.7.25.NC-sol10-sparc-local all
    pkgadd -d <path>/libiconv-1.14-sol10-sparc-local all
    pkgadd -d <path>/openssl-1.0.1c-sol10-sparc-local all
    pkgadd -d <path>/sqlite-3.7.13-sol10-sparc-local all
    pkgadd -d <path>/expat-2.0.1-sol10-sparc-local all
    pkgadd -d <path>/libintl-3.4.0-sol10-sparc-local all
    pkgadd -d <path>/pcre-8.31-sol10-sparc-local all
    pkgadd -d <path>/zlib-1.2.7-sol10-sparc-local all
    Regards.
    Edited by: Nik on 22.10.2012 4:06

  • One packaging-HU with multiple batches

    hello,
    we use the batch management and the handling unit management. Now we habe the problem that we have a palett-HU with multiple packaging-HUs. One packaging-HU has more than one batches. So SAP create a transport order for a delivery with a pick-HU and post several packaging-HUs on the pick-HU. We don't want it. The packaging-HUs should stay on the palett-HU and we don't want to use the pick-HU. Can anybody help me?
    kind regards

    You query is related to WM module related, but you have posted this thread in FI forum.
    Please choose correct forum at the time of new thread creation. Read the document http://scn.sap.com/docs/DOC-18467 and read https://scn.sap.com/docs/DOC-18590

  • Creating Multiple INSERT statements with SQL

    is there a way to create multiple INSERT staements with SQL .
    Example scenario : This is only example but i have lot of data in the real time.
    sql : Select Emplid from Table A where Emplid between 100 and 350 will retun me 50 rows . i want to insert those rows into another table.
    I am looking for output like below instead of Giving output just as EMPLIDs
    Insert into PS_LM_DATA ( EMPLID ) values ( 123 )
    Insert into PS_LM_DATA ( EMPLID ) values ( 234 )
    Insert into PS_LM_DATA ( EMPLID ) values ( 334 )
    and so on....
    thanks ,
    Karu

    If you are inserting into another table, you could use
    insert into PS_LM_DATA ( EMPLID ) 
    select Emplid from Table A where Emplid between 100 and 350Example:
    SQL> insert into emp2(empno) select empno from emp;
    14 rows created.
    SQL> insert into emp2(empno) select empno from emp where empno between 7369 and 7788;
    8 rows created.

  • Handling error with multiple row insert/update

    Hi,
    I need to insert multiple rows into a table, and I understand that i need to use executeArrayUpdate().
    My problem is this :
    1. How do I know in case some of the rows in the array failed during the INSERT?
    2. When I do know that, how do I find those particular rows?
    Thanks

    ODAFEONIHOWO wrote:
    Please i need help on how to enter multiple row into mysql with one insert
    statement and jsp it's not possible - you'll need to do a batch insert
    i have been trying this for weeks without sucess e.g how much experience do you have with Java?

  • How to insert autoincrement record and query it with multiple keys

    Hi all,
    I am not familiar with BerkeyleyDB, I am now doing a project that needs to insert records and then query it out with multiple keys at later time. Since there is no field that can be distinct primary key, I want to user DbSequence as auto increment primary key to db, and set other index keys as secondary db, then using join cursor to do query with multiple keys.
    I don't know how to use DbSequence, can anyone direct me to a example of using DbSequence as auto increment primary key?
    Regards
    -Bruce

    I figured out the method to insert record with auto increment primary key. I listed the code block below:
    char m_SeqNamePositions[32] = "MyPositions";
    DbSequence *m_pSeqPositions;
    m_pDBPositions = new Db(NULL, 0);
              m_pDBPositions->open(NULL, pszFileName, szFileName, DB_BTREE, DB_CREATE, 0);          // 无数据文件
              m_pSeqPositions = new DbSequence(m_pDBPositions, 0);
              Dbt key((void *)m_SeqNamePositions, (u_int32_t)strlen(m_SeqNamePositions));
              m_pSeqPositions->open(NULL, &key, DB_CREATE);
    db_seq_t SeqNum;
         m_pSeqPositions->get(0, 1, &SeqNum, 0);
         Dbt key((void *)&SeqNum, (u_int32_t)sizeof(SeqNum));
         Dbt data(pRecord, sizeof(*pRecord));
         return m_pDBPositions->put(NULL, &key, &data, DB_NOOVERWRITE);
    m_pSeqPositions->close(0);
              m_pDBPositions->close(0);
    delete m_pSeqPositions;
    delete m_pDBPositions;
              m_pDBPositions = NULL;

  • I need your expert opinion on how to create a map with multiple conditions.

    Hello.
    I need your expert opinion on how to create a map with multiple conditions.
    I have a procedure (which i cannot import or re-create in OWB due to the bug), so i am trying to create a map instead :-(
    How can i create a cursors within the map?
    My function creates table and cursor.
    Then it will have to check for duplicates in the tables (the one created and another table) - the criteria for finding duplicates is a number of fields.I then need to place few different conditions (if some attributes are not available) and it has to load cursor based on this conditions. The next step is to fetch the data into the cursor based on what attributes are missing.
    The next thing it will do is insert the data into table (if record doesn't exist), output the error in separate table is record is corrupted, or update the record with changed information.
    In short i need to re-create match / merge but with conditions, iterations etc 'built into' it.
    I can read up on available functions - it's just what would be the best options? and what would be the best approach to do so?
    In my function i use %rowtype - but cannot use it in owb - so what would be the alternative? i don't really want to create a lot of variables and then have a nightmare of maintaing it. are there any tips regarding this?
    having looked through Oracle dedupe - it's not really what i need because it is just DISTINCT.
    I would appreciate any help / advise on this.
    Thank you very much

    thanks a lot for your reply - i will look into this option :-)
    it is a bit more complicated now as i have to re-create the match / merge and then somehow 'tweak' it to achieve the result i need.
    At the moment i am looking to breakdown the package into smaller chunks 'functions' and try creating the map that way.
    Anyway, thank you very much for your suggestion.

  • Multiple Quizzes with multiple results (in Captivate 6)

    Hey guys, Thanks for reading!
    Does anyone know if it is possible to do multiple tests with multiple results in captivate 6? or if it is possible to have a pre-test with a quiz, and have separate results for each?
    I've been having a play with captivate 6 and when I put a quiz in, it overrides the results slide for my pre-test.
    Looking at the results slide master properties I can choose to have results for one of my quizzes but not both (even on separate slides):
    It wont even let me insert another slide based on the other result.
    I would like to know if multiple quizzes with multiple results is possible in Captivate 6?, or if I am simply doing something wrong?
    Thanks!

    Sorry for way-late reply...
    It's really more how your LMS handles 'courses' and the terminology it uses.
    Essentially, most often, a 'SCORM Package' (SCO) is a 'course'. I'd rather call each SCO a 'lesson' as, to me, 'courses' should be setup in the LMS with a series of 'Lessons'.
    Regardless of the terminology, each 'SCO' is launched by the LMS and one score can be recorded for it via SCORM.
    So if you need multiple final scores recorded, each of those final scores need to be in their own SCO.
    A common approach is a Pre-Test SCO (or 'lesson', or 'course', whatever term), a 'Content' SCO perhaps with some interspersed scored interactions, and a Post-Test SCO...all three merged together as a 'course' (or whatever term) within the LMS.
    That said, as said, it really all depends on how your LMS handles various SCOs...
    Clear as mud?
    E

  • I have regisetred a EIT with multiple rows Yes, can we change it NO now.

    I have registered a EIT with multiple rows Yes, can we change it NO now.

    Hi,
    Yes you can change this through back-end.
    Register extra information (types) concurrent program run the package HR_REGISTER_EITS and insert definintion of an EIT in respective INFO_TYPES tabel for example if person EIT then definition is stored in PER_PEOPLE_INFO_TYPES.
    In this table we have column MULTIPLE_OCCURENCES_FLAG which can have value as Y or N, Y - Multiple entries allowed, N - Multiple entries not allowed.
    You need to update the value of this flag to N for your EIT definition and you are done.
    Thanks,
    Sanjay

Maybe you are looking for

  • Budget exceed error while unreleasing the service entry.

    Hi experts, My problem is the systm generating budget exceed error while unreleasing the entry sheet in current fiscal year. Entry sheet is released in privious fiscal year. User want to reverse this in current year. All budget(actual/commitment) are

  • SAPGUI 7.10 on Windows Vista Problems

    Hello everybody, this is my first post. Yesterday,I have installed the released version of SAPGUI on Windows Vista Ultimate with Office 2007 but I have a few problems: 1. Transaction BD87 seems to hang after executing from the selection screen. If I

  • Using XSD while constructing schema

    Hi, I have the following scenario. I hae 2 methods getsendinputschema and getsendoutputschema as shown in the Interactionimpl.java of the email adapter. I call a EIS event in the execute method.The EIS returns me a xml document.Now i have to construc

  • Problem linking to a third party application

    Hi I wrote a link with SAP and a document management system. They have just upgraded their software so it is .net compliant. I have recoded my link but the problem I have is that when I call a routine to search and display a document it just shows a

  • IPhone SDK: Navigation Hierarchy Problem

    Hello! I've started developing for the iPhone and read through the programming guides of the developer site. As my first application I've wanted to make a navigation hierarchy. When I click in the MainWindow on a button a second view is put on the na