Executing multiple statements after another

Helle guys!
I was just wondering if it is not possible to execute several statements in a row using the Oracle SQL Developer!? Couldn't find any info on that!
I have code like the following and about 200 statements:
INSERT INTO TBL_MATRIX ("Baumart", "9110", "9110.M", "9110.1", "9110.2", "9110.3", "9110.4", "9111", "9130", "9130.M", "9130.1", "9130.2", "9130.3", "9130.4", "9131", "9140", "9150", "9150.15", "9151", "9152", "9160", "9170", "9180", "9190", "91D0", "91D1", "91D1.3", "91D2", "91D3", "91D4", "91E0", "91E0.A", "91E0.S", "91E0.11", "91E0.12", "91E0.13", "91E0.14", "91E0.15", "91E1", "91E2", "91F0", "91T0", "91U0", "9410", "9410.15", "9420")
VALUES ('Flaumeiche', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG');
INSERT INTO TBL_MATRIX ("Baumart", "9110", "9110.M", "9110.1", "9110.2", "9110.3", "9110.4", "9111", "9130", "9130.M", "9130.1", "9130.2", "9130.3", "9130.4", "9131", "9140", "9150", "9150.15", "9151", "9152", "9160", "9170", "9180", "9190", "91D0", "91D1", "91D1.3", "91D2", "91D3", "91D4", "91E0", "91E0.A", "91E0.S", "91E0.11", "91E0.12", "91E0.13", "91E0.14", "91E0.15", "91E1", "91E2", "91F0", "91T0", "91U0", "9410", "9410.15", "9420")
VALUES ('Wacholder', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'hG', 'S');
/Instead of carrying out each query individually there has to be a way to run each of them automatically. Even SQL Server features that function!
Any hints you can give me?
Regards,
Sebastian

Hi,
You should ask this in the [SQL Developer Forum|http://forums.oracle.com/forums/forum.jspa?forumID=260].
Just a quick thought. I think in SQL Dev, you have two options. 1. Run and 2. Run Script (next to the Run iconic button).
Copy all the statements in the editor and hit the Run Script iconic button instead of Run iconic button.
-Arun

Similar Messages

  • Execute functions one after another

    I would like to make a function that could execute other
    functions
    execute the one after another - in a manner that the next
    function is executed only after the one before has finished its
    task
    I have been thinking about how to achieve this but haven`t
    come up with anything good.
    If you have any ideas please share
    Thanks in advance

    hey,
    what you want to is no problem at all. you just need to have
    conditional statements within your main function that tell it when
    to execute your other functions.
    here is an example:

  • Executing Multiple Statements in a Query

    Is is possible to pass multiple statements in a query?
    ie.
    delete from table1
    insert into table1 values(1, 'cat')

    You can use a refcursor to return a result set from Oracle. Very cool and has been present Oracle since 1995 (Oracle 7'ish days). e.g
    procedure foo (arg1 in varchar2, my_cursor in out rc)
    is
    begin
    \t open my_cursor for
    \t select * from nov25t1 where col1 = arg1;
    end;
    This will return a ref cursor from the stored proc. You can use the ref cursor in most programming languages. I happen to be familiar with Java so it would be used as:
    (skipping a lot of code....this is just for demo purposes)
    OracleCallableStatement stmt = conn.prepareCall(....);
    stmt.registerOutParameter(2,OracleTypes.CURSOR);
    stmt.execute();
    //this is the interesting part
    ResultSet rs = (ResultSet) stmt.getObject(2);
    The documentation for ref cursors is in:
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/06_ora.htm#1554
    HTH.
    -Raj Suchak
    [email protected]

  • TSQL Merge - Multiple statements after THEN

    I'm using a MERGE statement to merge two tables.
    When I have a match in keys, but the data is different I want to inactivate the old/existing record with an update statement where I fill the EndDate column with GetDate() and the Active active with false.... (No problem)
    But I also want to insert a new record with the same key, new data, fill startdate with GetDate() and Active with true.
    Is that possible?
    --something like....
    WHEN MATCHED AND NOT (
    MySource.Hash = MyTarget.Hash
    THEN
    -- inactivate old record
    UPDATE
    SET MyTarget.Active = 0
    , MyTarget.DateEnd = GetDate()
    -- insert new version of record
    INSERT (column1, column2, DateStart, Active)
    VALUES (MySource.column1, MySource.column2, GetDate(), 1)
    WHEN NOT MATCHED BY TARGET
    THEN
    -- etc. etc.
     

    My old merge statement looks like:
    MERGE HistoricalStaging.dbo.AddressType as MyTarget
    USING (
    SELECT AddressTypeID
    , Name
    , rowguid
    , ModifiedDate
    , HASHBYTES('MD5', Name + '|' + CAST(rowguid as varchar(60)) + '|' + CAST(ModifiedDate as varchar(24))) as Hash
    FROM Staging.dbo.AddressType
    ) as MySource
    ON MyTarget.AddressTypeID = MySource.AddressTypeID
    -- WHEN FOUND IN SOURCE AND DESTINATION THEN UPDATE
    -- BUT ONLY WHEN HASH IS DIFFERENT
    WHEN MATCHED AND NOT (
    MySource.Hash = ISNULL(MyTarget.Hash, '')
    THEN
    /* Need to change this part */
    UPDATE
    Set MyTarget.Name = MySource.Name
    , MyTarget.rowguid = MySource.rowguid
    , MyTarget.ModifiedDate = MySource.ModifiedDate
    , MyTarget.Hash = MySource.Hash
    , MyTarget.DateEnd = Null
    , MyTarget.Active = 1
    -- WHEN FOUND IN SOURCE, BUT NOT IN DESTINATION THEN INSERT
    WHEN NOT MATCHED BY TARGET
    THEN
    INSERT (AddressTypeID, Name, rowguid, ModifiedDate, Hash, Active, DateFrom)
    VALUES (MySource.AddressTypeID, MySource.Name, MySource.rowguid, MySource.ModifiedDate, MySource.Hash, 1, GetDate())
    -- WHEN FOUND IN DESTINATION, BUT NOT IN SOURCE THEN INACTIVATE
    -- BUT ONLY WHEN DATEEND IS NOT NULL
    WHEN NOT MATCHED BY SOURCE AND (
    MyTarget.DateEnd is null
    THEN -- INACTIVATE INSTEAD OF DELETE
    UPDATE
    Set MyTarget.Active = 0
    , MyTarget.DateEnd = GetDate()
    OUTPUT $action
    But in the in this part
    WHEN MATCHED AND NOT (
    MySource.Hash = ISNULL(MyTarget.Hash, '')
    there is now an update statement that replaces all changed values... But I want to 'close' that old record and insert the new version. (So an update and insert at the same time).

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

  • Multiple statements from one connection causes ORA-0100 Maximum open cursor

    HI,
    I am creating a connection and trying to run 2 statements off the connection. The connection has autocommit as false as I want to commit only after the second statement commits successfully. Upon executing the second statement, I get the ORAC-0100: Maximum open cursor error. I have verified that I have closed all the Preparedstatement and ResultSet in the first statement.
    My code looks like this:
    Connection myConn = DriverManager.getConnection(jdbc:oracle:thin:.....); myConn.setAutoCommmit(false); Savepoint sp = myConn.setSavePoint("save1"); PreparedStatement pstmt = myConn.prepareStatement(...) ResultSet rs = pstmt.executeQuery(); while (rs.next()){ ..... } rs.close(); pstmt.close(); rs=null; pstmt=null; Statement stmt2 = myConn.createStatement(); sql="DELETE FROM TempTable..."; stmt2.executeUpdate(sql);
    I put a breakpoint just before stmt.executeUpdate and verified the open cursor are below the threshold. And as soon as I execute stmt2.executeUpdate,I get the maximum cursor error. Also, I noticed that the number of open cursors jumps to the limit after stmt2.executeUpdate(sql) as verified by the following sql
    select s.sid, s.username,  a.value from v$sesstat a, v$statname b, v$session s where a.statistic# = b.statistic#  and s.sid=a.sid and b.name = 'opened cursors current' and s.username = 'user_name';
    Am I doing something wrong? Is there a better way to execute multiple statements using the same connection and commiting only after the last statement has executed successfully?

    I believe you need to close your connection via myConn.close() as follows:
    PreparedStatement pstmt=null;
    ResultSet rs=null;
    Connection myConn=null;
    try{
    myConn= //put code to get connection in this statement here
    pstmt = myConn.prepareStatement(...)
    rs = pstmt.executeQuery();
    while (rs.next()){
    }finally{
    if(rs!=null)
    rs.close();
    if(pstmt!=null)
    pstmt.close();
    if(myConn!=null)
    myConn.close();
    }

  • Multiple statements in jdbc sender

    Is this possible to execute multiple statement in one sigle call, if it is JDBC sender?

    Hi,
    You can do it calling a stored procedure which execute your multiple statements.
    Regards,
    Carme.

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

  • Invoking 2 SQL statements one after another?

    Hi,
    Is it a good idea to invoke to 2 SQL statements one after another using the same connection & statement object? Some thing like this:-
    method(){
    String insertSql="insert into employee(Name,Age)values(?,?);
    Connection conn=null;
    PreparedStatement pst=null;
    int insertRows=0;
    ResultSet rs=null;
    try{
    conn=getConnection(); //will get the connection object
    if(insertRows==0){
    pst=conn.preparedStatement(insertSql);
    pst.setString(1,"Jason");
    pst.setString(2,"30");
    insertRows=pst.executeUpdate();
    conn.commit();
    if(insertRows>0) {
    pst=conn.createStatement("select * from employee");
    //retrieving the data from the same table
    rs=pst.executeQuery();
    while(rs.next()){
    System.out.println("The name is::"+rs.getString(1)+ " "+rs.getString(2));
    }catch(Exception e){
    }finally{
    try{
    if(pst != null) {
    pst.close();
    pst = null;
    if(rs != null) {
    rs.close();
    rs = null;
    if(conn != null) {
    conn.close();
    conn = null;
    }catch(Exception e) {
    e.printStackTrace();
    Here one more thing is that i want the insertSQL statement to be invoked only once that is in the beginning and the next time the method() is called it should skip the insert block and should only retrieve the data using "select * from employee". How to do it? I tried with few options nothing works.. Please do provide a solution for this... It is really urgent.
    Thanks

    Is it a good idea to invoke to 2 SQL statements one after another using the same connection & statement object? I think what you're asking is if you need a new Connection and/or Statement object for every query. The answer is no. In fact, most applications pool Connections so literally thousands or millions of queries are done in the lifetime of a Connection. You can reuse Statements and PreparedStatements as well as long as you intend on executing the same query.

  • Why there is implicit commit before and after executing DDL Statements

    Hi Guys,
    Please let me know why there is implicit commit before and after executing DDL Statements ?
    Regards,
    sushmita

    Helyos wrote:
    This is because Oracle has design it like this.Come on Helyos, that's a bit of a weak answer. :)
    The reason is that it makes no sense to update the structure of the database whilst there is outstanding data updates that have not been committed.
    Imagine having a column that is VARCHAR2(50) that currently only has data that is up to 20 characters in size.
    Someone (person A) decides that it would make sense to alter the table and reduce the size of the column to varchar2(20) instead.
    Before they do that, someone else (person B) has inserted data that is 30 characters in size, but not yet committed it.
    As far as person B is concerned that insert statement has been successful as they received no error, and they are continuing on with their process until they reach a suitable point to commit.
    Person A then attempts to alter the database to make it varchar2(20).
    If the database allowed that to happen then the column would be varchar2(20) and the uncommitted data would no longer fit, even though the insert was successful. When is Person B going to find out about this? It would be wrong to tell them when they try and commit, because all their transactions were successful, so why should a commit fail.
    In this case, because it's two different people, then the database will recognise there is uncommitted transactions on that table and not let person B alter it.
    If it was just one person doing both things in the same session, then the data would be automatically committed, the alter statement executed and the person informed that they can't alter the database because there is (now) data exceeding the size they want to set it to.
    It makes perfect sense to have the database in a data consistent state before any alterations are made to it, hence why a commit is issued beforehand.
    Here's something I wrote the other day on the subject...
    DDL's issue a commit before carrying out the actual action
    As long as the DDL is syntactically ok (i.e. the parser is happy with it) then the commit is issued, even if the actual DDL cannot be executed for another reason.
    Example...
    We have a table with some data in it...
    SQL> create table xtest as select rownum rn from dual;
    Table created.
    SQL> select * from xtest;
            RN
             1We then delete the data but don't commit (demonstrated by the fact we can roll it back)
    SQL> delete from xtest;
    1 row deleted.
    SQL> select * from xtest;
    no rows selected
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
            RN
             1
    SQL> delete from xtest;
    1 row deleted.
    SQL> select * from xtest;
    no rows selectedSo now our data is deleted, but not committed, what if we issue a DDL that is syntactically incorrect...
    SQL> alter tab xtest blah;
    alter tab xtest blah
    ERROR at line 1:
    ORA-00940: invalid ALTER command
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
            RN
             1... the data can still be rolled back. This is because the parser was not happy with the syntax of the DDL statement.
    So let's delete the data again, without committing it, and issue a DDL that is syntactically correct, but cannot execute for another reason (i.e. the database object it refers to doesn't exist)...
    SQL> delete from xtest;
    1 row deleted.
    SQL> select * from xtest;
    no rows selected
    SQL> truncate table bob;
    truncate table bob
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
    no rows selectedSo, there we have it. Just because the statement was syntactically correct, the deletion of the data was committed, even though the DDL couldn't be performed.
    This makes sense really, because if we are planning on altering the definition of the database where the data is stored, it can only really take place if the database is in a state where the data is where it should be rather than being in limbo. For example, imagine the confusion if you updated some data on a column and then altered that columns datatype to be a different size e.g. reducing a varchar2 column from 50 character down to 20 characters. If you had data that you'd just updated to larger than 20 characters whereas previously there wasn't, then the alter table command would not know about it, would alter the column size and then the data wouldn't be valid to fit whereas the update statement at the time didn't fail.
    Example...
    We have a table that only allows 20 characters in a column. If we try and insert more into that column we get an error for our insert statement as expected...
    SQL> create table xtest (x varchar2(20));
    Table created.
    SQL> insert into xtest values ('012345678901234567890123456789');
    insert into xtest values ('012345678901234567890123456789')
    ERROR at line 1:
    ORA-12899: value too large for column "SCOTT"."XTEST"."X" (actual: 30, maximum: 20)Now if our table allowed more characters our insert statement is successful. As far as our "application" goes we believe, nay, we have been told by the database, we have successfully inserted our data...
    SQL> alter table xtest modify (x varchar2(50));
    Table altered.
    SQL> insert into xtest values ('012345678901234567890123456789');
    1 row created.Now if we tried to alter our database column back to 20 characters and it didn't automatically commit the data beforehand then it would be happy to alter the column, but then when the data was committed it wouldn't fit. However the database has already told us that the data was inserted, so it can't go back on that now.
    Instead we can see that the data is committed first because the alter command returns an error telling us that the data in the table is too big, and also we cannot rollback the insert after the attempted alter statement...
    SQL> alter table xtest modify (x varchar2(20));
    alter table xtest modify (x varchar2(20))
    ERROR at line 1:
    ORA-01441: cannot decrease column length because some value is too big
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
    X
    012345678901234567890123456789
    SQL>Obviously, because a commit statement is for the existing session, if we had tried to alter the table column from another session we would have got
    SQL> alter table xtest modify (x varchar2(20));
    alter table xtest modify (x varchar2(20))
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified
    SQL>... which is basically saying that we can't alter the table because someone else is using it and they haven't committed their data yet.
    Once the other session has committed the data we get the expected error...
    ORA-01441: cannot decrease column length because some value is too bigHope that explains it

  • 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/]

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

  • Where is the focus after executing a statement in worksheet ? (804)

    After executing a statement in the sqlworksheet by hitting the 'execute statement' button, 'execute script' button or ctrl-enter the focus is no longer in the worksheet, forcing us to point/click the mouse to the edit area each time.
    Using pre-release 2.
    Can this be fixed ?
    regards,
    Ronald.

    This loss of focus had been an issue but we did fix this in v804. Did you do a clean install? If so, what os are you installed on? I just double checked on my Windows XP box and my focus was fine.
    -- Sharon

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

Maybe you are looking for