Executing multiple insert statement in oracle

hellor every one,
I have multiple insert statements which should be executed in a single execution and i placed the sample insert statement here. How can i execute these statement in a single execution. Please help me.
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',1,'04509','Abdomen pain');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',2,'04509','Abdominal bloating');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',3,'04509','Abdominal cramps');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',4,'04509','Abdominal pain');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',5,'04509','Abdominal sensitivity');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',6,'04509','Abnormal bleeding');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',7,'04509','Abnormal weight gain');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',8,'04509','Abnormal sensitivity to cold');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',9,'04509','Abnormal sensitivity to heat');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',10,'04509','Abnormal movements');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',11,'04509','Absence of menstrual periods');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',12,'04509','Absence of periods');\
insert into r_symptom_master_tcs (RSM_CRT_DT,RSM_SYM_CD,RSM_CRT_UID,RSM_SYM_DESC) values('30-Sep-2005',13,'04509','Absent menstrual periods');\

> but in what editor we should do this, either in the sql editor, or pl/sql
Whatever editor you are comfortable with. I assume there is one.
btw if there are a lot of INSERT statements in the script it might be worth adding the following to the top:
ALTER SESSION SET CURSOR_SHARING = SIMILAR;

Similar Messages

  • How to execute multiple sql statements in oracle?

    I want to execute multiple statements in a single transaction in oracle. Following are my queries:
    Create table temp_table as Select * from table;
    SELECT * FROM temp_table d;
    drop table temp_table ;
    I am using sql comment text in asp.net
    I am using executenonquery command in asp.net.
    Thanks,
    Divya

    SigCle ,
    Here's an example that executes 3 statements;
    begin insert into foo values(1); insert into foo values(2); insert into foo values(3); end;
    923354,
    The block doesn't compile because temp_table doesn't exist at the point you're trying to compile the anonymous block. I'd recommend re-reading the doc link and forum link provided to get a better understanding of how temp tables work, as it's simply different with Oracle. You don't create Oracle temporary tables on the fly; you create them ahead of time and then just use them. The data itself is already specific to a particular session; you don't create and drop the table each time.
    Also, you can't just "select * from table" in plsql. The results have to GO SOMEWHERE. Usually you'd either open a cursor and process it in the block, or send out a ref cursor if you want to send the data to a client side app. The ref cursor data wouldn't actually be fetched until the block completes though, so you'd need to use ON COMMIT PRESERVE ROWS, which would also mean you'd need to clean up the data yourself (delete the data from the table when you're done with it).
    Corrections/comments welcome.
    Greg

  • How to execute multiple SQL statements thru frontend?

    With SQL Server database, you can execute multiple SQL statements.
    Ex.
    SQLCommand cmd = new SQLCommand();
    cmd.CommandText = "SELECT * FROM EMP; SELECT * FROM DEPT";
    cmd.ExecuteXXX();
    Note that for SQL Server, ";" (semocolon) is used as a separator.
    What separator is required for Oracle ? Or rather, can I execute multiple SQL statements against Oracle database (10g) ?
    (Why I want to do it is a totally diff. subject !)
    Thanks,
    Ami.

    Hello,
    You could use an anonymous PL/SQL block to batch multiple statements.
    If you want to use SELECT statements, you would open a REF CURSOR for each SELECT and return the REF CURSOR to your application. INSERT, UPDATE, and DELETE statements can just be passed as is.
    A simple REF CURSOR example might look like:
    begin
      open :v_refcursor1 for select * from emp;
      open :v_refcursor2 for select * from dept;
    end;Where v_refcursor1 and v_refcursor2 are parameters defined as a REF CURSOR type.
    Hope that helps a bit...
    - Mark

  • Executing multiple DDL statements with OracleCommand

    hi..
    im having trouble executing multiple ddl statements with the the oracle command object. i have tried to enclose them within Begin.. End; block but with no use.
    this problem seems to occur only with DDL statements,.. as my DML like update, delete and Inserts seem to work fine when enclosed within the PL /SQL block.
    single DDL statements also seem to work fine. so im guessing this has nothing to do with priviledges. any ideas?
    my code as follows
    OracleCommand command = new OracleCommand();
    command.CommandType = CommandType.Text;
    command.CommandText = string.Format(@"{0}",script);
    conn.Open();
    command.Connection = conn;
    command.ExecuteNonQuery();
    the script is read from a file, and looks like this. (note : i have removed any line breaks or any other characters)
    BEGIN ALTER TABLE SYSTEMUSER DISABLE CONSTRAINT FK_USER_CLIENT; ALTER TRIGGER SET_SUBSCRIPTION_SUB_I DISABLE; END;
    this is the error i get.
    Oracle.DataAccess.Client.OracleException: ORA-06550: line 1, column 7:
    PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
    begin case declare exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe.

    If I'm not mistaken, we're not allowed to issue DDL inside anonymoue block (or stored procedure) since DDL has implicit commit in it. But you still can execute DDL using EXECUTE IMMEDIATE or using DBMS_SQL package. Try changing your CommandText like this,
    BEGIN
       EXECUTE IMMEDIATE 'ALTER TABLE SYSTEMUSER DISABLE CONSTRAINT FK_USER_CLIENT';
       EXECUTE IMMEDIATE 'ALTER TRIGGER SET_SUBSCRIPTION_SUB_I DISABLE';
    END;Hope this helps,
    [Nur Hidayat|http://nur-hidayat.net/]

  • Create multiple Insert statements from multiselect list

    I want to thank everyone in advance for the help on this one.
    I have a multiselect list that I would like to use to create multiple Insert statements. I would like to then take those statements and execute them against the database, thus inserting the records. My thoughts are below;
    1.     Customer selects multiple items in the list
    2.     Clicks the submit button
    3.     onclick event walks through the string created by the multiselect list and creates the Insert statements by walking through an array of the values.
    4.     the Insert statements get executed against the database
    5.     page redirects to the proper page after the process is done.
    I actually have already created a javascript function that will use the split command on the string to create an array. I then get the length of the array and walk through a loop creating the sql statements. I am not sure what to do from here. How can I get the sql to execute.
    I am not wed to this approach. If there is a better idea out there please do not hesitate to share it with me. I am relatively new to APEX and have not done much work in pl/sql or javascript. But I learn fast, so don’t hold back.
    Thanks again and please let me know what questions you have for me.
    Derek.

    I setup the demo app on apex.oracle.com:
    http://apex.oracle.com/pls/apex/f?p=26255:3
    Login as demo / demo
    Go to the "products" tab. There is a Test region with a multiselect list. It shows product names (with product id's) from the demo_product_info table.
    When you select multiple things from the list and click apply, it uses the following procedure to simply insert a new record for each into the product table. It increments the product_id by 1000 and prepends "DUPLICATE " to the product_name:
    declare
    cursor c_products is
    select product_name, product_id
    from demo_product_info
    where instr(':' || :P3_X || ':', ':' || product_id || ':') >= 1
    order by 1
    begin
    for r_product in c_products loop
    insert into demo_product_info (product_id, product_name)
    values (r_product.product_id + 1000, 'DUPLICATE ' || r_product.product_name);
    end loop;
    end;
    You can see that is working by using it on the duplicate entries themselves.
    -Richard

  • Execute multiple dml statements concurrently.

    Hi all,
    I have a requirement to execute multiple dml statements at the same time. I tried to achieve this using dbms_job, but failed.
    I scheduled 3 dbms_job at the same time. Each job has a bulk insert statement, inserting into a single target table. The 3 jobs kicked off, but there were close a minute apart.
    Is there any other way to achieve this?

    You can launch 3 separate SQL Plus sessions, but how do you execute the dml statements at the same exact time?From my desktop machine, here's how I'd do it:
    Create a dos batch file (runall.cmd for example) that looks like this:
    start some_command.cmd
    start some_command.cmd
    start some_command.cmd
    Then just double click on it. This will lauch some_command.cmd in 3 separate sessions. Each will be launched but will not wait to complete before launching the next.
    Inside the batch file, some_command.cmd, you can have whatever you want. But it will probably be sqlplus.exe with some command line options (one of them a .sql script).
    This is how I've used Tom Kite's "DIY Parallelization". But I normally would have a parameter (like a range or something) to keep the DMLs mutually exclusive.

  • How to execute multiple sql statements

    hi all
    i am wondering if i can execute multiple sql statements in one shot with >> execute immediate command
    for example:
    i define the variable as X := sql statement
    Y := sql statement
    z := sql statement
    can i do execute immediate (X,Y, Z);
    if yes how ?? and if not any possible alternate
    thanks

    Starting with Ganesh's code
    DECLARE
       l_statement                 VARCHAR2 (2000);
       v_passwd                    VARCHAR2 (200);
       v_username                  VARCHAR2 (200) := 'test';
       v_pwd_key                   VARCHAR2 (200) := 'lwty23';
       v_dblink_name               VARCHAR2 (2000);
       v_dblink_drop               VARCHAR2 (2000);
       v_dblink_create             VARCHAR2 (2000);
       v_dblink_check_connection   VARCHAR2 (2000);
       l_number                    NUMBER;
    BEGIN
       --<<c_instance>>
       FOR c_instance IN (SELECT *
                            FROM v_oracle_instances
                           WHERE environment = 'Developement')
       LOOP
          SELECT encpwd_owner.display_db_encpwd (v_username,
                                                 c_instance.host_name,
                                                 c_instance.instance_name,
                                                 v_pwd_key)
            INTO v_passwd
            FROM DUAL;
          v_dblink_name := c_instance.host_name || '_' || c_instance.instance_name;
          v_dblink_create :=
                ' CREATE DATABASE LINK '
             || v_dblink_name
             || ' CONNECT TO '
             || v_username
             || ' '
             || 'IDENTIFIED BY '
             || v_passwd
             || ' USING'
             || ' ''(DESCRIPTION=
    (ADDRESS=(PROTOCOL=TCP)(HOST= '
             || c_instance.host_name
             || ')(PORT='
             || c_instance.LISTENER_PORT
             || '))(CONNECT_DATA=(SID='
             || c_instance.instance_name
             || ')))''';
          v_dblink_check_connection := 'select 1 from global_name@' || v_dblink_name || '.QCM';    --- Notice this change. I am simply selecting 1. That should be enough to test the database link.
          v_dblink_drop := 'drop database link ' || v_dblink_name || '.QCMTLAF';
          -- l_statement := 'BEGIN ' || v_dblink_create ';' || v_dblink_check_connection ';' || v_dblink_drop '; END ;'
          BEGIN
              EXECUTE IMMEDIATE (v_dblink_create);
              DBMS_OUTPUT.PUT_LINE ('DB Link ' || v_dblink_name || ' Created');
         EXCEPTION
            WHEN others THEN
               dbms_output.put_line( 'Failed to create the database link ' || v_dblink_name  );
               dbms_output.put_line( dbms_utility.format_error_backtrace() );
               INSERT INTO error_table( column_list )
                 VALUES( <<list of values>> );
         END;
          EXECUTE IMMEDIATE (v_dblink_check_connection) INTO l_number;    --- Notice this.
          DBMS_OUTPUT.PUT_LINE ('DB Link ' || v_dblink_name || ' Tested');
          BEGIN
             EXECUTE IMMEDIATE (v_dblink_drop); 
             DBMS_OUTPUT.PUT_LINE ('DB Link ' || v_dblink_name || ' Dropped');
          EXCEPTION
             WHEN others THEN
               dbms_output.put_line( 'Failed to drop the database link ' || v_dblink_name  );
               dbms_output.put_line( dbms_utility.format_error_backtrace() );
               INSERT INTO error_table( column_list )
                 VALUES( <<list of values>> );
         END;
       END LOOP;
    END;But I agree with the point that others have brought up that it really doesn't make sense to create and drop a database link like this.
    Justin

  • Executing multiple SQL statements fails using ODBC

    Executing multiple SQL statements will fail with error 'ORA-00911 invalid character' when connecting to an Oracle database using ODBC driver version 8.01.07.00.
    When I use either my application or the Oracle ODBC Test client utility connecting using ODBC driver version 8.01.07.00 I can only get a single CALL statement (as shown below) to execute:
    CALL BHInsert (TO_DATE('2003.07.23 10:04:28','YYYY.MM.DD HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','
    ','Event File
    Name','\\KILLIANS\BATCHCTL\SampleDemo1\JOURNALS\1.evt','','AREA1','','','','','','1','','','','','',' ','');
    When I try to execute the following string with multiple CALL statements (as shown below) it fails with the following error being returned - ORA-00911: invalid character
    CALL BHInsert (TO_DATE('2003.07.23 10:04:28','YYYY.MM.DD HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','
    ','Event File
    Name','\\KILLIANS\BATCHCTL\SampleDemo1\JOURNALS\1.evt','','AREA1','','','','','','1','','','','','',' ','');
    CALL BHInsert (TO_DATE('2003.07.23 10:04:28','YYYY.MM.DD
    HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','Version','Recipe Header','1.0','','AREA1',' ','
    ','','','','1','','','','','',' ','');
    CALL BHInsert (TO_DATE('2003.07.23 10:04:28','YYYY.MM.DD
    HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','Version Date','Recipe Header','5/18/2001 1:28:32
    PM','','AREA1',' ',' ','','','','1','','','','','',' ','');
    CALL BHInsert (TO_DATE('2003.07.23
    10:04:28','YYYY.MM.DD HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','Author','Recipe Header','Mark
    Shepard','','AREA1',' ',' ','','','','1','','','','','',' ','');
    I've tried adding a line feed in addition to the space at the end of each call but that doesn't seem to help. Also have tried unsuccessfully to change the seperator used between each call using various valid continuation characters.
    Executing multiple CALL statements from within Oracle's SQL Worksheet connecting as the same user and password, as my application executes successfully. However when I try this from within the Oracle ODBC test client, it fails with the same ORA-00911 error that I'm seeing in my application.
    I'm currently trying the more recent ODBC drivers, however any ideas or suggestions would be greatly appreciated.

    Can you take the begin ... end block and run it using SQL*Plus?
    I can't think of any documentation that would specifically answer this question. I'm sure if you read & absorbed the ODBC Programmers Reference (2000+ pages) you'd be able to find out, but I don't know of a quick way to find out.
    You can enable SQL*Net tracing. There are a fair number of options for enabling this tracing-- http://tahiti.oracle.com has all the Oracle manuals online, which should give you enough info to configure exactly what you want.
    I would suggest, however, that you look into more performant/ scalable alternatives rather than going too far down this path. A block with lots of SQL statements with literals isn't going to make your database happy even if you get it to work.
    Justin

  • Use Multiple Insert Statements in Prepared Statements

    Hi Friends
    i am stuck in a problem for which i need your help.i will brief you about the issue below.
    I am having Multiple Insert Statements which i need to execute to put the data in the database.i have a doubt about the use of the executeUpdate() function in the statement interface. sample code is as below.
    stmt = conn.prepareStatement("INSERT INTO Client ( clientPk, provincePk, countryPk, statusPk, branchPk, salutation, ) VALUES(PID, 2, '123123123', '123', '66', 1, 1 );");
    int n =stmt.executeUpdate();
    Now the problem is how do i insert multiple Insert statements using the conn.prepareStatement().should i do like
    stmt = conn.prepareStatement("")
    int n =stmt.executeUpdate();
    stmt = conn.prepareStatement("")
    int n =stmt.executeUpdate();
    stmt = conn.prepareStatement("")
    int n =stmt.executeUpdate(); ..................................
    should i use the same steps to execute each individual query and then use executeUpdate().
    Please let me know the correct procedure to be followed to execute these tasks.waiting for a positive reply from your side.
    Thanks & Regards
    Vikram K

    Hi
    Thanks a lot once agin for the reply.
    I think i have figured out the solution. I am using SQL statements in the Prepared statements(""). But now i have dropped the idea of using the prepared statement and decided to use the simple Statement instead.
    what i have done is as below.
    conn = ConnectionFactory.getInstance().getConnection();
    stmt = conn.createStatement();
    stmt.executeUpdate("INSERT INTO Client ( clientPk, provincePk, countryPk, statusPk, branchPk, salutation, heightMeasurementType, weightMeasurementType ) VALUES(PID, '1', '1', '0', '1', 'Mr', CONCAT('Jason ', PID), 'R', 'Mawdsley', '123', '66', 1, 1 );");
    stmt.executeUpdate("INSERT into Cp () Values ()");
    stmt.executeUpdate("INSERT into gp () Values ()");
    stmt.executeUpdate("INSERT into jk () Values ()");
    I think this makes sense to use the Statement and execute all the queries in one shot rather than using PS.
    thanks a lot for your help.
    Regards
    Vikram K

  • Issu for running insert statement in oracle procedure.

    Hi expert,
    I ran a oracle procedure with a insert statement inside as:
    insert into table1 select....
    but I got error message related to this insert statement as "SQLERRM= ORA-08103: object no longer exists"
    I ran this statement separately in toad, no error message, but no data result from this execute.
    please tell how to fix this issue.
    Many Thanks,
    Edited by: 918440 on 27-Jun-2012 8:04 AM

    Hi friend,
    my insert statement is as follows:
            INSERT INTO HIROC_RU_FACT_S   
            select   
                    pp.policy_fk,  
                    pp.transaction_log_fk,  
                    p.policy_no,  
                    p.policy_type_code,   
                    hiroc_rpt_user.hiroc_get_entity_name(pp.policy_fk,'POLHOLDER')  policy_holder,  
                    pp.risk_fk,   
                    r.risk_base_record_fk,   
                    r.entity_fk,  
                    hiroc_sel_entity_risk_name2 (pp.risk_fk,r.entity_fk)  risk_name,   
                    substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2) rating_state_code,  
                    hiroc_get_province_name(substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2), 'PROVINCE_CODE', 'L') rating_state_name,  
                    hiroc_get_provicne_pol_prefix(substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2),p.policy_type_code) rating_prov_pol_prefix,   
                    nvl(r.risk_cls_used_to_rate,pth.peer_groups_code) rating_peer_group_code,  
                    hiroc_get_lookup_desc('PEER_GROUP',nvl(r.risk_cls_used_to_rate,pth.peer_groups_code),'L')  rating_peer_group_name,   
                    pth.policy_term_history_pk,   
                    pth.term_base_record_fk,   
                    to_char(pth.effective_from_date,'yyyy') term_effective_year,   
                    c.coverage_pk,   
                    c.coverage_base_record_fk,   
                    pc.coverage_code,   
                    c.product_coverage_code,   
                    pc.long_description,   
                    pp.coverage_component_code,  
                    c.effective_from_date,   
                    c.effective_to_date,  
                    cls.coverage_code coverage_class_code,   
                    cls.coverage_long_desc coverage_class_long_desc,   
                    decode(pp.coverage_component_code ,'GROSS',cls.exposure_unit,null) exposure_unit, --hiroc_get_expos_units_by_cov(c.coverage_pk,pc.coverage_code,c.effective_from_date,c.effective_to_date) exposure_unit,   
                    decode(pp.coverage_component_code ,'GROSS',cls.number_of_patient_day,null) number_of_patient_day,   
                    pth.effective_from_date  term_eff_from_date,   
                    pth.effective_to_date term_eff_to_date,    
                    pp.premium_amount premium_amount,    
                    (case when (pc.coverage_code in ('CP','MC1','MC2','MC3','MC4','HR','F') or pc.coverage_code like 'ST%') and  
                                  pp.coverage_component_code != 'RISKMGMT' then     
                            (nvl(pp.premium_amount,0))  
                        else  
                            0  
                    end) primary_premium,   
                    (hiroc_get_risk_units(hiroc_get_provicne_pol_prefix(substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2),p.policy_type_code)-- rating_prov_pol_prefix  
                                        ,nvl(r.risk_cls_used_to_rate,pth.peer_groups_code) -- rating_peer_group_code  
                                        ,cls.coverage_code --coverage_class_code  
                                        ,decode(pp.coverage_component_code ,'GROSS',cls.exposure_unit,null)  
                                        ,pp.premium_amount  
                                        ,(case when (pc.coverage_code in ('CP','MC1','MC2','MC3','MC4','HR','F') or pc.coverage_code like 'ST%') and  
                                                      pp.coverage_component_code != 'RISKMGMT' then     
                                                (nvl(pp.premium_amount,0))  
                                            else  
                                                0  
                                         end)  -- primary_premium  
                                        ,p.policy_type_code           
                                        ,trunc(pth.effective_to_date))) risk_units  
             from     proddw_mart.rmv_territory_makeup tm,  
                      proddw_mart.rmv_premium_class_makeup pcm,  
                      proddw_mart.rmv_product_coverage pc,  
                      proddw_mart.rmv_coverage c,  
                      proddw_mart.rmv_risk r,  
                      proddw_mart.rmv_policy_term_history pth,  
                      proddw_mart.rmv_policy p,  
                      proddw_mart.rmv_transaction_log tl,  
                      proddw_mart.rmv_policy_premium pp,  
                      (select  /* +rule */  
                               p.policy_no,  
                               p.policy_start_date,  
                               p.policy_end_date,   
                               r.risk_pk,  
                               r.risk_description,  
                               c.coverage_pk,  
                               c.parent_coverage_base_record_fk,  
                               pc.parent_product_covg_code,  
                               pc.coverage_code,  
                               pc.short_description coverage_short_desc,   
                               pc.long_description coverage_long_desc,  
                               c.exposure_unit,  
                               pc.exposure_basis_code,  
                               c.number_of_patient_day,  
                               p.policy_start_date policy_effective_date,  
                               p.policy_end_date policy_expiry_date,  
                               c.effective_from_date,  
                               c.effective_to_date,  
                               to_char(c.effective_from_date,'YYYY') class_eff_year  
                        from   proddw_mart.odwr_coverage_only      c  
                              ,proddw_mart.odwr_product_coverage   pc  
                              ,proddw_mart.odwr_risk               r  
                              ,proddw_mart.odwr_policy             p  
                        where  pc.code                 = c.product_coverage_code  
                          and  pc.parent_product_covg_code is not null                 -- coverage classes only  
                          and  r.risk_pk = c.risk_base_record_fk  
                          and  c.accounting_to_date = to_date('1/1/3000','mm/dd/yyyy') -- only open records  
                          and  c.base_record_b = 'N'  
                          and  p.base_record_b = 'N'  
                          and  p.policy_pk = r.policy_fk  
                          and  p.accounting_to_date = to_date('1/1/3000','mm/dd/yyyy')  -- only open records  
                       group by p.policy_no,  
                               p.policy_start_date,  
                               p.policy_end_date,   
                               r.risk_pk,  
                               r.risk_description,  
                               c.coverage_pk,  
                               c.parent_coverage_base_record_fk,  
                               pc.parent_product_covg_code,  
                               pc.coverage_code,  
                               pc.short_description, -- coverage_short_desc,   
                               pc.long_description, -- coverage_long_desc,  
                               c.exposure_unit,  
                               pc.exposure_basis_code,  
                               c.number_of_patient_day,  
                               p.policy_start_date, -- policy_effective_date,  
                               p.policy_end_date, -- policy_expiry_date,  
                               c.effective_from_date,  
                               c.effective_to_date,  
                               to_char(c.effective_from_date,'YYYY')-- class_eff_year  
                      ) cls  
                where    tm.risk_type_code = r.risk_type_code  
                and        tm.county_code = r.county_code_used_to_rate  
                and        tm.effective_from_date <= pp.rate_period_from_date  
                and        tm.effective_to_date   >  pp.rate_period_from_date  
                and        pcm.practice_state_code (+) = r.practice_state_code  
                and        pcm.risk_class_code (+) = r.risk_cls_used_to_rate  
                and        nvl(pcm.effective_from_date, pp.rate_period_from_date) <= pp.rate_period_from_date  
                and        nvl(pcm.effective_to_date, to_date('01/01/3000','mm/dd/yyyy')) > pp.rate_period_from_date  
                and        pc.code = c.product_coverage_code  
                and        c.base_record_b = 'N'  
                and        ( c.record_mode_code = 'OFFICIAL'  
                         and (c.closing_trans_log_fk is null or  
                              c.closing_trans_log_fk != tl.transaction_log_pk)  
                         or c.record_mode_code = 'TEMP'  
                         and c.transaction_log_fk = tl.transaction_log_pk )  
                and   c.parent_coverage_base_record_fk is null  
                and        c.effective_from_date  <  c.effective_to_date  
                and        c.effective_from_date  <= pp.rate_period_from_date  
                and        c.effective_to_date    >  pp.rate_period_from_date  
                and   c.accounting_from_date <= tl.accounting_date  
                and   c.accounting_to_date   >  tl.accounting_date  
                and        c.coverage_base_record_fk=pp.coverage_fk  
                and        r.base_record_b = 'N'  
                and        ( r.record_mode_code = 'OFFICIAL'  
                        and (r.closing_trans_log_fk is null or  
                             r.closing_trans_log_fk != tl.transaction_log_pk)  
                        or r.record_mode_code = 'TEMP'  
                        and r.transaction_log_fk = tl.transaction_log_pk )  
                and        r.effective_from_date  <  r.effective_to_date  
                and        r.effective_from_date  <= pp.rate_period_from_date  
                and        r.effective_to_date    >  pp.rate_period_from_date  
                and   r.accounting_from_date <= tl.accounting_date  
                and   r.accounting_to_date   >  tl.accounting_date  
                and         r.risk_base_record_fk = pp.risk_fk  
                and        pth.base_record_b = 'N'  
                and        ( pth.record_mode_code = 'OFFICIAL'  
                        and (pth.closing_trans_log_fk is null or  
                             pth.closing_trans_log_fk != tl.transaction_log_pk)  
                        or pth.record_mode_code = 'TEMP'  
                        and pth.transaction_log_fk = tl.transaction_log_pk )  
                and        pth.accounting_from_date <= tl.accounting_date  
                and        pth.accounting_to_date   >  tl.accounting_date  
                and        pth.term_base_record_fk = pp.policy_term_fk  
                and   p.policy_pk = pp.policy_fk  
                and        tl.transaction_log_pk  =  pp.transaction_log_fk  
                and   pp.active_premium_b = 'Y'  
                and        pp.rate_period_type_code in ('CS_PERIOD','SR_PERIOD')  
                and        pp.rate_period_to_date > pp.rate_period_from_date  
                and tl.accounting_date <= sysdate   
                and p.policy_cycle_code = 'POLICY'  
                and substr(p.policy_no,1,1) <> 'Q'  
                and tl.transaction_log_pk = (select max(pp.transaction_log_fk)  
                                               from proddw_mart.rmv_policy_premium pp,proddw_mart.rmv_transaction_log tl2  
                                              where pth.term_base_record_fk = pp.policy_term_fk  
                                                and pp.transaction_log_fk = tl2.transaction_log_pk  
                                                and tl2.accounting_date <= sysdate )    
                 and p.policy_type_code in ('LIABCRIME','MIDWIFE')    
                 and pth.accounting_to_date =  to_date('01/01/3000','mm/dd/yyyy') --<<<*******  eliminates duplicates  
                 and p.policy_no = cls.policy_no  
            --     and r.risk_pk = cls.risk_pk  
                 and c.coverage_base_record_fk = cls.parent_coverage_base_record_fk(+)  
                 and  cls.effective_from_date < pth.effective_to_date -- from date less than period end date  
                 and  cls.effective_to_date   > pth.effective_from_date -- to date greater than period start date  
                 and  cls.policy_effective_date   < pth.effective_to_date -- from date less than period end date  
                 and  cls.policy_expiry_date     > pth.effective_from_date -- to date greater than period start date  
           group by pp.policy_fk,  
                    pp.transaction_log_fk,  
                    p.policy_no,  
                    p.policy_type_code,   
                    pp.risk_fk,   
                    r.risk_base_record_fk,   
                    r.entity_fk,  
                    substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2), -- rating_state_code,  
                    r.county_code_used_to_rate,  
                    pth.issue_state_code,  
                    nvl(r.risk_cls_used_to_rate,pth.peer_groups_code) , --  rating_peer_group_code,  
                    r.risk_cls_used_to_rate,  
                    pth.peer_groups_code,  
                    pth.policy_term_history_pk,   
                    pth.term_base_record_fk,   
                    to_char(pth.effective_from_date,'yyyy'), --term_effective_year,   
                    c.coverage_pk,   
                    c.coverage_base_record_fk,   
                    pc.coverage_code,   
                    c.product_coverage_code,   
                    pc.long_description,   
                    pp.coverage_component_code,  
                    c.effective_from_date,   
                    c.effective_to_date,  
                    cls.coverage_code, -- coverage_class_code,   
                    cls.coverage_long_desc, -- coverage_class_long_desc,   
                    decode(pp.coverage_component_code ,'GROSS',cls.exposure_unit,null),-- exposure_unit,   
                    decode(pp.coverage_component_code ,'GROSS',cls.number_of_patient_day,null), -- number_of_patient_day,   
                    pth.effective_from_date, --term_eff_from_date,   
                    pth.effective_to_date, --, --term_eff_to_date,    
                    pp.premium_amount ;Edited by: BluShadow on 27-Jun-2012 16:12
    added {noformat}{noformat} tags for readability.  PLEASE READ {message:id=9360002} AS PREVIOUSLY REQUESTED!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           &

  • Issue on execute multiple SQL Statement on MySQL

    Hi,I plan to execute dozenes of INSERT SQL statement on MySQL by JDBC:org.gjt.mm.mysql.Driver,But it throws the unkown exeption,pls kindly help
    The code is like the follwoing
    sql="insert into TEST values('100','test') ";
    stmt=cnMySQL.createStatement();
    stmt.addBatch(sql);
    stmt.addBatch(sql);
    stmt.executeBatch();
    //stmt.executeUpdate(sql);

    The Exception is very tough,paste for all
    javax.servlet.ServletException
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:497)
         at org.apache.jsp.testBean_jsp._jspService(testBean_jsp.java:293)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
         at java.lang.Thread.run(Thread.java:484)
    I have tried another way to execute multiple SQL.But the same Exception ocurred.
    String sql="insert into TEST('100','100V'); "+
    "insert into TEST('100','100V') ";
    stmt.executeUpdate(sql);
    Can't it the jdbc of MM support this kind of operation? And is there any better JDBC for mySQL?
    Apprieciated for all!!!

  • How to execute multiple sql statement?

    In an single transaction I want to execute two update statements. I don't know how to break those statements and send to oracle from Asp.Net to execute.
    I tried go and ; .
    Below is myQuery string*
    update abc set One = 10 where Two = 3 ; update xyz set Three = 10 where Four = 3 ;
    Additional info
    I am using sql comment text in asp.net
    I am using executenonquery command in asp.net.

    Hi,
    If you want to execute multiple statements in a single transaction, you could either:
    a) create a local transaction (via an OracleTransaction object), then call executenonquery multiple times within that transaction, or
    b) pass them all in an anonymous block for a single round trip.. ie, begin update abc set One = 10 where Two = 3 ; update xyz set Three = 10 where Four = 3 ;end;
    The database doesn't permit multiple statements passed at once (other than in a plsql block).
    Hope it helps, corrections/comments welcome
    Greg
    PS, questions such as this would be better posted in the ODP.NET forum; this forum is for issues regarding ODT.NET (a VS plugin)
    ODP.NET

  • Execute A select statement under Oracle connection?

    Hi,
    How can i execute a select statement
    under an existing Oracle connecton without
    defining extera JDBC connection.

    Be aware that you can create View Objects that are NOT based on entity objects. In this case, they are read only, but if you just want to display results, or check for a specific value, it at least reduces the overhead of an EO.
    I'm not sure that answers the question here, but thought I would at least throw it out there.
    In the View Object wizard, on the page that asks you to choose an EO, just click Next without selecting any EOs. This will automatically put you in expert query mode. Just type in your query and go.
    You do have to be a little careful with expert mode queries, especially if you go back and edit them later. You need to make sure to keep the attribute mapping in synch on the Attribute page.
    Also, I have found some limitations to this approach, which I'm not sure are fixed in 3.2. Namely, you can't use setWhereClause() to set the entire where clause string from the client. You have to use setWhereClauseParams(). This means that you have to have the basic where clause included in the query and user parameters as placeholders for the where clause values. These are JSP methods, I'm not sure what the equivalent is in DAC, but I am pretty sure the same limitation is there.

  • Creating Form Manually w/Process that Contains Multiple Insert Statements

    Hello,
    I've been trying to create a form manually by following the instructions in the Users Manual under "Creating Form Manually - Creating a Process that Contains One or More Insert Statements." I have not had much luck and I think that it is because I'm not sure what is ment when said:
    "Create a conditional process of type PL/SQL that executes when the user clicks the button."
    Here is the PL/SQL that I used:
    BEGIN
    UPDATE T
    SET first_name = :P1_FIRST_NAME,
    last_name = :P1_LAST_NAME
    WHERE ID = :P1_ID;
    END;
    I am not sure where to create this process,however. I've tried several areas (i.e. Processes under Page Processing, Processes under Page Rendering, Under Conditions on the Button, etc.) but will get errors or no effect at all.
    Please let me know what i am doing wrong. If you could provide me with a simple example of how to create a form manually, that would be greatly appreciated.
    Thanks.
    Linda
    Message was edited by:
    lhudak

    Hello Scott,
    I followed your instructions and the error that I get is that nothing happens at all. I submit the page and nothing gets updated, deleted or added.
    I have the table, report, processes and form in place. Here are the settings:
    Process Point: is "on-submit, after computations...(in the Page Processing Section)
    Type: PL/SQL anonymous block
    Source: BEGIN
    INSERT INTO T ( first_name, last_name )
    VALUES (:P1_FIRST_NAME, :P1_LAST_NAME);
    END;
    Conditional Processing: When Button Pressed (Create (ADD))
    For the Button:
    Database Action: SQL Insert action
    URL Redirect: No Target
    Should I have any special settings on the Page Item? (i.e. under Default: Default Value Type: PL/SQL Expression) or maybe under Conditions: Condition Type - PL/SQL?
    Please let me know.
    Thanks
    Linda

  • Wish: Executing multiple SQL statements

    I've noticed Raptor, SQL Worksheet, and Toad all execute everything from the beginning even if there was an error. This can be bad if the next statement depended on the first statement being successfull.
    Also, when executing a single statement and you get an error, I've seen a message box pop up saying there was an error. This is annoying. Can there be an option to always put the error message in the script output?
    Could you also have another option to execute a bunch of sql statements starting where the cursor is located? This way, if you were executing say 5 SQL statements, but it failed on the 3rd. You could correct the 3rd SQL statement, and then continue on starting with the 3rd.

    I tried preview 2 (0804), and it is awesome. Thank you so much!
    This time, I didn't have to do anything. It ran out-of-the-box for me on Windows XP using Oracle 9i. I even still have all my other java runtimes and SDK's in the PATH. Nice work ignoring those. This should make my admins happy. And since we don't need to worry about the Oracle client, it will make the DBAs happy. Yay!
    I tried what you mentioned, and it works.
    WHENEVER SQLERROR EXIT FAILURE;
    SELECT 1 FROM DUAL;
    SELECT 2 FROM DUALX;
    SELECT 3 FROM DUAL;
    It stops executing on the SELECT 2 FROM DUALX; which is what I needed.
    1
    1
    1 rows selected
    Error starting at line 4 in command:
    SELECT 2 FROM DUALX
    Error report:
    SQL Error: ORA-00942: table or view does not exist

Maybe you are looking for

  • Disk Utility: MediaKit reports no such partition

    What is up with my disk? On my brand new mac mini, I played around with resizing partitions in Disk Utility, it worked fine, and I eventually returned it to the original single-partition state. Then, I ran boot camp, and told it to create a 10 GB par

  • Using in workflow process the element of Account dimension with subordinate

    Good day All In the dimension Account has been created element, which contains several shared elements. This element has been added as a Parent member when creating a Planning Unit Hierarchy. When we run the workflow process the child shared elements

  • Flash 5.5 Question

    My stepdaughter is having a bear of a time with a Flash 5.5 project. In her words, she can't get the "UI loader to connect to external photos & video". Of course the project is due tomorrow, so any assistance is helpful. The error she is getting is:

  • How to disable conforming in Premiere Pro CS6

    Hello, How do I to disable conforming when I import a video on Premiere CS6. According to the size of the video takes a long time. Only to inform, I Work with Matrox AxioLE card. Thanks in advance.

  • Reformatting for Mac OS X

    Hi Purchased WD Mypassport 1 TB external hard drive formatted for Windows. How do I reformat for Mac OSx 10.8.5?