Multiple Insert Statements

Hello,
I have a couple of PL/SQL Anonymous block processes (both On-Submit - After Computations and Validations) on a page that insert a few values into a table.
The first gets the next primary key value from the sequence:
declare
  function get_pk_tran return varchar2
  is
  begin
    for c1 in (select TRANSACTIONS_SEQ.nextval next_val
               from dual)
    loop
        return c1.next_val;
    end loop;
  end;
begin
  :P21_TRAN_ID := get_pk_tran;
end;The second inserts the values into the table:
begin
insert into transactions (TRAN_ID,TRAN_TYPE,TRAN_SUB_TYPE,TRAN_VALUE) values (:P21_TRAN_ID,'Status','Submission','Submitted');
end;I want to insert two more records into the same table upon submission. I could add similar pairs of processes to do this again, but there is probably a more efficient way.
Any suggestions are greatly appreciated!
Thanks
Matt

Hi Varad,
Thanks for your help. That works. I ended up dropping the get_pk_trans function and using this (without returning the tran_id into the page item - seems to work).
begin
insert into transactions (TRAN_ID,TRAN_TYPE,TRAN_SUB_TYPE,TRAN_VALUE) values (TRANSACTIONS_SEQ.nextval ,'Status','Submission','Submitted');
insert into transactions (TRAN_ID,TRAN_TYPE,TRAN_SUB_TYPE,TRAN_VALUE) values (TRANSACTIONS_SEQ.nextval ,'Status','Approval','Pending');
insert into transactions (TRAN_ID,TRAN_TYPE,TRAN_SUB_TYPE,TRAN_VALUE) values (TRANSACTIONS_SEQ.nextval ,'Status','Execution','Not Started');
end;Thanks,
Matt

Similar Messages

  • 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;

  • 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

  • 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

  • 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

  • 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.

  • Multiple insert statements within one DB transaction

    Can I use a Database control to do more than one insert in a Database control method?
    If not , will this feature become available?
    I want to
    1. set autocommit off
    2. insert master record
    3. insert child records
    4. commit

    Steve--
    Glad you got this figured out; I misunderstood what you wanted to do
    -- I thought you actually wanted to call commit(). :)
    Yes, a custom control is the way to aggregate multiple DB control
    calls that need to be treated as a unit relative to the current transaction.
    The "Workshop Internals" document sheds more light on the details of
    how / why this happens.
    http://dev2dev.bea.com/products/wlworkshop81/articles/wlw_internals.jsp
    Eddie
    Steve Hicks wrote:
    Solved (having read my course notes).
    To update different database inserts (or similar) all you have to do is encapsulate
    this in ONE Java Custom Contol Method and then call the various database inserts
    (in my case) in a Database control. The JCC method does a rollback if it exits
    with an exception
    "Steve Hicks" <[email protected]> wrote:
    Tried this but it does NOT work. Would be nice to use a database control
    for this
    since this scenario is common with master/detail tables. I got the following
    error:
    java.sql.SQLException: Cannot call Connection.commit in distributed transaction.
    Transaction Manager will commit the resource manager when the distributed
    transaction
    is committed.
    FOR CODE:
    java.sql.Connection connection = userRequestDB.getConnection();
    connection.setAutoCommit(false);
    userRequestDB.insertUserRequest(userRequestForm);
    connection.commit();
    Eddie O'Neil <[email protected]> wrote:
    Steve--
    One way to do this would be to wrap the DB control in a custom
    control (JCS) or web service. Then, you can call getConnection() on
    the
    DB control and invoke setAutoCommit(false) and commit yourself. Here's
    the DB control interface documentation:
    http://e-docs.bea.com/workshop/docs81/doc/en/workshop/java-class/com/bea/control/DatabaseControl.html?skipReload=true
    This should work, but I haven't tried it myself. :)
    Eddie
    Steve Hicks wrote:
    Can I use a Database control to do more than one insert in a Databasecontrol method?
    If not , will this feature become available?
    I want to
    1. set autocommit off
    2. insert master record
    3. insert child records
    4. commit

  • Rowcount for multiple insert statements

    Hi all,
    Is there a way I can get separate rowcount in multi table insert?
    My sql is written as below:
        INSERT ALL
          INTO TAB1 (COL1, COL2....)  VALUES          (VAL1, VAL2....)
          INTO TAB2 (COL1, COL2....)  VALUES          (VAL1, VAL2....)
            (SELECT * FROM TABLE);
    rowcount of tab1?
    rowcount of tab2?
    Thank you,
    Niroop

    Here is the work around to get the multi-table insert counts.
    SQL>
    SQL> select * from v$version;
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production   
    PL/SQL Release 11.2.0.1.0 - Production                                         
    CORE    11.2.0.1.0    Production                                                     
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production                        
    NLSRTL Version 11.2.0.1.0 - Production                                         
    SQL>
    SQL> DROP PACKAGE utils_pkg;
    Package dropped.
    SQL> DROP TABLE src_tab;
    Table dropped.
    SQL> DROP TABLE tab1;
    Table dropped.
    SQL> DROP TABLE tab2;
    Table dropped.
    SQL>
    SQL> CREATE OR REPLACE
      2  PACKAGE utils_pkg
      3  IS
      4    v_tab1_rec_count pls_integer :=0;
      5    v_tab2_rec_count pls_integer :=0;
      6    FUNCTION fCounter(
      7        pTab_Name IN VARCHAR2)
      8      RETURN NUMBER;
      9    FUNCTION fGetInsCounts(
    10        pTab_Name IN VARCHAR2)
    11      RETURN NUMBER;
    12    FUNCTION fResetCounts
    13      RETURN NUMBER;
    14  END utils_pkg;
    15  /
    Package created.
    SQL> CREATE OR REPLACE
      2  PACKAGE body utils_pkg
      3  IS
      4  FUNCTION fcounter(
      5      pTab_Name IN VARCHAR2)
      6    RETURN NUMBER
      7  IS
      8  BEGIN
      9    IF pTab_Name        = 'TAB1' THEN
    10      v_tab1_rec_count := v_tab1_rec_count +1;
    11    ELSE
    12      v_tab2_rec_count := v_tab2_rec_count +1;
    13    END IF;
    14    RETURN 0;
    15  END fcounter;
    16  FUNCTION fGetInsCounts(
    17      pTab_Name IN VARCHAR2)
    18    RETURN NUMBER
    19  IS
    20  BEGIN
    21    IF pTab_Name = 'TAB1' THEN
    22      RETURN v_tab1_rec_count;
    23    ELSE
    24      RETURN v_tab2_rec_count;
    25    END IF;
    26  END fGetInsCounts;
    27  FUNCTION fResetCounts
    28    RETURN NUMBER
    29  IS
    30  BEGIN
    31    v_tab1_rec_count :=0;
    32    v_tab2_rec_count :=0;
    33    RETURN NULL;
    34  END fResetCounts;
    35  END utils_pkg;
    36  /
    Package body created.
    SQL> CREATE TABLE src_tab AS
      2  SELECT *
      3  FROM
      4    (SELECT 1 col1, 'TEST' col2, 'TAB2_DATA' col3 FROM dual
      5    UNION ALL
      6    SELECT 2, 'TESTING', 'NO_TAB2_DATA' FROM dual
      7    )temp;
    Table created.
    SQL>
    SQL> CREATE TABLE tab1 AS
      2  SELECT col1, col2 FROM src_tab WHERE 1=2;
    Table created.
    SQL>
    SQL> CREATE TABLE tab2 AS
      2  SELECT col3 FROM src_tab WHERE 1=2;
    Table created.
    SQL>
    SQL> SELECT utils_pkg.fGetInsCounts('TAB1') AS tab1_inserts,
      2    utils_pkg.fGetInsCounts('TAB2')      AS tab2_inserts,
      3    utils_pkg.fresetcounts    AS reset_done
      4  FROM dual;
    TAB1_INSERTS TAB2_INSERTS RESET_DONE                                           
               0            0                                                      
    SQL>
    SQL> INSERT ALL
      2  INTO tab1
      3    (
      4      col1,
      5      col2
      6    )
      7    VALUES
      8    (
      9      DECODE(utils_pkg.fcounter('TAB1'),0,col1),
    10      col2
    11    )
    12  INTO tab2
    13    (
    14      col3
    15    )
    16    VALUES
    17    (
    18      DECODE(utils_pkg.fcounter('TAB2'),0,col3)
    19    )
    20  SELECT col1, col2, col3 FROM src_tab;
    4 rows created.
    SQL>
    SQL>
    SQL> SELECT utils_pkg.fGetInsCounts('TAB1') AS tab1_inserts,
      2    utils_pkg.fGetInsCounts('TAB2')      AS tab2_inserts,
      3    utils_pkg.fresetcounts    AS reset_done
      4  FROM dual;
    TAB1_INSERTS TAB2_INSERTS RESET_DONE                                           
               2            2                                                      
    SQL>
    SQL> rollback;
    Rollback complete.
    SQL>
    SQL> INSERT  WHEN 1=1 THEN
      2  INTO tab1
      3    (
      4      col1,
      5      col2
      6    )
      7    VALUES
      8    (
      9      DECODE(utils_pkg.fcounter('TAB1'),0,col1),
    10      col2
    11    )
    12    WHEN col3 = 'TAB2_DATA' THEN
    13  INTO tab2
    14    (
    15      col3
    16    )
    17    VALUES
    18    (
    19      DECODE(utils_pkg.fcounter('TAB2'),0,col3)
    20    )
    21  SELECT col1, col2, col3 FROM src_tab;
    3 rows created.
    SQL>
    SQL>
    SQL> SELECT utils_pkg.fGetInsCounts('TAB1') AS tab1_inserts,
      2    utils_pkg.fGetInsCounts('TAB2')      AS tab2_inserts,
      3    utils_pkg.fresetcounts    AS reset_done
      4  FROM dual;
    TAB1_INSERTS TAB2_INSERTS RESET_DONE                                           
               2            1                                                      
    SQL>
    SQL> rollback;
    Rollback complete.
    Thanks,
    GPU

  • How to execute entire result set of multiple sql statements via sp_executesql?

    I have a query that generates multiple insert statements (dynamic sql).  So when I execute this my result set is a table of sql insert statements (one insert statment per row in my source data table).  Like so:
                 Select 'INSERT INTO [dbo].[Table_1] ([Col1]) VALUES (' +  SrcData + ')' from SourceDataTbl
    How can I completely automate this and execute all these sql statements via sp_executesql?
    My plan is to completely automate and execute all this via an SSIS package.
    As always any help is greatly appreciated!
    fyi-  This is a very simple version of what I am trying to do.  My query probably plugs in 20+ values from the SourceDataTbl into each of the sql insert statements.

    Ah, a small error in Visakh's post, which I failed to observe, and then I added one on my own.
    DECLARE @SQL Varchar(max)
    SELECT @SQL =
       (SELECT 'INSERT INTO [dbo].[Table_1] ([Col1]) VALUES (' +  SrcData +
                ')' + char(10) + char(13)
        from SourceDataTbl
        FOR XML PATH(''), TYPE).value('.', 'nvarchar(max)')
    EXEC sp_executesql @SQL
    Without ", TYPE" FOR XML returns a string when assigned to a variable. The TYPE thing produces a value of the XML data type, so that we can apply the value method and get string out of the XML.
    And why this? Because:
    DECLARE @str nvarchar(MAX)
    SELECT @str = (SELECT 'Kalle Anka & co' FOR XML PATH(''))
    SELECT @str
    SELECT @str = (SELECT 'Kalle Anka & co' FOR XML PATH(''), TYPE).value('.', 'nvarchar(MAX)')
    SELECT @str
    Although the data type is string when , TYPE is not there, it is still XML and characters special to XML are enticised.
    Confused? Don't worry, for what you are doing, this is mumbo-jumbo.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How: multiple insert stmt's in Database Express edition SQL commands GUI?

    I have installed the Express 10g version today and played around with it for a while.
    If I go to the SQL commands GUI and enter one insert like this:
    INSERT INTO pageit (PagID, PagParent, PagName, PagActive) VALUES (19, 17, 'Mango tree', 1)
    then it works nicely:
    But if I do this:
    INSERT INTO pageit (PagID, PagParent, PagName, PagActive) VALUES (20, 17, 'Grape trees', 1);
    INSERT INTO pageit (PagID, PagParent, PagName, PagActive) VALUES (21, 16, 'Animals', 1);
    Then it says:
    ORA-00911: invalid character
    Looks like semicolon is not allowed,
    but if I remove the semicolon then it says;
    ORA-00905: missing keyword
    Is there a way to use multiple insert statements in one go in this GUI at all?
    If not, could someone please recommend how I do this.
    I have exported thousands of insert lines from MySql and I would like to get them into my newly created Oracle table without having to type one line at the time in this gui.
    Any suggestions?
    Then if there is a nice WEB GUI like phpmyadmin for Oracle then I would like to know about that to? (Preferably free)

    I've not done a lot with the express edition, so there may be tools I'm not aware of. There is a dedicated Express Edition forum that may be more helpful for some of these questions.
    I would normally use the command-line SQL*Plus to run a script with a large number of SQL statements. I'd generally prefer, though, to get a comma-separated data file from the other system and load that into Oracle using SQL*Loader for efficiency reasons.
    In Oracle, you would normally only want a single database on a single physical machine. I know in SQL Server that what they call a "database" is roughly equivalent to a "schema" in Oracle, which is created by creating a new user.
    Justin

  • Report with stored proc running multiple stored procedures with insert statement

    Hi,
    I wonder if this is possible in SSRS ... I use the 2012 version (Data Tools).
    I have a report that triggers a stored procedure. See below.
    Within this SP there are 2 insert statements getting data from 2 other SP's.
    When I make a dataset referring to the main SP below, SSRS does not show me any fields at all.
    Is this because it's a SP with insert statements and nested SP's?
    At the end of the SP I make a select so it should see all the fields.
    The parameters @month and @costcenter are multivalue params. I use a special function to convert the multivalues, selected in the report, into a string to pass it correctly to the query (comma separated).
    USE [TestDB]
    GO
    /****** Object:  StoredProcedure [dbo].[_Pink_SP_StandingsRegisterDataset]    Script Date: 15-4-2014 13:31:30 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[_Pink_SP_StandingsRegisterDataset]
    @year INT,
    @month NVARCHAR(50),
    @costcenter NVARCHAR(500),
    @GLaccount NVARCHAR(9)
    AS
    BEGIN
    /* Remove existing content*/
    DELETE FROM _Pink_TB_StandingsRegister
    /* Add records part 1 */
    INSERT INTO _Pink_TB_StandingsRegister
    EXEC _Pink_SP_StandingsRegister @year, @month, @costcenter, @GLaccount
    /* Add records part 2 */
    INSERT INTO _Pink_TB_StandingsRegister
    Type,
    Row,
    Year,
    Month,
    YearDatetable,
    MonthDatetable
    EXEC _Pink_SP_StandingsRegisterDatetable @year
    /* Select all records */
    SELECT *
    FROM _Pink_TB_StandingsRegister
    END
    GO

    Hi bijntjede2e,
    After testing a similar scenario in my own environment, it works well in Reporting Services. In my test, the stored procedure returns all the fields from _Pink_TB_StandingsRegister table in the dataset. Then I select some values from year, month, costcenter
    and Glaccount parameters, it inserts some values in the _Pink_TB_StandingsRegister table. So we can use this stored procedure as the dataset in the report.
    In order to solve the problem more efficiently, I need to clarify some information.
    Are you pass multiple values parameter to one stored procedure correctly? We can refer to the following thread:
    http://social.technet.microsoft.com/Forums/en-US/dbdfa101-cccc-4e9f-aa50-566dc5ebcc27/ssrs-2008-r2-report-dataset-call-a-stored-procedure?forum=sqlrep
    What results are you get when executing the stored procedure in SQL Server Management Studio? Is it works well? We should double those stored procedures.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to insert multiple rows in a single insert statement in MaxDB?

    hi,
    I was looking at syntax but i could not get it right.. may be some could help me.
    // Insert single row works fine
    INSET INTO test_table(column_name) values (value1) IGNORE DUPLICATES
    // Insert multiple rows, doesn't
    INSET INTO test_table(column_name) values (value1), (value2), (value3) IGNORE DUPLICATES
    Can somebody help me with this.
    thanks,
    sudhir.

    Multiple inserts do only work with parametrized statements, usually used in interfaces like JDBC, ODBC etc.
    With static SQL statements it is not possible.
    Regards Thomas

  • Inserting multiple rows using a single Insert statement without using dual

    Hi all,
    i am trying to insert multiple rows using a single insert statement like the below one.
    The below one works fine..
    But is there any other change that can be done in the below one without using dual...
    insert all
    into ps_hd_samp (num1,num2) values (1,1)
    into ps_hd_samp (num1,num2) values (2,2)
    into ps_hd_samp (num1,num2) values (3,3)
    select 1 from dual;

    NiranjanSe wrote:
    Hi all,
    i am trying to insert multiple rows using a single insert statement like the below one.
    The below one works fine..
    But is there any other change that can be done in the below one without using dual...
    insert all
    into ps_hd_samp (num1,num2) values (1,1)
    into ps_hd_samp (num1,num2) values (2,2)
    into ps_hd_samp (num1,num2) values (3,3)
    select 1 from dual;
    SQL> create table ps_hd_samp (num1 number,num2 number);
    Table created.
    SQL> insert all
      2  into ps_hd_samp (num1,num2) values (1,1)
      3  into ps_hd_samp (num1,num2) values (2,2)
      4  into ps_hd_samp (num1,num2) values (3,3)
      5  select count(*)
      6  from ps_hd_samp;
    3 rows created.
    SQL> select * from ps_hd_samp;
          NUM1       NUM2
             1          1
             2          2
             3          3

  • Inserting multiple rows with single insert statement ?

    Hi ,,
    Consider a PL/SQL procedure.
    I want to pass an array of values and insert in a table with a single statement.
    Moreover I want to call this procedure to insert multiple rows from OCI program.
    Can some body help ? :(
    Thanks
    Chandu

    Hi Vincent,
    Regular array insert which you have mentioned works in case of insert statement(This is to eliminate multiple calls to server)
    Will it work for passing array to Stored procedure, in this case procedure will be called only once with an array.
    It will be of great help if you give an example.
    Thanks
    Chandra

  • Mapping multi-segment IDOC to multiple JDBC INSERT statements

    Hi Everyone,
    This is probably going to be easy for the experienced PI developers out there but I'm just starting out in this technology. We are running PI 1.11 and the scenario is as follows. We have a bespoke IDOC message type ZSTOCK which can contain 1-many segments with the following field content:
    WERKS
    MATNR
    VBELN
    ACT_LABST
    AVL_LABST
    For each segment in the source IDOC, I want to generate an INSERT statement to insert a row in an SQL table via the JDBC adapter with the following columns:
    Plant
    Material
    SalesOrd
    ActStock
    AvlStock
    Basically, each field on the source IDOC segment maps directly onto the target column of the SQL table. The problem is, on a multi-segment IDOC only the first segment is generating a row in the SQL table. I've seen a number of threads on this forum that seem to tackle the same issue but the solution is either missing or unclear. I think the solution lies somwhere in the occurrences of the STATEMENT node in my target message type and perhaps specific definitions in the message mapping. Can anyone help solve this mystery?
    Thanks,
    Gary

    Hi Gary
    If you created a data type, try to change occurrence of STATEMENT node to 0..unbounded or 1..unbounded.
    In the message mapping, map the target STATEMENT node with the source 1-many segment.
    You can find [here|http://help.sap.com/saphelp_nw70/helpdata/en/4d/8c103e05df2e4b95cbcc68fed61705/content.htm] more informations about the JDBC structure
    Regards,
    Giuseppe

Maybe you are looking for