a single insert for multiple insertions, if tables from same

Hi all

Can I have an insert for less than 3 Insert stm.
declare 
v_z number;
begin
v_z :=0.0;

INSERT INTO rd_carry_new1
SELECT  s.ssm_id,
     s.ssm_id as adjusted_cusip,
     v_z as rolldown, --= @zero,                      
     v_z as oas, --=@zero,                      
     nvl(srm.carry_rate, 0.0) as carry,
     v_z as finance_rate, --= @zero,                            
     v_z as price_drop, --= @zero,
     sw.heldby_pco_sw,
     v_z as carry_bk1, --= @zero,        -- place holders for interim results
     v_z as carry_bk2, --= @zero,
     'Y              ' AS r_srm_flag,     --r_srm_flag     = "Y              ", /*-- Indicates value from SRM, stale these should not be updated at any point*/
     'Y              ' AS o_srm_flag,     --o_srm_flag     = "Y              ",
     'Y              ' AS c_srm_flag,     --c_srm_flag     = "Y              ",
     'Y              ' AS f_srm_flag,     --f_srm_flag     = "Y              "
     'SRM' AS oas_method                         --,          oas_method='SRM'

FROM  sec_tab_sdb s, 
  sr_measures srm,
  sec_sw sw
WHERE s.ssm_id = srm.ssm_id
AND   s.ssm_id = sw.ssm_id;


insert into rd_finance_new1
select  s.ssm_id,
     v_z as rolldown,                      
     v_z as oas,                      
     v_z as carry,                         
     nvl(srm.financing_rate,0) as finance_rate,     
     v_z as price_drop,
     sw.heldby_pco_sw,
     v_z as rolldown_bk1,        -- place holders for interim results
     v_z as rolldown_bk2,
     'SRM'  as finance_method, -- audit for financing_rate queries
     'Y              ' as r_srm_flag,    -- Indicates value from SRM, stale these should not be updated at any point
     'Y              ' as o_srm_flag,
     'Y              ' as c_srm_flag,
     'Y              ' as f_srm_flag
     
from  sec_tab_sdb s, 
  sr_measures srm,
  sec_sw sw
where s.ssm_id = srm.ssm_id
and   s.ssm_id = sw.ssm_id;


insert into  pco_on.rd_rolldown_new1
select s.ssm_id,
        nvl(srm.rolldown,0) as rolldown,     
        v_z as oas,                      
        v_z as carry,                           
        v_z as finance_rate,                            
        v_z as price_drop,
        sw.heldby_pco_sw,
        v_z as rolldown_bk1,             -- place holders for interim results
        v_z as rolldown_bk2, 
        'Y              ' as r_srm_flag,   -- Indicates value from SRM, stale these should not be updated at any point
        'Y              ' as o_srm_flag,      
        'Y              ' as c_srm_flag,      
        'Y              ' as f_srm_flag,      
        'SRM'        as  rolldown_method

from  sec_tab_sdb s, 
  sr_measures srm,
  sec_sw sw
where s.ssm_id = srm.ssm_id
and   s.ssm_id = sw.ssm_id;

end;

Try this please

INSERT ALL
INTO RD_CARRY_NEW1 VALUES
  (
    SSM_ID,
    ROLLDOWN,
    OAS,
    carry,
    finance_rate,
    price_drop,
    heldby_pco_sw,
    rolldown_bk1,
    rolldown_bk2,
    r_srm_flag,
    o_srm_flag,
    c_srm_flag,
    F_SRM_FLAG,
    rolldown_method
  )
INTO RD_FINANCE_NEW1 VALUES
  (
    SSM_ID,
    ROLLDOWN,
    OAS,
    carry,
    finance_rate,
    price_drop,
    heldby_pco_sw,
    rolldown_bk1,
    rolldown_bk2,
    r_srm_flag,
    o_srm_flag,
    c_srm_flag,
    F_SRM_FLAG,
    rolldown_method
  )
INTO PCO_OWN.RD_ROLLDOWN_NEW1 VALUES
  (
    SSM_ID,
    ROLLDOWN,
    OAS,
    carry,
    finance_rate,
    price_drop,
    heldby_pco_sw,
    rolldown_bk1,
    rolldown_bk2,
    r_srm_flag,
    o_srm_flag,
    c_srm_flag,
    F_SRM_FLAG,
    rolldown_method
  )
SELECT s.ssm_id,
  NVL(srm.rolldown,0) AS rolldown,
  v_zero              AS oas,
  v_zero              AS carry,
  v_zero              AS finance_rate,
  v_zero              AS price_drop,
  sw.heldby_pco_sw,
  v_zero            AS rolldown_bk1,
  v_zero            AS rolldown_bk2,
  'Y              ' AS r_srm_flag,
  'Y              ' AS o_srm_flag,
  'Y              ' AS c_srm_flag,
  'Y              ' AS f_srm_flag,
  'SRM'             AS rolldown_method
FROM sec_tab_sdb s,
  sr_measures srm,
  sec_sw sw
WHERE s.ssm_id = srm.ssm_id
AND s.ssm_id   = sw.ssm_id;

Tags: Database

Similar Questions

  • Can I purchase a single license for multiple software? Buy one for a single application, buy another one for another, etc.

    Can I purchase a single license for multiple software? Buy one for a single application, buy another one for another, etc.

    You can purchase the license but on different emails if you need to use them on multiple computers. From an e-mail, you can install software on both computers. These two computers can be Windows, Mac OS, or everyone. If you install on a third computer, you will be asked to turn off this feature on the other two computers. You can then re-enable one of the two previous computers and use Cloud Creative apps on it.

    Kind regards

    Hervé Khare

  • Is there a way to pay for multiple images to in the same transaction rather than one by one?

    Is there a way to pay for multiple images to in the same transaction rather than one by one?

    Right now only at a time is supported.

  • 8.1 Windows mail app - single mailbox for multiple accounts as on Windows phone?

    I have an outlook.com account and a microsoft exchange account - windows Phone I can combine the mailboxes of these accounts. I can not figure out how to do it on Windows 8 mail and have to check both and constantly move from one to the other, which is more disruptive as it sounds. Can I view a single mailbox for both accounts in Windows mail 8.1, similar to how I'm currently doing it in Windows Phone 8.0? I must warn you that any response in addition to 'Yes' is followed with a request for an explanation.

    Hi Mathenge,

    Unfortunately, no.  With the Mail application on Windows 8.1, you can have all your email from the Outlook.com account, Gmail, Yahoo! and Exchange in a single application, but not as a unique mailbox.

    You can check out this tutorial and understand the full operation of Windows Mail on Windows 8.1 application

    http://Windows.Microsoft.com/en-in/Windows-8/mail-app-tutorial

    Hope this information helps.

  • Single source for multiple versions

    When compiling for multiple versions, I find myself writing code like this

    #ifdef CURRENT_VERSION_CS5
         #define EVENT Method
         #define HANDLEEVENT HandleMethod
    #else
         #define EVENT Event
         #define HANDLEEVENT HandleEvent
    #endif
    

    and I have to define CURRENT_VERSION_CS5 in project of CS5

    It is based in the sdk sets to the current version?

    #include

    #ifdef kRocketMajorVersionNumberForResource

    #define YOUR_CS_VERSION 5

    #else

    #ifdef kBasilMajorVersionNumberForResource

    #define YOUR_CS_VERSION 4

    #else

    #ifdef kCobaltMajorVersionNumberForResource

    #define YOUR_CS_VERSION 3

    #endif

    #endif

    #endif

    #if YOUR_CS_VERSION > 4
         #define EVENT Method
         #define HANDLEEVENT HandleMethod
    #else
         #define EVENT Event
         #define HANDLEEVENT HandleEvent
    #endif
    

    Voila

    Concerning

    Bartek

  • Single VMDK for multiple virtual machines in esx3.5?

    Hello

    Is it possible to use a single VMDK to host several VM in ESX3.5 or is this feature on the way?  I think the vmware view tech that allows you to host multiple virtual machines to a single image and store only the deltas for VMS replca.

    We organize several ts who are about 12 GB per image, and each server is essentially the same.  It would reduce the space if these could be consolidated at the level of vmware.

    Thank you very much.

    What you are referring to the notion of linked Clones, it's something completely different to share a single VMDK.  with linked clones, you actually run mulitple copies of a single Machine.  This fuinctionality is not available in ESX Raw but is a characteristic of Lab Manager and VMware View Premium.

    If you have found this device or any other answer useful please consider useful or correct buttons using attribute points

    Tom Howarth

    VMware communities user moderator

    Blog: www.planetvm.net

  • Single connection for multiple Applications

    Hello

    I use APEX 4.2.5.

    We have 7 different applications built on different workspaces. We have an obligation to create a Master of Applications that can be used to connect to applications. The user only needs to connect to the main application and it should be able to connect again the different applications without connection.

    I tried to create the Master application on a figure who had access to all the other patterns. Then, I used common cookie for the entire application. But it's not work its asking to log in again.

    All applications use the same authentication schemes.

    Please let me how can know I achieve this.

    Thanks in advance

    Best regards

    Patrick

    ZAPEX wrote:

    We have 7 different applications built on different workspaces. We have an obligation to create a Master of Applications that can be used to connect to applications. The user only needs to connect to the main application and it should be able to connect again the different applications without connection.

    I tried to create the Master application on a figure who had access to all the other patterns. Then, I used common cookie for the entire application. But it's not work its asking to log in again.

    All applications use the same authentication schemes.

    Please let me how can know I achieve this.

    You can not. Sessions can be shared by applications that are part of the same workspace.

    Applications must be moved to a single workspace.

  • Using a single server for Multiple Instances of the APEX HTTP

    Our company DBA asked if it would be possible to outsource the server part of HTTP of APEX from DB servers. In other words, it would be highly preferable as DB servers * only * start the Oracle database software.

    We know that we can install the HTTP server on another box, but in thinking how to that, we were wondering if it's really necessary to create a separate HTTP Server installation for each instance of the APEX. What we would really like to do, is have a HTTP server for all our our boxes of Dev and several (but not one) for each of our superior environments; implementation stage, qa, prod, etc..

    Right now, each instance has a file single dads.conf on every box of DB. So, if we we to try to consolidate, we need some way to incorporate several dads files and associate each correct instance.

    Someone has already done this or (preferably) to have some examples?

    Thank you

    -Joe

    The second page on the link provided José begins immediately with the "Configuration of several databases".

    Yes, you can consolidate permanently. It is a common practice that was also available with Apache/mod_plsql, OSH and now with APEX earphone 2.

    Thank you

    Jorge

  • For multiple business unit, we have same logo. How to display in RTF?

    I am very new to BI publisher.

    I have create a RTF command that contains the Logo of the operating unit.

    Currently, we have 5 operating units. We'd spend logo based on the control unit.

    Currently, we have coded something like that

    <? If: org = 1? > org1image <? endif >
    <? If: org = 2? > org2image <? endif >
    <? If: org = 3? > org3image <? endif >

    for the Org = 4 and org = 5, we want to display the same image. Do we have a logical condition or BI Publisher?
    as
    If (org = 4 or 5 = org)
    4 image display
    end if


    How in RTF?

    Thanks in advance for your answer.
    RK

    Published by: vradhakr on November 1, 2010 14:52

    You can use it as you have in your example itself.

  • Insert into table1 from table1

    Hello

    I tried to insert into table - from select col1, col2, col3 from table b where
    Table - b.change_dt between 't1d' and 'T2D.

    can someone help me with the query

    Thank you
    insert into table-A from select col1,col2,col3 from table-b where
    table-b.change_dt between 'dt1' and 'dt2'
    

    you have an additional 'from', so it will be:

    insert into table-A(col1,col2,col3) (select col1, col2, col3 from table b where)
    Table - b.change_dt between 't1d' and "T2D")

    Please, close your threads, try to clean up the forum.

  • Move the table in same tablespace is not reorganize the data

    Hello.

    I am facing a problem that I have not used to have.  First of all, a description of our envorinnement:

    We have a few large tables partitioned and performance optimization, our ETLs use bluk, add notes, parallelism and so on.  This create several holes of unused space in tablespaces/data files as well a kind of leak of space on our drives.

    A complete correction would re-create the tablespaces move everything is of opposes another.  It would be impratical, because there are about 15 who are top of 100 GB; the time and effort to recreate everything is not affordable for the Business.

    Instead, we have a single proc that comes to calculate the actual amount of used space (converted to blocks) and makes a move of all objects above this block_id.  Just after this operation, there is a dynamic shrink based on the new HWM (given that the objects have been moved) on the data file freeing disk space.  As we have a datafile by tablespace and a tablespace by schema, we would like to keep this body, if we make a single movement for objects, like 'ALTER TABLE' | owner: '. ' || nom_segment | "MOVE; "(the complete query works with all types of data such as partitions of table objects, the index partitions and the subpartions).  This will move the object in the same space for the first freespace on the tables and free up space at the end of the file to shrink.  In theory.

    This unique proc used to work properly.  In a 650 GB GB 530 tablespace in use moving about 20 that Go (the amount of data beyond the HWM 530 GB) is simpler than to create a new file/TBS and the displacement of 20 GB is faster than Go 530.

    But suddenly things changed when some TBS refused to be narrowed.  What I found out: the command move doesn't fail, it works very well and Oracle really moves the object.  But for reasons that I don't know, he's not moving it at the beginning of the file, it keeps the object at the end.  So the da calculates the new HWM, but because some objects that were in the tail of the queue, the shrink is done with a very high HWM, if no real space is reclaimed.

    So, the main question: How does the ALTER TABLE FOO MOVE really works?  I thought that it would be always to move the object to the beginning of the file thus reorganize, but I analyzed the last objects that gave me this problem (block_id before and after the move, compared to block_ids empty and everything) and actually, I see that they were moved at the end of the file, although there is enough space to accommodate initially.

    Okay, I think I found the problem.  Before that I just pulled the script as posted, but then I had the good idea to improve its performance with parallelism, so I added:

    ALTER SESSION FORCE PARALLEL QUERY 16 PARALLELS;

    ALTER SESSION FORCE PARALLEL DDL PARALLEL 16;

    ALTER SESSION FORCE PARALLEL DML PARALLEL 16;

    Returning to prallel not running, that I could reuse the freespace on the beginning of the file, and then narrow it down.

    Obviously, each writing data in parallel mode reuse freespace, I just forgot that a TABLE ALTER MOVE is also a data write operation.  I fell a bit ridiculous, caught in the same trap that I was trying hard.

    Thank you all for the comments and advice.

  • Insert two tables with a single query (same ID)

    Hello

    I want to insert two tables at the same time (with a single request) provided that both records get inserted with the same identifier. How can I do this?
    Table Movies
    id 
    name
    
    Table Category
    movie_id
    cat_type
    (a) insert in the first table, retrieve the id (can be using
    my_sequence.currval
    and then insert into another table.

    question: He brings three queries to the Database, I also suspect that when several people trying to insert there is a problem, I could be wrong.

    I have no other idea.

    Greatly appreciated!

    think you need to do as an anonymous pl/sql block.

    Dim cn As New OracleConnection("DataSource = xx'; user id = xx; password = xx;")
    
    Try
     'build the anonymous pl/sql
     Dim sb as New System.Text.StringBuilder
     sb.Append("declare")
     sb.Append(" l_N number;")
     sb.Append("begin")
     sb.Append("insert into movies (id,name) values (my_sequence.nextval, 'film1') returning id  into l_N;")
     sb.Append( "insert into category values (l_N, 'Category type');")
     sb.Append(" END;")
    
     'create commd object
    
     Dim cmd as New OracleCommand(sb.ToString,cn)
     cmd.Connection.Open()
     cmd.ExecuteNonQuerry()
     cmd.Connection.Close()
     cmd.dispose()
     Catch ex as Exception
    
      blah blah blah
    
    End try
    
      
    

    Published by: pollywog on May 28, 2010 10:48

    Published by: pollywog on May 28, 2010 10:49

  • SQL query to retrieve a single record for each employee of the following table?

    Hi all

    Help me on the writing of SQL query to retrieve a single record for each employee of the following table? preferably a standard SQL.

    CREATE TABLE xxc_contact)

    empnum NUMBER,

    alternatecontact VARCHAR2 (100),

    relationship VARCHAR2 (10),

    phtype VARCHAR2 (10),

    Phone NUMBER

    );

    insert into xxc_contact values (123456, 'Rick Grimes', 'SP', 'Cell', 9999999999)

    insert into xxc_contact values (123456, 'Rick Grimes', 'SP', 'Work', 8888888888)

    insert into xxc_contact values (123457, 'Daryl Dixon', 'EN', 'Work', 7777777777)

    insert into xxc_contact values (123457, 'Daryl Dixon', 'EN', 'Home', 3333333333)

    insert into xxc_contact values (123456, 'Maggie Greene', 'CH', 'Cell', 9999999999)

    insert into xxc_contact values (123456, 'Maggie Greene', 'CH', 'Home', 9999999999)

    expected result:

    EmpNum AlternateContact Relationship PhType Phone       

    123456 rick Grimes SP cell 9999999999

    Daryl Dixon EN work 7777777777 123457

    Home 123458 Maggie Greene CH 6666666666

    Thanks in advance.

    994122 wrote:

    Thank you all, that I got a result

    http://www.orafaq.com/Forum/m/620305/#msg_620305

    By Lalit Kumar B...

    Specifically, the two simple solutions provided were:

    1 using the row_number, entitled Oracle ranking based on descending order of the inside telephone each empnum group. And finally selects the lines which has least rank (of least since that order is descending for phone).

    SQL > column alternatecontact format A20;

    SQL >

    SQL > SELECT empnum, alternatecontact, relationship, phtype, phone

    2 from (SELECT a.*, row_number() over r (PARTITION BY empnum ORDER BY phone / / DESC))

    3 FROM xxc_contact one)

    4. WHEN r = 1

    /

    EMPNUM ALTERNATECONTACT RELATIONSHIP PHTYPE PHONE

    ---------- -------------------- ---------- ---------- ----------

    123456 rick Grimes SP cell 9999999999

    Daryl Dixon EN work 7777777777 123457

    Home 123458 Maggie Greene CH 6666666666

    2. with the help of MAX, Oracle automatically assigns the maximum phone for all the rows in each group of empnum. And finally selects the rows with the maximum phone. Order by clause is omitted here intentionally. You can find out why.

    SQL > SELECT empnum, alternatecontact, relationship, phtype, phone

    2 (SELECT a.*, MAX (phone) over (PARTITION BY empnum) rn FROM xxc_contact one)

    3 WHERE phone = rn

    4.

    EMPNUM ALTERNATECONTACT RELATIONSHIP PHTYPE PHONE

    ---------- -------------------- ---------- ---------- ----------

    123456 rick Grimes SP cell 9999999999

    Daryl Dixon EN work 7777777777 123457

    Home 123458 Maggie Greene CH 6666666666

    Kind regards

    Lalit

  • How to insert the data from the table file?

    I need to know that how can I insert data into multiple columns by file. I can simply insert data into a table of columns, but could not find a way to put the data in the column all.

    My data in a file store
    ************************************************text.txt***************
    133, nanny, nagina, 14 mph, 45637, 9156729863

    **************************************************************my_data(table)**********
    try to insert into table below...

    Name, ID, last_name, add, PIN. Mob

    *********************************************

    Let me know if you need anything else... :))

    Hey nanny.

    In fact, in SQL Developer, you can open a connection to the target schema, right-click on the Tables node in the Navigator tree, select import the data, then use the data import wizard. It is extremely flexible. Looks like you have a file of comma-separated variables, so if you select Format: csv and import method: Insert it will probably work fine.

    To minimize the risk of errors during import, choose a limit value of preview so that the wizard can review the data type and the size of all columns in several lines of data as possible, and then examine the size/type of data for each column on the next page of the wizard and replace if necessary. For date columns, it is also important to choose the appropriate format mask.

    Hope this helps,
    Gary
    SQL development team

  • Insert a table 2D into a 2D array, starting at a specific index

    Hello

    Is it possible to insert a table in another table 2D 2D, starting at a particular index.

    For example, I have a 4 X 100 2D table

    Now, I want to insert a 2 X 50 matrix in the index row 3 and column 50.

    If there are already elements of [3.50] 3 [100] and from [4.50] 4 [100], I would like to replace these items with new table of 2 X 50.

    Is there a way to achieve this goal without doing 1 per 1 item?

    Thank you!

    Best,

    Charles

    Altenbach says:

    Of course, you must do a bit of math, in which case the final table should be greater than the existing table to accommodate the. In this case, you must initialize a new, larger array 2D with a fill element (e.g. NaN), then replace the table 1 at 0,0 and the second table to the desired index.

    Here is a general example, assuming that the padding is necessary. Probably needs a few tweaks. (I've broken your number of lines by 10 to make it easier to see the result. Modify if needed).

Maybe you are looking for