OracleCommand + multiple query

I'm making some backup scripts using dbms_metadata.get_dll and and let's say i have a result like that ([...] - i've cut some info, cause it's long):
CREATE TABLESPACE "TEST" DATAFILE
'E:\ORACLEXE\ORADATA\TEST.DBF' SIZE [...]
CREATE TABLE "SYSTEM"."ORACUSTOM"
(     "ID" NUMBER,
     "NAME" VARCHAR2(20),
     PRIMARY KEY ("ID")
USING INDEX [...] TABLESPACE "TEST"
Now I wish to restore it, but if I;m loading the whole text into OracleCommand, got error:
ErrorORA-02180: invalid option for CREATE TABLESPACE
it;s because there is no separation between CREATE TABLE statement, however if i put a semicolor ; before CREATE TABLE - exactly after the last character of CRAETE TABLESPACE command, got:
ErrorORA-00911: invalid character
Is it possible to run it in one OracleCommand (.ExecuteNonQuery), do I need to use some other separation char?
Thx

I believe what you are trying to do is execute all these commands in a single DB round trip. Off the top of my head, there are a couple solutions. You can encapsulate all the commands in a stored procedure or you can use anonymous PL/SQL to batch these commands together.
The first solution is pretty self-explanatory. The second solution would involve some code and encapsulating the commands you want to execute between a BEGIN...END; PL/SQL block. You can also bind parameters, such as the following sample:
string cmdtxt = "BEGIN " +
"OPEN :1 for select ename, deptno from emp where deptno = 10; " +
"OPEN :2 for select ename, deptno from emp where deptno = 20; " +
"OPEN :3 for select ename, deptno from emp where deptno = 30; " +
"END;";
//No need to change the CommandType. Leave it as CommandType.Text
cmd.CommandText = cmdtxt;
//Bind REF Cursor parameters
//Select employees in department 10
OracleParameter p1 = cmd.Parameters.Add("refcursor1", OracleDbType.RefCursor);
p1.Direction = ParameterDirection.Output;
//Select employees in department 20
OracleParameter p2 = cmd.Parameters.Add("refcursor2", OracleDbType.RefCursor);
p2.Direction = ParameterDirection.Output;
//Select employees in department 30
OracleParameter p3 = cmd.Parameters.Add("refcursor3",
OracleDbType.RefCursor);
p3.Direction = ParameterDirection.Output;
//Execute batched statement in one round trip
cmd.ExecuteNonQuery();

Similar Messages

  • How To Delete Multiple Query Elements in a Transport

    Guys,
    How do you delete Multiple Query Elements in a transport in DEV? Or it's not posible.  I tried to select multiple but only one is being deleted.
    Thanks,
    Recca

    Hi Recca,
    As Nanda said, just go to tcode SE03..Click Unlock Objects (Expert Tool)..Paste your TR number (one at a time) then click Unlock..
    Go back to SE10 and delete your TR numbers..
    Regards,
    Loed

  • How to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part

    Hi,
    I want to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part like mentioned below:
    http://server/pages/Default.aspx?Title=Arup&Title=Ratan
    But it always return those items whose "Title" value is "Arup". It is not returned any items whose "Title" is "Ratan".
    I have followed the
    http://office.microsoft.com/en-us/sharepointserver/HA102509991033.aspx#1
    Please suggest me.
    Thanks | Arup
    THanks! Arup R(MCTS)
    SucCeSS DoEs NOT MatTer.

    Hi DH, sorry for not being clear.
    It works when I create the connection from that web part that you want to be connected with the Query String Filter Web part. So let's say you created a web part page. Then you could connect a parameterized Excel Workbook to an Excel Web Access Web Part
    (or a Performance Point Dashboard etc.) and you insert it into your page and add
    a Query String Filter Web Part . Then you can connect them by editing the Query String Filter Web Part but also by editing the Excel Web Access Web Part. And only when I created from the latter it worked
    with multiple values for one parameter. If you have any more questions let me know. See you, Ingo

  • Unable to display results of multiple query in grid in Oracle SQL Developer

    Hi, I am a newbie to this forum and couldn't find the Oracle SQL Developer forum so posting it here.
    My question: How to display multiple query results in grid in Oracle SQL Developer.
    Example:
    select * from Employee;
    select * from Department;
    - when I select both the queries and hit F5 in Oracle sql developer. By default it displays in output window.
    - How to display result of both the queries in Grid.
    Any thoughts on this would be really helpful.
    Thanks in advance.
    Harsh

    Hi Harsh,
    I'd say that the Results grid is designed to only show the results of 1 query at a time. I don't know/can't see how it would display multiple queries at a time.
    I would suggest either joining your tables to create a single query or opening another SQL Worksheet for one of the queries so that you can display the results side-by-side.
    Maybe you could explain what you're trying to do. Why are you trying to display multiple results in the same query grid?

  • Case statement in a multiple query

    Hi everyone,
    This is my first time to use case statement in a multiple query. I have tried to implement it but i got no luck.. Please see below
    set define off
    SELECT g.GROUP_NAME as Market
    ,t.NAME as "Template Name"
    ,t.TEMPLATE_ID as "Template ID"
    ,(SELECT created
    FROM material
    where template_id = t.template_id) as "Date Created"
    *,(SELECT DESTINATION_FOLDER_ID,*
    CASE DESTINATION_FOLDER_ID
    WHEN NULL THEN 'Upload'
    ELSE 'HQ'
    END
    from log_material_copy
    where destination_material_id in (select material_id
    from material
    where template_id = t.template_id ))as "Origin"
    ,(select material_id
    from log_material_copy
    where destination_material_id in (select material_id
    from material
    where template_id = t.template_id)) as "HQ/Upload ID"
    ,(SELECT COUNT (mse.ID)
    FROM MATERIAL_SEND_EVENT mse, material m, creative c
    WHERE mse.MATERIAL_ID = m.MATERIAL_ID
    AND mse.MATERIAL_TYPE_ID = m.MATERIAL_TYPE_ID
    AND m.ASSET_ID = c.id
    AND c.TEMPLATE_ID = t.TEMPLATE_ID) as Sent
    ,(SELECT COUNT (de.ID)
    FROM download_event de, material m, creative c
    WHERE de.MATERIAL_ID = m.MATERIAL_ID
    AND de.MATERIAL_TYPE_ID = m.MATERIAL_TYPE_ID
    AND m.ASSET_ID = c.id
    AND c.TEMPLATE_ID = t.TEMPLATE_ID) as Download
    ,(SELECT 'https://main.test.com/bm/servlet/' || 'UArchiveServlet?action=materialInfo&materialId=' || DESTINATION_MATERIAL_ID || '&materialFolderId=' || DESTINATION_FOLDER_ID
    from log_material_copy
    where destination_material_id in (select material_id
    from material
    where template_id = t.template_id)) as "URL to template on MPC layer"
    --, t.AVAILABLE_FOR_TRANSFER as "Available for transfer"
    FROM template t, layout l, groups g
    WHERE t.LAYOUT_ID = l.LAYOUT_ID
    AND l.ORGANIZATION_ID = g.IP_GROUPID
    AND g.IP_GROUPID in ( 1089, 903, 323, 30, 96, 80, 544, 1169, 584, 785, 827, 31, 10, 503, 1025 )
    ORDER BY g.GROUP_NAME ASC;
    The one in bold is my case statement.. Please let me know what is wrong with this.
    Regards,
    Jas

    I think you're getting the idea, but:
    You're still selecting 2 columns in the (scalar) subquery. Did you read the link I posted for you?
    "a) scalar subqueries - *a single row, single column query that you use in place of a "column"*, it looks like a column or function."
    You must move that query outside, join to template.
    Something like:
    NOT TESTED FOR OBVIOUS REASONS SO YOU'LL PROBABLY NEED TO TWEAK IT A BIT
    select g.group_name as market,
           t.name as "Template Name",
           t.template_id as "Template ID",
           m.created  as "Date Created",
           lmc.destination_folder_id,
           case lmc.destination_folder_id
             when null then 'Upload'
             else 'HQ'
           end as "Origin"
           (select material_id
              from log_material_copy
             where destination_material_id in
                   (select material_id
                      from material
                     where template_id = t.template_id)) as "HQ/Upload ID"
           (select count(mse.id)
              from material_send_event mse, material m, creative c
             where mse.material_id = m.material_id
               and mse.material_type_id = m.material_type_id
               and m.asset_id = c.id
               and c.template_id = t.template_id) as sent
           (select count(de.id)
              from download_event de, material m, creative c
             where de.material_id = m.material_id
               and de.material_type_id = m.material_type_id
               and m.asset_id = c.id
               and c.template_id = t.template_id) as download
           (select 'https://main.test.com/bm/servlet/' ||
                   'UArchiveServlet?action=materialInfo&materialId=' ||
                   destination_material_id || '&materialFolderId=' ||
                   destination_folder_id
              from log_material_copy
             where destination_material_id in
                   (select material_id
                      from material
                     where template_id = t.template_id)) as "URL to template on MPC layer"
    --, t.AVAILABLE_FOR_TRANSFER as "Available for transfer"
      from template t
      ,    layout l
      ,    groups group by
      ,    MATERIAL M
      ,    LOG_MATERIAL_COPY LMC
    where t.layout_id = l.layout_id
       and l.organization_id = g.ip_groupid
       and M.TEMPLATE_ID = t.template_id
       and LMC.destination_material_id in ( select material_id
                                            from   material
                                            where  template_id = t.template_id
       and g.ip_groupid in (1089,
                            903,
                            323,
                            30,
                            96,
                            80,
                            544,
                            1169,
                            584,
                            785,
                            827,
                            31,
                            10,
                            503,
                            1025)
    order by g.group_name asc;

  • Multiple Query/View usage

    "Avoid multiple query execution by assigning a query or view to just one data provider, which is used by all web items."
    could you please explain me the importance of this?

    the data provider is like a variable that you can use in multiple objects (charts, tables, navigational objects, filters, etc...).  If you assign a data provider to query XYZ, then you can assign that data provider to table, chart, and filter objects.  When you filter the data provider, then you also filter the charts and tables.
    If you assign the same query to different data providers and dp1 is used in the filter, dp2 is in the table, etc..., you cannot use your filter to filter your table. 
    It's just a method to link the objects together in an easier manner.
    Brian

  • How to make & edit multiple query report

    hi,
    how to make multiple query report & i have an existing multiple query report when i edit it all the structure gets disturbed whenever i want to add or delete any column from an query.
    how to do this ?
    txs

    Perhaps you have "Flex Mode" selected in the Layout Editor? It's the button next to the padlock button.
    Message was edited by:
    Dave Hemming
    Also PS: Vaguest. Question. Ever.

  • Having multiple query windows open at once.

    I wasn't sure how to phrase it so after some digging I'm resorting to asking on here.
    I've been working out of the 'Joes2Pros' series and I work within SMMS with SQL standard installed locally for playing.
    Most of the time I like to have multiple query windows open to save queries to reference later just for examples.
    My question is that is there a way to ensure a query window is not using any databases so that when I run the lab setup scripts for Joes2Pros I don't encounter any errors without having to close my other query windows?
    Any help is greatly appreciated! Thanks in advance.

    You can accomplish this multiple ways:
    1. Have your windows open with the database context set to master (select master DB in the dropdown on the toolbar) 
    2. "USE master; go" statement as the first line in all your query windows
    3. Before you run your setup scripts, issue a kill command to terminate all other query window sessions (this will still keep the query windows open but they won't be connected to any database)
    Satish Kartan http://www.sqlfood.com/

  • Precalculate a workbook containing multiple query varients in broadcasting

    Hello gurus
    I'm using BW 3.5 version. I have a Sales MIS workbook. That workbook is having four tab pages for regions north, east, west south. I have one single user entry variable for region characteristics. And while saving the workbook I say "Save & reuse the variables". Now user wants to broadcast the workbook in the same fashion. But Broadcast settings only accommodate for 1 variant for precalculation. He is not interested in having 4 mails for 4 regions. Has anyone figured out a way to precalculate a workbook containing multiple query varients?

    I have the same issue as well.  We have upgraded to 7.0, but still running 3.5 queries and 3.5 bex tools except broadcaster.  We are using Broadcaster 7.0 and Analyzer 3.5.  How do you get all the queries to refresh using the variant? 
    When the query properties are set to just 'Refresh query when opening workbook' it will not execute in the Broadcaster (7.0) - Error: u201CSpecify a value for variable Period/Fiscal Year (Interval Entry, Required)"
    When I select the box for 'Save and reuse variable values' and execute through the Broadcaster (with a variant) it run the first, active sheet with the variant but the other sheets reuse the values that were used when saving the favorite.
    How can I get the Broadcaster to refresh all queries in the workbook using the variant ??  Again, we are on Broadcaster/Precalc 7.0 and Analyzer/queries are 3.5
    Thanks!

  • WIS 00015 error- Multiple Query Filters contain a prompt with same name

    Hi
            I am working BOXIR2 environment. I created two prompts at Universe level- one of Date field and one on agency name field.
    syntax for the prompts is
    customerInfo.RSRCE_NAME =  @Prompt('Enter value(s) for AgencyName ','A' , , ,)
    datetable.STARDATE =datetable.STARDATE.STARTDATE =  @Prompt(' 'Enter value(s) for StartDate:','D' , , ,)
    When I include even one of  the prompts in the report I am getting an error WIS 00015 Multiple Query Filters contain a prompt with the same text, but the prompts use a different operand type.
    If I try to change text of one of the prompts in Universe selection statement, then I see the prompt two times in the report.
    Please let me know how to overcome this issue.

    Ok, I've simplified the case.
    Here is the real case :
    Object filter =
    Based on object =
    .[LEVEL01]
    Object filter =
    Based on object =
    .[LEVEL01]
    In WBI query result I take these objects :
    .[LEVEL01]
    .[LEVEL01]
    .[4IUX93YJGXQEHGLX0T0GPNA9Y]
    In query filters, my 2 filters with same text :
    1.
    I run the query.
    Answer to question 'Single Year Period ?' = Period 06 2010
    ==> MDX error
    A database error occured. The database error text is: Echec de l'exécution de la requête MDX SELECT  { .[4IUX93YJGXQEHGLX0T0GPNA9Y] }  ON COLUMNS , NON EMPTY CROSSJOIN( .[LEVEL01].MEMBERS, .[LEVEL01].MEMBERS ) DIMENSION PROPERTIES MEMBER_CAPTION ON ROWS FROM SAP VARIABLES INCLUDING .[Z12010006] INCLUDING .[Z12010006] avec l'erreur Invalid MDX command with . (WIS 10901)
    And you can see that the value sent to both filters is the same and come from the first filter .[Z12010006] instead of applying the value to each filter .[Z12010006] for the first one and .[Z12010006] for the second one.
    Please, notice that if I change the order of this 2 filters in the WBI query, the MDX generated become :
    SELECT  { .[4IUX93YJGXQEHGLX0T0GPNA9Y] }  ON COLUMNS , NON EMPTY CROSSJOIN( .[LEVEL01].MEMBERS, .[LEVEL01].MEMBERS ) DIMENSION PROPERTIES MEMBER_CAPTION ON ROWS FROM SAP VARIABLES INCLUDING .[Z12010006] INCLUDING .[Z12010006]
    Thanks for your help.
    G.OM.

  • Multiple Query Generation from Discoverer?

    Is there anyway we can generate multiple query reports in discoverer plus? I have a daily dashboard which we send out on daily basis which has multiple queries to generate certain numbers. And I have a stored procedure for this. Is it possible to have multiple queries in 1 workbook to generate the report? If yes, then how? If not then, can we have this stored procedure in disco admin tool in a specific business area which basically kicks the SQL and stores the data in a table within that business area and in disco plus tool we can then simply select all the data from that table to generate the report? I would really appreciate if anyone could answer this.
    Thanks,
    K

    Another interesting way you can prepare a table is a method I've just seen using Disco 4.x.
    We've made such a big deal on using triggers recently, that this was so simple, I must admit I never thought of it.
    What the user did was have a function that called a pl/sql routine that did all the work and created the table.
    Then in the Disco workbook, they specified workbook 1 - the first workbook that took in parameters from the users, and passed the parameters into the function (ie: a from date and to date).
    The workbook didn't return any column from any folders, etc. but just presented the calculation that called the function.
    So, in a nutshell, the user runs the first worksheet where 2 parameters are asked for. Then when finished, it means the table is now ready for the real action so they go to the 2nd. worksheet and it just runs without any parameters but refers to the table set up by the first worksheet.
    No parameter passing to the EUL, nothing fancy, but all done in the function that called the pl/sql routine. Very easy.
    So, for you, you should be able to use the same concept, but in batch, run the first worksheet (ie: putting in the 2 parameters), and then just run the 2nd. worksheet once the first is finished and the table setup.
    Hope it helps.
    Russ

  • Adding multiple query into a role

    hi gurus,
    is there any way that i can use to add multiple query (100+) into a role
    Please advice
    thank you

    Dear Ramasamy,
    Please check SAP note   588144, this explains the complete procedure:
    Regards,
    Arvind

  • Maintaining multiple query templates

    Hi,
    We created a generic query templates for SQL Query and this query template does not have any query specified inside the Query Template. The SQL query is assigned inside the xMII transaction. Instead of creating and maintaing multiple query templates for various SQL queries, we created this single query template and we use this query template by assigning the SQL query in xMII Transaction at runtime. Will there be any issues around this approach?
    Thanks,
    Sara

    This approach limits the reusability/maintainability of your queries.  If any query is to be used more than once (e.g. in a UI application or more than one BLS transaction), it makes sense to put it in its own query template.  Also, if you want to take advantage of xMII's caching infrastructure, you should also do this.
    There's also a small possibility in the future (I'm no longer with SAP, but just suggesting it is a possible outcome) that the SQL will not be dynamically assignable to avoid SQL code injection security issue(s).

  • Multiple query results in HashMap

    Hi,
    Can anybody tell me how I can store multiple results of a select query in a HashMap. I basically know how to do it but here is the problem:
    I want the table ids to be the keys and ArraySets containing database data to be the values of the HashMap. But whenever I add a new key/value pair to the HashMap all the values get overridden with the ArraySet I add.
    Here is my code:
    public HashMap getResults() throws Exception {
    Class.forName(org.gjt.mm.mysql.Driver);
    Connection con = DriverManager.getConnection(jdbc:mysql:///myDbName?user=user&password=password);
    HashMap hmResults = new HashMap();
    ArrayList alValues = new ArrayList();
    PreparedStatement preparedStatement = con.prepareStatement("select id, name, email from mytable");
    ResultSet resultSet = preparedStatement.executeQuery();
    if (resultSet != null) {
    while (resultSet.next()) {
    alValues.clear();
    alValues.add(resultSet.getString("id"));
    alValues.add(resultSet.getString("name"));
    alValues.add(resultSet.getString("email"));
    // the next line adds the correct key and value but also overrides all the other values in the HashMap, why?
    hmResults.put(resultSet.getString("id"), alValues);
    return(hmResults);
    The method above returns a HashMap containing the correct keys but the values are all the same.
    What am I doing wrong?
    Thanks for helping me out!

    Because your adding to the HashMap a reference to that ArrayList, not the ArrayList itself. So basically each key in your HashMap references the one ArrayList, which you repeatedly clear and update. In the end, all your keys map to the same reference, which will contain the very last information retrieved from the ResultSet.
    Simple fix... place the ArrayList alValues = new ArrayList() line inside your loop, and each key will be mapped to a different reference.

  • Multiple Query Execution Order

    Is there any way to dictate the order in which multiple queries run?
    Example, I have: Q1 Q2 Q3
    They are not linked and there no master query.
    Any way to tell Q3 to execute first, then Q1, then Q2?
    Message was edited by:
    capital_city

    Hi,
    We cannot specify the order of execution of the Queries in the Data Model.
    Also it is not recommended to have DML statements like INSERT/UPDATE after the 'AfterParamForm' trigger
    My sinsere suggestion for you is to have the procedure (to update rows) invoked in the 'AfterParamForm' trigger. This will avoid dependency between queries in the Data Model
    If your requirement doesn't suit this approach, check if you can have data links between the three queries
    Regards,
    Krrish

Maybe you are looking for

  • Report - Form 9i ERROR

    Hi, when I run a report9i from a form9i I have this error: REP-503: You did not specify the name of a report. The code to run the report is DECLARE repid REPORT_OBJECT; v_rep VARCHAR2(100); BEGIN repid := find_report_object('REPORT85'); v_rep := RUN_

  • Connecting Windows optimized iPod to a new iMac.

    I have an iPod Classic Fifth Generation that was first plugged into my old Windows computer running XP. Well, that computer died and I now have an iMac and a MacBook Pro. I want to sync my iPod with either one of my macs but I've heard that if I were

  • File to Printer .

    Good Morning , I have scenario that is quite similar to Rich H forum. But that forum is not completed.:( Mine is File to Printer scenario for bank and I have somewhat same condition. There is a file sender system  -                file receiver syste

  • What is Field User for Annual Salary

    Hi All, I want to fetch data of Annual Salary of an employee. I can see them in PA20 but when I go to the table PA0008 to find the value of this ( Field - ANSAL ) its not stored all the time. Where can i find the value of Annual Salary if its not pre

  • When trying to run captivate 4 getting a message saying i need to install lastest version of flash player

    just downloaded captivate 4 when trying to open I get a message saying that I need to install the latest version of flash player...which I already had I have uninstalled and reinstalled I have also made sure that it is enabled and working any ideas?