Running PL/SQL block

Hello


I have a block without a name with some inside and say DML statement that it takes 5 minutes.

I stopped it running customer SQLDeveloper.

My question is, it still continues to run on the server. How we verify that.

Please guide me.

Thank you

Vipin

Hello

He can always run if rollbacking your dml operation. Check the V$ SESSION view to see if your session is still displayed as active. You should also see an entry in the view V$ TRANSACTION if the corresponding transaction is not complete.

Tags: Database

Similar Questions

  • Huge performance difference between stored proc and anonymous PL/SQL block.  Why?

    Hello!  I searched various online resources and have been unable to find those who have addressed this problem, so I hope that someone here may be able to offer advice.

    I have a stored procedure that is approximately 300 lines long, takes no parameters, and sets a record and a few types of internal tables.  When I run it on a particular data set, it takes about 50 seconds at the end of my environment.  Unfortunately, it will have to be performed as a block anonymous PL/SQL instead of a stored procedure, because of the policies that exist about the environment which I deployment.  However, when I converted it to an anonymous PL/SQL block, make no other code changes whatsoever and it connecting the same schema that belongs to the stored procedure, it takes about 6.5 minutes (nearly 8 times as long) to complete.  Aside from the burden of analysis and validation, which could add a fraction of a second, can someone please suggest some possible reasons for the large performance difference and offer advice on what I can do about it?  In which case it is important, the procedure uses in bulk binds (for example, in bulk collect, forall) where it makes sense and doesn't call other objects in PL/SQL.  Thanks in advance.

    Without seeing your code, it is difficult for me to contribute more.

    Note also that...

    1 roles are turned on in the anonymous blocks but not (at least not by default) in the stored procedures. This is why the anonymous block could have MORE rights (those granted through roles) probability that you can get more items through anonymous block.

    2. ensure that, in both cases, it does reference the same target tables.

    Debug by calculating the difference of time after certain steps in your code. Who should get an idea on this or activate the trace.

  • "Declaration of execution" and anonymous PL/SQL blocks

    I often use control - enter to execute the statement that the cursor is currently over.  Normally, this works very well.  But it's a little twisted once I added an anonymous PL/SQL block to the worksheet.  As long as the anonymous block is the last thing on the spreadsheet, I can "run statement" as usual.  But if I add a SQL queries after an anonymous block and try to run the statement, rather than just the running query, SQL Developer aims apparently to compile everything since the beginning of the first anonymous block until the current as a block statement.

    For example, if I have a spreadsheet as follows:

    SELECT 1 FROM DUAL;  --run statement on this line works as expected, running just this query
    
    BEGIN  --run statement anywhere within this block works as expected, running just this block
      DBMS_OUTPUT.PUT_LINE('X');
    END;
    
    SELECT 1 FROM DUAL; --run statement on this line goes back to the "BEGIN" on line 3 and gives a compilation error
    

    It is a nuisance major for me, as I have often a mixture of SQL and anonymous blocks on a worksheet.  I know that I can point out that the code I want and execute statement in this way, but I'd rather not have to do.  I was expecting that developer SQL would be smart enough to know where each block begins / ends and realize my current statement is not part of the block above him. Is there a setting that can change this behavior?  Or is it the way it is supposed to work?

    Whatever it is, thanks for the excellent tool.

    Add a ' / ' at line 5 and line 5 to line 6 bump

  • First execution of pl/sql block is slow.

    Hello

    I've implemented TimesTen to improve performance of an Oracle pl/sql block.

    To do this, I created some cachegroups in TimesTen for caching oracle data.

    After everything is done on TimesTen, when we execute the pl/sql block on TimesTen, I observed that it took 35 seconds for the first run time on Timesten (compared with 48 seconds on Oracle).  The next run of the same pl/sql block with the same parameters take only 6 seconds. I want to achieve the same flow rate (6 sec) when the pl/sql block is executed for the first time. Can you please suggest what exactly I should look into.

    Thank you

    Amit

    Ye, it's a phenomenon known as I mentioned, but the 'hit' on the first run is usually not nearly this big. However, Windows as a platform is suffering more than most from this phenomenon and also Windows supports only not MemoryLock = 4, which further compounds the issue.

    Would you happen to have an available Linux system where you could test this with MemoryLock = 4, just so we can see what the difference between Linux and Windows? I think it would be a very useful thing to study to quantify how much this is due to Windows itself.

    A 'workaround' could be just application make a 'fake' execution of the PL/SQL procedure, immediately after I start and then all 'real' subsequent executions will be fast.

    Chris

  • How to truncate the table in a pl/sql block

    Hello guys, I'm trying to truncate a table that includes data using a pl/sql block, so if the table has even a single row then the truncate should run. to do this, I wrote the following code


    declare
    number num.
    Start
    Select count (*) in the num from table_name;
    If num > 0 then
    truncate table table_name;
    end if;
    end;

    Now, when I execute the pl/sql block, I get the following error.

    PLS-00103: encountered the symbol "TABLE" when the expected in the following way:

    When I run the truncate without pl/sql command, it runs very well.

    Can someone please where I'm wrong.

    Thank you

    Published by: 969224 on April 23, 2013 08:08

    969224 wrote:
    Hello guys, I'm trying to truncate a table that includes data using a pl/sql block, so if the table has even a single row then the truncate should run. to do this, I wrote the following code

    declare
    number num.
    Start
    Select count (*) in the num from table_name;
    If num > 0 then
    truncate table table_name;
    end if;
    end;

    Now, when I execute the pl/sql block, I get the following error.

    PLS-00103: encountered the symbol "TABLE" when the expected in the following way:

    When I run the truncate without pl/sql command, it runs very well.

    Can someone please where I'm wrong.

    Thank you

    Published by: 969224 on April 23, 2013 08:08

    DDL is not allowed directly within PL/SQL procedures.

    You must (ab) use EXECUTE IMMEDIATE issuing the DDL

  • Same code running in SQL * more edit the sql buffer vs = different results file

    Hello

    For the last few minutes I was scratching my head trying to understand why my little piece of code was not working.
    As a result, a sample:
    create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
    /
    declare
      booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');  
    begin
      for i in booklist.FIRST .. booklist.LAST LOOP
        dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      end loop;
    end;
    /
    When run interactively, I get the following results:
      1  create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  /
      3  declare
      4    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      5  begin
      6    for i in booklist.FIRST .. booklist.LAST LOOP
      7      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      8    end loop;
      9* end;
    SCOTT@ORCL> /
    
    Warning: Type created with compilation errors.
    
    SCOTT@ORCL> show errors
    Errors for TYPE BOOKTITLES_NT:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    2/1      PLS-00103: Encountered the symbol "/"
    So I try without the slash and get nowhere:
      1  create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  declare
      3    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      4  begin
      5    for i in booklist.FIRST .. booklist.LAST LOOP
      6      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      7    end loop;
      8* end;
      9  /
    
    Warning: Type created with compilation errors.
    
    SCOTT@ORCL> show errors
    Errors for TYPE BOOKTITLES_NT:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    2/1      PLS-00103: Encountered the symbol "DECLARE"
    8/4      PLS-00103: Encountered the symbol "end-of-file" when expecting
             one of the following:
             ( begin case declare end exception exit for goto if loop mod
             null pragma raise return select update while with
             <an identifier> <a double-quoted delimited-identifier>
             <a bind variable> << continue close current delete fetch lock
             insert open rollback savepoint set sql execute commit forall
             merge pipe purge
    So I think, maybe I'll try it in a .sql file. So I put the first fragment of code in a file, test4.sql:
    SCOTT@ORCL> get C:\Users\J\Documents\SQL\test4.sql
      1  create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  /
      3  declare
      4    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      5  begin
      6    for i in booklist.FIRST .. booklist.LAST LOOP
      7      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      8    end loop;
      9* end;
    SCOTT@ORCL>
    and run it, and it works:
    SCOTT@ORCL> @C:\Users\J\Documents\SQL\test4.sql
    
    Type created.
    
    Book number 1:Great Expectations
    Book number 2:Ulysses
    Book number 3:1984
    
    PL/SQL procedure successfully completed.
    Can someone tell me why the behavior is different when it is run from a file when it is run, well, interactive? There seems to be some limits on what you can interactively run vs. what you can run from a script.

    Thank you very much
    Jason

    SQL * more buffer cannot contain more than one return, even if you have two - create type and anonymous PL/SQL block. Thus it-error:

    Wrote file afiedt.buf
    
      1  create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  /
      3  declare
      4    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      5  begin
      6    for i in booklist.FIRST .. booklist.LAST LOOP
      7      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      8    end loop;
      9* end;
    SQL> /
    
    Warning: Type created with compilation errors.
    
    SQL> create or replace type booktitles_nt is TABLE OF VARCHAR2(100);
      2  /
    
    Type created.
    
    SQL> declare
      2    booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984');
      3  begin
      4    for i in booklist.FIRST .. booklist.LAST LOOP
      5      dbms_output.put_line('Book number ' || i || ':' || booklist(i));
      6    end loop;
      7  end;
      8  /
    Book number 1:Great Expectations
    Book number 2:Ulysses
    Book number 3:1984
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    SY.

  • pl sql block does nothing

    I have a pl/sql block and it does nothing why?

    The code is as follows:

    DECLARE @day varchar (10)

    BEGIN


    Set @day =' select to_char ('sysdate', 'DAY') of double;

    IMPRESSION @day

    END;

    Any ideas would be very appreciated.

    Thank you!

    The minimum code required to do this is:

    set serveroutput on
    SQL> set serveroutput on
    SQL>  begin
      2     dbms_output.put_line ( to_char ( sysdate, 'DAY' ) );
      3     end;
      4   /
    FRIDAY
    
    PL/SQL procedure successfully completed.
    

    If you do not use a variable instead, you do not need to make a selection in this case, standard SQL features available in PL/SQL
    Note that:
    (i) ' set serveroutput we ' must be defined once per session.
    (II) semicolon ";" at the end of each statement, and
    (III) "/" tells SQLPlus "I'm done, please compile and run.

    SQL> declare d varchar2(10);
      2  begin
      3  d := to_char ( sysdate, 'DAY' );
      4  dbms_output.put_line ( d );
      5  end;
      6  /
    FRIDAY
    
    PL/SQL procedure successfully completed.
    

    You have already shown a version using the ' select... in... from double '-that was the only way to do this in earlier versions, and of course, is how to get real data from real tables.

    T/SQL and PL/SQL are very different... you have been pointed out the docs, go read and keep reading and reading, reading and...

  • Where does a PL/SQL block? PGA or CMS?

    Hi all

    11g

    I'm not familiar with the structure of oracle memory, if I have a pl/sql block like below
    DECLARE
      v1 number;
    BEGIN
      v1:=100;
      DBMS_OUTPUT.PUT_LINE(v1);
    END;
    in my mind, even if it's a small block, when I run it, it would also consume little memory, this memory whence, pga or CMS?

    in other words, when "pl/sql engine" needs little memory, for example, for local variables, this memory whence?

    Thank you very much.

    I would say that the PL/SQL variables are distributed in the PGA for dedicated server sessions:
    >
    The PGA is a memory segment that contains session-dependent variables required by a dedicated or shared server process. The server process allocates memory structures that it needs in the PGA.
    >

    11.2 Guide of http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/memory.htm#CNCPT803 Concepts.

    What is certain, is that PL/SQL collections are allocated from PGA depending on "PGA memory Automatic Allocation" in http://www.oracle.com/technetwork/issue-archive/2007/07-mar/o27asktom-084983.html

  • leave a pl/sql block

    Hi all. I'm on oracle 9i.

    I have a problem: I start my sql file, which has a share of some SQL commands and in it there is a part which is a PL/SQL block.
    What I want is that if a certain if the condition is verified, he must get out of the PL/SQL block and also he must leave all files!

    Here is a part of the code:

    drop table test1;
    create table test1
    in select * from test2;

    create the table prova_test1
    in select * from test_1
    where 1 = 2;


    DECLARE
    number of account: = 0;
    Valore number: = 0;
    contap number: = 0;
    valorep number: = 0;
    Stop varchar2 (2000): = null;
    BEGIN


    Select count (1), sum (val) contap, valorep
    of prova_test1;

    Select count (1), sum (val) in conta, valore
    of test_1;
    If conta <>contap or valore <>valorep then

    Training: = "exit";
    run immediately stop;
    on the other
    other sql statements.
    ....
    ....
    end if;
    end;
    /

    So what I want is that if the condition is true, he must get out of pl/sql block and the entire process.
    How can I achieve that?
    Thank you for the collaboration,
    Fabrizio

    Simply - what you want to do is not easy to do because you mix server with client code code and wait for the two to work in perfect harmony as if it were a single whole. It is not the case.

    PL/SQL code is sent to Oracle and PL/SQL anonymous blocks. They are analysed. Executed. Then, control is returned to SQL * more. SQL * more is do not have a "programming language" - it has a few macro commands. It does not support conditional processing logic (there is no IF command in SQL * more).

    To achieve what you want, you need to tell SQL * over how to respond to the mistakes of the Oracle server. Should continue despite the error? Should it end?

    For example

    -- // client call
    whenever sqlerror continue
    
    -- // server call: should this result in an error, continue processing
    drop table foo;
    
    -- // client call
    whenever sqlerror exit failure
    
    -- // server call: should this result in an error (exception), terminate processing
    begin
       .. pl/sql code..
    end;
    /
    
    ..etc..
    

    Very sure that you do not confuse the side Server and client - side you need to know exactly what is running on the server (SQL and PL/SQL) and how the client makes the call to the server, and how he responds after the call to the server is made.

  • pl/sql block, reading the reading of data from the table to a single point in time

    I'm trying to figure out if several cursors in a PL/SQL block are executed inside a single Point in time, and so don't see no updates of paintings by other processes or procedures running at the same time.

    The reason why I ask is I have a block of code as an initial extraction of data, with some Sanity Check before the code runs. However, if another procedure might modify the data between the two, then the mental health check is not valid. So I am essentially trying to know if there is consistency read in a PL/SQL, preventing updates to other processes to be seen.

    Anyone who has an idea?
    BR,
    Chambaz

    Google SET Transaction.

    or

    Follow this link

    http://download-West.Oracle.com/docs/CD/B12037_01/server.101/b10759/statements_10005.htm

    Kind regards
    Prazy

  • update happens inside the anonymous PL/SQL block

    Hello

    I use oracle 10g 3.2.
    I'll have a report with checkbox (separate column) so that only certain lines that I chose, I am able to update db.
    At the click of a button following the anonymous PL/SQL block, I'll call you.

    I use the "anonymous PL/SQL block following. The update happens.

    F112_CHECKBOX is a level applocation element

    Start
    : F112_CHECKBOX: = HTMLDB_UTIL. TABLE_TO_STRING (HTMLDB_APPLICATION. G_F01, ",");

    Insert into dumy values(:F112_CHECKBOX);
    commit;

    update set patient_id_code = '123' exp where f_id = 1 and patient_id_code = '12345' and method_internal_index in (: F112_CHECKBOX);
    end;

    The problem is with F112_CHECKBOX. The values I get in F112_Checkbox properly (in the dumy table I checked it shows) but by updating its not taking.
    Can someone tell me something wrong with the syntax of update? method_internal_index column is varchar2 (100).

    Thank you
    Olivier

    The problem is that: F112_CHECKBOX is a string that contains a list of values that you want to update.
    You cannot use it in an IN clause because in doing so, you are running something like:

    update exp
    set patient_id_code='123'
    where f_id=1
    and patient_id_code='12345'
    and method_internal_index in ('111,222,333,444');
    

    This is equivalent to:

    update exp
    set patient_id_code='123'
    where f_id=1
    and patient_id_code='12345'
    and method_internal_index = '111,222,333,444';
    

    And cannot find any line to be updated.

    You can change your update in this way:

    update exp
    set patient_id_code='123'
    where f_id=1
    and patient_id_code='12345'
    and ','||:F112_CHECKBOX||',' like '%,'||method_internal_index||',%' ;
    

    Ensure that: F112_CHECKBOX contains no spaces...

    Max
    http://oracleitalia.WordPress.com

  • A question about the count of several lines of table in a PL/SQL block

    Hi all




    I have a problem on counting the rows from several tables in a PL/SQL block, and I would be grateful if you could kindly give me a helping hand. Here's my problem: file in Microsoft Excel (one column) I have a list of several names of tables. For each table, when the number of rows is equal to 10000 I have to call a procedure. Here's how I tried to do:
    DECLARE
         CURSOR tb_cursor IS
              WITH my_table_names AS
                   (
                        SELECT  'table1'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table2'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table3'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table4'  AS tbname  FROM  DUAL  UNION
                        .
                        .  Here I continue writing one line for each table in order
                        .  to have the table names stored in my Excel file as a table 
                           to be queried by SELECT statement
                        .
                   )
              SELECT *
              FROM my_table_names;
    BEGIN
         -- Here I verify that for each table having more than 10000 lines
         -- I call the specified procedure which is needed
         
         FOR I IN tb_cursor LOOP
              DECLARE
                   -- Here I declare a cursor for counting the number of rows
                   CURSOR currentTableRowCounter IS
                        SELECT COUNT(*) AS rowsNum
                        FROM I.tbname;
                        
                   numberOfRows currentTableRowCounter%ROWTYPE;
              BEGIN
                   OPEN currentTableRowCounter;
                   FETCH numberOfRows INTO numberOfRows;
                   CLOSE currentTableRowCounter;
                   
                   IF (numberOfRows.rowsNum > 10000) THEN
                        -- And here I will call the procedure which has to be run
                   END IF;
              END;
         END LOOP;
    END;
    /
    I already checked this code with tables inividual and it works. The only problem is
    . . .
    SELECT COUNT(*) AS rowsNum
    FROM I.tbname;
    . . .
    Indeed, oracle considers "I.tbname" as an unknown table name (although he refers to by its exact name).
    SQL> @script.sql
    
                                    FROM I.tbname;
                                           *
    ERROR at line 99:
    ORA-06550: line 99, column 12:
    PL/SQL: ORA-00942: table or view does not exist
    How can I solve this problem? I mean, how to use a variable (in my example, I.tbname) as the table name in the FROM clause to query a table instead of explicitly write the name of the table?





    Thanks in advance,
    Dariyoosh

    Replace the following code:

              DECLARE
                   -- Here I declare a cursor for counting the number of rows
                   CURSOR currentTableRowCounter IS
                        SELECT COUNT(*) AS rowsNum
                        FROM I.tbname;
    
                   numberOfRows currentTableRowCounter%ROWTYPE;
              BEGIN
                   OPEN currentTableRowCounter;
                   FETCH numberOfRows INTO numberOfRows;
                   CLOSE currentTableRowCounter;
    
                   IF (numberOfRows.rowsNum > 10000) THEN
                        -- And here I will call the procedure which has to be run
                   END IF;
              END;
    

    By the following:

    Declare
      numberOfRows number;
    begin
      EXECUTE IMMEDIATE 'select count(*) from '||I.tbname into numberOfRows;
    
      IF (numberOfRows.rowsNum > 10000) THEN
        -- And here I will call the procedure which has to be run
      END IF;
    end;
    

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/10/crittografia-in-plsql-utilizzando-dbms_crypto/]

    Published by: Massimo Ruocchio, January 12, 2010 15:25
    Added Variable Declaration

  • How to trigger a process of transformation of line automatic (DML) + custom PL/SQL block

    I want to start a process of transformation of automatic line (DML) as well as a custom PL/SQL (stored procedure) block. How can I do this? The ARP process is also triggered by another button in the page, but without the PL/SQL block.

    Both in concrete: I have a 'save changes' button and a button "save changes and perform necessary tasks. For the first button, the ARP has fired, to the other, the ARP has triggered + a PL/SQL block that calls a stored procedure that is extra. How can I do this?

    Tom,

    And the ARP has a sequence number that is less than the OTHER_PROC? You can change the status of the ARP, rather than be triggered by your request to SAVE button, it runs when:

    Request is contained in the Expression 1

    where 1 Expression has the value:

    ECONOMY, APPLY_OTHER_CHANGES

    Or ask your shipment of buttons.

    It should run any process with a matching condition, even after the ARP. OTHER_PROC should get run thereafter, based on the corresponding application.

    Thought, have another you noticed this info on the form of editing process?

    Update validates the values of request: SAVE, APPLY the CHANGES, UPDATE, UPDATE, MODIFY, APPLY, APPLY LINE of CHANGES %, GET_NEXT %, GET_PREV %

    So the query of your button name must match one of the people. I guess that the last 3 will match AS expressions, so your OTHER request button could be APPLY_OTHER_CHANGES.

    I hope that does it for you, otherwise I feel really stupid! :-/

    Stew

  • An update of LOOP in a PL/SQL block

    Every afternoon.

    I have a chart of accounts. Some of these accounts will have several numbers associated to them - other accounts will have just the number of accounts. The initial sequence number for each account is already set by another piece of code. There is a column in the table that details the next number in the sequence - so by joining the table to itself and from sequence number one - account I managed to create an exact sequence of account numbers, for each account we have.

    The question I have is that the script is long enough, and new account numbers can be added all the time. If the script must be maintained and added if necessary. There are currently 65 steps in the update below script.

    -UPDATED 2ND SEQUENCE NUMBER
    UPDATE ACCOUNT_LIFECYCLE
    GAME SEQUENCE = 2 WHERE ACCOUNT_NUMBER IN (SELECT B.ACCOUNT_NUMBER FROM ACCOUNT_LIFECYCLE A, ACCOUNT_LIFECYCLE B WHERE A.SEQUENCE = 1 AND A.NEXT_ACC_NO = B.ACCOUNT_NUMBER)
    /

    -UPDATED 3RD SEQUENCE NUMBER
    UPDATE ACCOUNT_LIFECYCLE
    GAME SEQUENCE = 3 WHERE ACCOUNT_NUMBER IN (SELECT B.ACCOUNT_NUMBER FROM ACCOUNT_LIFECYCLE A, ACCOUNT_LIFECYCLE B WHERE A.SEQUENCE = 2 AND A.NEXT_ACC_NO = B.ACCOUNT_NUMBER)

    /
    -UPDATED 4TH SEQUENCE NUMBER
    UPDATE ACCOUNT_LIFECYCLE
    GAME SEQUENCE = 4 WHERE ACCOUNT_NUMBER IN (SELECT B.ACCOUNT_NUMBER FROM ACCOUNT_LIFECYCLE A, ACCOUNT_LIFECYCLE B WHERE A.SEQUENCE = 3 & A.NEXT_ACC_NO = B.ACCOUNT_NUMBER)

    /

    think that this can be achieved in a small PL/SQL block, which would be effectively loop through iterations. I currently run the following query to verify the number of account numbers (to establish if I need to add more steps) - this could be defined as a variable binding?

    Select max (count (original_account_number)) of the ACCOUNT_LIFECYCLE group by original_account_number;

    Anyone has stumbled across any material on the web that may be able to help me in this task, or anyone could possibly give me a hint?

    Thanks in advance

    Hello

    You are absolutely right to avoid any code that must be changed simply because the changed data in a regular and predictable way. It is also a good idea to think of streamline something that has 65 almost identical copies of the same code.

    I think you can do what you want without PL/SQL, using a CONNECTION request BY:

    MERGE INTO     account_lifecycle     dst
    USING ( SELECT     account_number
               ,     LEVEL          AS seq
         FROM     account_lifecycle
         WHERE     LEVEL     > 1
         START WITH     seq          = 1
         CONNECT BY     account_number      = PRIOR next_acc_no
          ) src
    ON    (src.account_number = dst.account_number)
    WHEN MATCHED THEN
    UPDATE  SET     dst.seq = src.seq;
    

    Of course, you can place the MERGE statement above in a PL/SQL procedure, if you want to.

    If CONNECT BY does not work, then you could do what you do now in a loop, where the numbers are variables that is incremented with each pass through the loop. At the end of the loop, check if whatever it is actually got updated and LEAVE the loop if he doesn't.

    If post you a small example of data (CREATE TABLE and INSERT statements) and desired outcomes from these data (i.e., the State of the table once the UPDATE is all done), then I could test it.

  • stop a pl/sql block

    Hi guys,.

    I would like to know, how can I stop an anonymous pl/sql block (what is the command, what rights will I have to run the command, etc.). We use the TOAD to PL/SQL programming and I know that administrators can stop processes of Enterprise Manager.

    But yesterday, I started a block that is in an infinite loop and the admin is on vacation, and the table grows big and bigger and the tablespace will be full sooner or later.

    So help pls.

    Thank you
    Gabor

    Then you should find the sid, session id and the serial(serial#) of the view v$ session_longops... for your anonymous block...

    Then, run the command:
    alter system kill session ','

    Greetings,
    SIM

Maybe you are looking for

  • Satellite L850-A848 - is not listed in the list of update Win 8

    Hello I return this laptop 3 months but it is not listed in the victory 8 up portable computers dimmable. advice please.

  • WANT to m6: Fan of HP ENVY m6

    The cooling fan seems to run all the time. About a month or two ago, he would go and seem so stop. It's boring; but more, I want to assure you it is not an issue wih the fan/cooling? I had his lptop for about 4 years and never had this problem before

  • LabVIEW Professional 2012 development system

    Please provide us the link to download 2012 LabVIEW Professional Development System.

  • Unable to repair corrupt files...

    I now have 3 PCs that SFC found corrupt files and that he is unable to remedy. All this seems to coincide with the Windows updates a few months ago. Someone else has the same problem? Does anyone have a solution?

  • Make the recovery with USB disks

    I have a HP Pavilion older m9300t Intel Core 2 Quad Q9300 2.50 GHz 4 GB 500 GB. HP told me that they no longer have the recovery discs available.  I bought a refurbished with no disk system.  The hard drive eventually crushed and I decided to keep th