Question on simple counting in oracle code

have two tables table1 and table2

Table 1A 5000 documents, table2 has 10000
There is a column called num_id (number)
in white table1
There is a column in table2 num_id (number) with a number of seq data in table2 and the last num_id = 10000

just take the max (num_id) table2 and begin the process of table1 with 10001, 10002, 10003, etc..

Thank you
Doug

Hi Doug,.
Suppose you want to use the sequence.nextval to update the table 1 then all you need is...

declare

vn_max_seq table2.num_id%type;
vn_counter table2.num_id%type;

Start

Select max (num_id) in the vn_counter from table2;

Tags: Database

Similar Questions

  • Simple counter/dashboard (AS3)

    I need this for a simple iPhone app...
    I tried to create a dashboard for my iPhone with Flash CS5 in the Air for the iOS mode. I have add the timer and the timer of 24 seconds, but now I need help so much.
    Problems:
    1. when the timer reaches 0 mins, it only displays: 59, not 00:59
    2. I tried to add a button to the meter of the points, but it seems very complicated in AS3 (not in AS2 :/). I created a TLF read only text named "HomeScore. But it is a nonnumeric string, so I can't add a simple counter.
    4. I need help with the reset (timer and 24 seconds) and Start/Stop buttons (for the timer and 24).
    My code:

    import flash.events.MouseEvent; (true) Seconds.text = "06:00" var timer:Timer = new Timer(1000,360); timer.addEventListener(TimerEvent.TIMER, countdown); timer.start(); function countdown(event:TimerEvent) {     var totalSecondsLeft:Number = 360 - timer.currentCount;     Seconds.text = timeFormat(totalSecondsLeft); } function timeFormat(seconds:int):String {     var minutes:int;     var sMinutes:String;     var sSeconds:String;     if (seconds > 59)     {         minutes = Math.floor(seconds / 60);         sMinutes = String(minutes);         sSeconds = String(seconds % 60);     }     else     {         sMinutes = "";         sSeconds = String(seconds);     }     if (sSeconds.length == 1)     {         sSeconds = "0" + sSeconds;     }     if (sMinutes.length == 1)     {         sMinutes = "0" + sMinutes;     }     return sMinutes + ":" + sSeconds;     if (seconds/60 <= 0  && sSeconds != 0) { return "00" + ":" + sSeconds;}     if (sMinutes = 0 && sSeconds = 0) { return "00:00"} } Possesso.text = "24" var timer2:Timer = new Timer(1000,24); timer2.addEventListener(TimerEvent.TIMER, countdownpossesso); timer2.start(); function countdownpossesso(event:TimerEvent) {     var totalSecondsLeft:Number = 24 - timer2.currentCount;     Possesso.text = timeFormatpossesso(totalSecondsLeft); } function timeFormatpossesso(seconds:int):String {         var sPossesso:String;     if (seconds > 59)     {                 sPossesso = String(seconds % 60);     }     else     {                 sPossesso = String(seconds);     }         if (sPossesso.length == 1)     {         sPossesso = "0" + sPossesso;     }         return sPossesso; } import flash.events.*; HomeScore.text = "02" HomeScore.text = ScoreFormatHome(ScoreHome); var ScoreHome:Number     function ScoreFormatHome(ScoreHome:Number) {     var ScoreHome=1     if (ScoreHome <=9 ) {return "0" + ScoreHome}     if (ScoreHome >=10) {return ScoreHome}     } ButtonplusHome.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler); function fl_MouseOverHandler(HomeAdd:MouseEvent):void {     ScoreHome++; }

    you have too many questions for a single thread, unless you're already pretty savvy:

    1. when the timer reaches 0 mins, it only displays: 59, not 00:59

    use a string formatter function.
    2. I tried to add a button to the meter of the points, but it seems very complicated in AS3 (not in AS2 :/). I created a TLF read only text named "HomeScore. But it is a nonnumeric string, so I can't add a simple counter.

    You can convert strings to numbers using Number().
    4. I need help with the reset (timer & 24 seconds) and Start/Stop buttons (for timer and 24).

    the timer class has you use reset(), start() and stop() methods.  Follow with the start() method reset() method if you want to reset and start.

  • Simple counter

    Hi team or,.

    I am trying to program a simple counter, see Appendix vi. Every time the temperature higher than 55 c she should count + 1 if it goes below of-18 + 1 cold cycle. Not sure why the structure of the event, never reached into the tank.
    Can someone help me pls.

    Thank you
    Martin

    DEGBM24 wrote: don't know why the structure of the event, never reached into the tank.

    This is because the value change event is not raised by you write to the Terminal.

    1. you don't need a case of timeout.

    2. you should have a value of Stop change event to stop your loop

    3. you should have a change in the value of your temperature control event

    4. you really should be using shift registers to keep your account of cycle instead of local variables

    5 look at the Boolean value through PtByPt VI.

  • Question Case simple statement

    Nice day:

    In this simple case statement, Oracle evaluates the when of 2nd or 3rd paragraph, or stops completely after reviewing the 1st (when returning in real life of course)?

    Select

    Case

    When 1 = 1 then 'a '.

    When 1 = 1 then 'b '.

    When 1 = 1 then 'c '.

    End 'test cases '.

    Of the double

    I know that the result of this query is 'a', but I was just curious to know if Oracle knows that 1 = 1 is 'b' and 'c' also, but he returned the 1st, since it is what first evaluated as true.

    Thank you

    Aqua

    A quick test would show he...

    SQL > set serverout on
    SQL > create or replace function trace (x varchar2) return varchar2 is
    2 start
    3 dbms_output.put_line (' value: ' | x);
    4 return x;
    5 end;
    4 m

    The function is created.

    SQL > select
    2 case when 1 = 1 then trace ('a')
    3 when 1 = 1 then trace ('b')
    When 4 1 = 1 then trace('c')
    5 trace ('other') else
    'test cases' 6 end
    7 double
    8.

    test case
    ----------------------------------------------------------------------
    one

    Value: a

    If other cases had even been considered then they would have been out in the trace.

  • I have a question about the functionality of Oracle Identity Manager...?

    Hi friends
    I have a question about the features of Oracle Identity Manager.
    Here's my question:
    Self-management is possible network passwords (reset / unlock) with Oracle Identity Manager 9.1.0.2

    Very grateful.

    What Kevin suggested this means that you are managing accounts and their password by IOM. If your condition is the same then follow:

    Re: error during password reset using the self-service portal

  • Simple counter in seconds

    Hello

    In my code, I have a while loop which may or may not take more than x seconds to run. Once the while loop has worked for x seconds I would to provide a series of commands. Therefore, I need a kind of counter. Number of cycles will help me with that? If so, how? If this is not the case, how can I create a counter for this simple task? Thank you.

    Alfredo

    Yes, the number of cycles can be used for this, and other mechanisms. For example, you can use the time to get the seconds. Here are some simple examples:

  • Question about cart Counter and position header J-26 of the widget in Muse conflict

    I recently purchased the award-winning J - 26 ecwid widget. I must say handguns are a beautiful set of enhancements and tools design for Muse. The conflict in question is the Cart counter Widget. I corresponded with the promoter to get this resolved and I was wondering if someone had this problem; As far as I know, this widget was designed to work with the store to trade Ecwid. (You must ask the developer if there are others) When the "Meter of Cart" widget is placed in the header of my page on a master page of cart or basket, I can't work properly. It could be something I'm not set up correctly or something else. But when the widget is placed under the header, it seems to work. The problem above the header area is that the counter disappears and does not make the connection with the store ecwid or something? I'm not sure. I am currently using a widget of J - 26 called a light cart followed the v2.3.1 and works very well in the position of the header. So all that being said, is there anyone who has tried the trolley counter in the header that works? Added note: I created a site skeleton with a connection to my storefront as a tester site, thinking that maybe there was a code problem. After bad and without success, I gave up. Currently, I'm looking for a work around to make a secondary master page for the storefront and to build a fake header move real heading to zero, so I can place the counter of trolley in the body of the page. Even with that there are a few problems.

    If anyone has had this same problem, please let me know, or better yet if you have a workaround or some instructions on how to make it work just in case it might be something I do not correctly.

    Again, the widgets are a great addition and I rent the developer for these. Any person who sets up an ecommerce site and wants to mark their page with many options, check on widgets. Well done.

    Ben

    Bravo for the professionalism of J - 26. After a repair my muse files, the developer of J - 26 set to update some of the widgets behave nicely with MUSE. Yet if you look at my first post here, award-winning J-26 ecwid widgets are well worth your efforts. Especially when developers are willing to look at the questions that pop up... and offer a solution! There are a few questions, I have about some of the settings, but all-in-all the characteristics fixed it are resolved.

    I give J - 26 an A +.

    Thank you

    Ben

  • PIVOT in oracle - Code of Correction

     select * from 
                  (
                    select prod_code from UNICA.DSI_SUBS_STOP_START_DRW
                   )
    pivot  (
         count(prod_code)
         For prod_code in ('E','3','W','W5','SS','S','4','W2','WS','3S','D','FS','3T','H3','TS')
              ) 
    I can't make this pivotal work. Can someone fix my error in the code. I get error "Command not properly ended SQL". I have a problem, to operate the PIVOT. Oracle 10 g support ROTATE at all?

    Thank you.

    Prior to version 11, you would do:

    select count(case when prod_code = 'E' then 'X' end) as PROD_CODE_E
         , count(case when prod_code = '3' then 'X' end) as PROD_CODE_3
         , count(case when prod_code = 'W' then 'X' end) as PROD_CODE_W
         , ...
         , count(case when prod_code = 'TS' then 'X' end) as PROD_CODE_TS
    from unica.dsi_subs_stop_start_drw
    ;
    
  • 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

  • Question about DW CS3 generated CSS code...

    In the attached code of a page, that I am, you will see that the .twoColFixLtHdr class is applied to several areas of the declaration. This class is the only one ever but she is shared with the ID.

    The page comes from a DW generated pages, namely the "two fixed column, left sidebar, header and footer." Since I am still a beginner with CSS, I can't understand this.

    The class is applied to the < body > tag. Does this mean that all of these CSS statements where appears the .twoColFixLtHdr class is applied to the < body > tag?

    Thanks for everything that will inform about it. I have a feeling it's quite simple...

    Tuesday, August 5, 2008 07:52:17 + 0000 (UTC), "brainfillet".
    wrote:

    > I have read up on CSS since the last post (no response from any force "
    (> me to read the book!). I understand now is that .twoColFixLtHdr «»
    "> #container" and others are descendant selectors.

    Yes
    >
    > My questions now, very simplified: it will be OK to remove all occurrences of
    > ".twoColFixLtHdr?

    If it a new site - then yes remove all occurrences of
    .twoColFixLtHdr in html and css
    change

    TO

    > Also, what is the point of this class, which is never
    > only, but it is only one component of a descendant selector. If I can pull
    > all instances of it (which I guess I can, and the page seems to work
    (> fine), why DW put there when she has generated the original file?

    I asked the same question there not so long ago - and Murray noted quite rightly
    make sure if you use older editions of code
    your site - it ensures that if there are duplicate css examples in
    old code and the model Dw - Dw code has priority (it has a higher level
    specificity).

    --

    ~ Malcolm ~ *...
    ~*

  • FPGA horribly Simple producers of error Code (-61003)

    Can someone tell me why this piece of code produces error-61003?

    I am trying to write code for a new FPGA, and the troublesome thing doesn't compile. The draft code has absolutely nothing to do with the project, but it is the simplest code that produces the same error when I try to compile it. I have two theories about why they do not compile: 1. the FPGA cannot physically shuttle data around the way I would like 2. I found an edge case that the compiler is not prepared to deal with. If there is a simple reason for this error I can work around, please let me know. This is by far the worst time I've ever had trying to find the source of an error.

    To reach the error: download the two files in the same directory, open FPGA2.lvproj, expand target FPGA, build specifications (under the target FPGA), click with the right button on WhyDoesThisError, select generate.

    That's what I get for guessing. The thing of arbitration apply to multiple accessors in the same loop.

    What seems to work on my machine is getting rid of the dowry of constraint on the business exit tunnel structure. It looks like loop analysis drop-get fired upwards by his presence, perhaps in conjunction with the selector being a source of control (?).  This looks like a bug to me, because your other VI runs. At the very least, it needs a better error message. If you can check that you see the same thing, I will submit a request for corrective action on this.

    Jim

  • How to make a loop simple counter in labview 7.1?

    I'm trying to teach me how to use labview 7.1, but having trouble finding how to use functions properly. I am trying to create a simple loop to count from 1 to 10 with a delay of 1 second between each number. I would be grateful the help!

    Classes resumed?

    The key words are 'loop' (try a loop FOR the palettte of structures), 'delay' (try a wait (ms) of the range of timing). Use a constant instead of diagram for the "1 second" (or 1000 ms). and use a digital display to show the current number (for example by using an indicator connected to a terminal of the loop iteration FOR). Given that [i] starts from 0, first use a primitive of + 1. Wire a constant at the end of the loop to determine the number of iterations. You should be able to determine the correct value, math or by trial and error.

    Now try to gather all, shouldn't be too difficult. Where have you problems? Have you looked at the examples? Did you do tutorials?

    Once you have a project, post it here and we can propose possible improvements.

  • Questions regarding the installation of key code

    I was helping a friend with his computer. She bought a computer to measure with Widows XP installed on it, a store of the local computer, about three months ago. She got big virus on his computer. If she needs to format and reinstall Windows XP.
    She did not have a sticker with a code on his computer from the store of the local computer. She won't pay hundreds of dollars just to get xp installed.

    Question #1: Must the machine store provide stickers key code when window selling?

    Question # 2, she had the sticker with a code, it could install it with a normal drive in Widows XP Home Edition using his key code?

    I was helping a friend with his computer. She bought a computer to measure with Widows XP installed on it, a store of the local computer, about three months ago. She got big virus on his computer. If she needs to format and reinstall Windows XP.
    She did not have a sticker with a code on his computer from the store of the local computer. She won't pay hundreds of dollars just to get xp installed.

    Question #1: Must the machine store provide stickers key code when window selling?

    Question # 2, she had the sticker with a code, it could install it with a normal drive in Widows XP Home Edition using his key code?

    I'd be very suspicious of any Windows installation where the seller has NOT provided a product key.
    There are utilities that will tell you what the product key is a copy installed Windows.
    This is what I use:
    http://www.Belarc.com/free_download.html
    You must go back to the store and query why there was no product key...

  • Developer of sql Oracle - code beautifier

    Hi all

    Where is beautifier code of oracle sql Developer (if any)?

    My version is 4.0.3.16

    It (Ctrl + F7) works for me in 4.0.3 as well in a spreadsheet and the PL/SQL code editor.  According to the SQL Formatter settings, sometimes the action Format has no effect. For example, a piece short single line of SQL may already be formatted according to the parameters.  However, if the Format is something, then Ctrl + F7 should also have the same effect.

    Watch Tools > Preferences > shortcut keys to see if the Format is associated with Ctrl + F7. If it is, with Format work but not the shortcut key, then something can be altered in your user settings.

  • A question about the capablities of Oracle Identity manager?

    Hello, everyone,

    Here is our environment,

    1 - we have user accounts in our database for students and employees in our academic Institute.

    2. we have a Microsoft active directory for employees only, that was created many years ago.

    3 - our web applications (weblogic server, ADF, other) use user accounts to database for authentication.

    We plan to create a server active directory for students, we thought about using Oracle identity manager (OIM) to do.

    is it possible to just directly sync & manage student accounts of microsoft oracle database active directory through IOM.

    Thank you.

    Hi mhaljasim ,

    By my understanding, looking for some sort of tool to create users (doing the commissioning) in a target (Active directory). If this is the case, yes IOM will be a great tool for you as it has connector AD that have this capability.

    Trying to help even more: research from the perspective of the solution, my understanding is you will make this workflow:

    (1) created in the Oracle database user. (2) then this user will be reconciled database of IOM, IOM DB connector (in other words, the user will be created in the table user IOM). (3) then IOM will be a process of supply to create this type of user in AD, using the connector of the IOM.

    But I would put another suggestion here:

    If you are looking for just a matter of authentication using the users of the database as well as users of the AD. I want to suggest to look deeper into the OVD (Oracle virtual directory) tool. It is a great tool that allows you to have views of the two targest(AD +DB) at the same time and make a simple Ldap authentication against this specific point of view once. By my understanding, this can be a good option in your solution as well. Please check more on these two IDM products to:

    http://www.Oracle.com/technetwork/middleware/ID-Mgmt/index-093158.html

    http://www.Oracle.com/technetwork/middleware/ID-Mgmt/Overview/index-098451.html

    I hope that this info below helps you a lot,

    Leoncio Thiago.

    http://thiagoleoncio.blogspot.com/

Maybe you are looking for