Generate a new sequence of query result

Hello

There are certain values of the sequence stored in the table below, I need to update with the values in the correct order, please help to suggest how can I achieve this.

Data source

IDsequence
12334
12335
12 s1
12 s2
12 s3
67313
67316
67320

Expected results

IDsequence
1231
1232
12 s1
12 s2
12 s3
6731
6732
6733

Kind regards

Germain

Analytical use ROW_NUMBER:

SELECT id,
ROW_NUMBER() over (partition by order of the identification of the sequence) sequence
from your_table
/

For example:

with data_sample like)
Select the id 123, sequence 34 Union double all the
Select 123,35 Union double all the
Select 321,1 Union double all the
Select 321,2 Union double all the
Select 321,3 Union double all the
Select 673,13 from all the double union
Select 673,16 from all the double union
Select double 673,20
)
SELECT id,
ROW_NUMBER() over (partition by order of the identification of the sequence) sequence
of data_sample
/

SEQUENCE ID
---------- ----------
1 123
123 2
1 321
2 321
3 321
1 673
2 673
3 673

8 selected lines.

SQL >

SY.

Tags: Database

Similar Questions

  • new to 4.02, no grid or column names in the query results

    It is a bit strange, I have SQL Developer 4.02 just installed, and I don't see grid or column names in the query results.  Don't see anything useful in tools > Preferences, what don't get me?

    The worksheet gives you a couple of different ways to run a query...

    1. instruction execute sheet icon toolbar (large green arrow, or Ctrl + Enter).

    This produces a results tab of the query with the data displayed in a grid.

    2. worksheet icon toolbar Execute the Script (the small tip of the green arrow on lined paper, or F5).

    This produces a tab out of the Script with the data displayed on the printer.

    If execution of the statement to Execute the Script, using some SQL * most orders will remove the column headers:

    1. set the position

    2. set the pagesize 0 (or 1 or 2).

    Pagesize and linesize default is - 1.  By default, the spreadsheet is free for formatting output script as he wishes.  If you have not changed these settings in the spreadsheet, then see if you point to a startup script in Tools > Preferences > Database > name of the connection startup script file

    Kind regards

    Gary

    SQL DeveloperTeam

  • New sequences

    Hello

    With Oracle Lite, when creating a new sequence, consider the range of sequences already created?

    We are maintaining an element of the publication and define a new sequence for it.

    Is this possible?

    Thank you

    not sure what you mean by sequence in this context

    If you mean the sequence used to generate the WTGPI_nnnnn names for the elements of publication, then the next value in the sequence will be used by default to add a new element of publication. If you just made an update of an existing publishing point (add or remove columns, change the selection criteria, weighting, etc - cannot change the PK values via update), then the number will remain the same. You cannot change the WTGPI_nnnnn (or if you use the API of the user specified name) without falling and by recreating the PI, but cela will result in the loss of any data pending download

    If you mean creating a sequence for the customer, then it will be based on the model used to create, and you can change the start, end and window values. These are not directly related to the tables however, and there is no control over the values already used except for the usual tests of PK duplicate

  • Generate a binary sequence with the NI USB-6008

    Hi all

    I'm new to LabView and I am trying to generate a binary sequence with a box NI USB-6008. The sequence, I'm currently generate is a counter of 5 bits, i.e. 00000 00001 00010, 00011... 11110, 11111 placing each bit in a different digital IO of the of the 6008 NOR, so that I can use the County as the bits of selection in a decoder/demux.

    I managed to simulate the binary sequence and produce a graphical interface, but I have not found how to generate the sequence of bits with the NI 6008.

    Totally, I'd appreciate any help you could provide. Thank you very much.

    Hi JosephM,

    Good Afternooon and I hope your well today.

    I just tested the code on a 6008 and also released the above code is very complex - I was for some reason any fixed on using Boolean tables.

    Please see the attached code, in LabVIEW 8.6.

    Mind you, I have configured the task as a channel for all lines. i.e. digital single I spent, is the task value should apply to all channels selected in the entry. So if you select only port0/Dev8/$line0 for example, the DAQmx driver will examine the LSB of the digital and work so $line0 must be true from the false. It will NOT update all other channels. So when I select line0:4 - it will update the first 5 lines (bits) in digital. As the code generates a number from 0-32 he emotional generates 00000 to 11111.

    I hope this finds you well and sorry for the first post!

  • How can I generate a new file/link static?

    Im trying to figure out how to approach a problem. what I want to do is to generate a new file/link, perhaps using "cffile" or any other way.

    Right now I have cse_newsletter.cfm, which looks like this (type of)

    <html>
    .......
    <cfquery>
    select ....
    </cfquery>
    select ....
    <cfquery>
    </cfquery>
    .......
     <cfoutput>
          <h1>Starburst Star Award</h1>
         <h3>Winner: Department- #highest_dept_name_average#</h3>
         <h3>Average:  #hihest_dept_average# </h3>
         <h4>Runner-up: Department- #highest_dept_name_runnerup# </h4>
         <h4> Average: #highest_dept_name_average_runnerup# </h4>
      </cfoutput>
    </html>
    
    

    the query works and give me I want a correct output. (rigth now I use cfshedule to execute it, but every time I run it will overwrite the old data with the new) what he does, he gives me the data of the past month.

    so every tiime it works should give me the data from last month.

    I would like to do that whenever I click on transmission (maybe there is a better way to do it without submit) it will give me a static link/txt that contains the data.

    I know that with cffile = "Write" he can give me a txt file (and this file can be replaced), but I would preffer so is easier for me a link on cse_newsletter.cfm which will output/display which is on the body now to the cse_newsletter.

    Please give me any tips/suggestions, maybe an article I read online (have not found something that can help me)

    This right is the cfshedule, right now is on the update, so sure it won't work with the update, but I don't think that with what I want, I can accomplish with cffile 'writing '.

    <cfschedule action = "update"
        task = "TaskName" 
        operation = "HTTPRequest"
        url = "cse_execoffice_newsletter.cfm"
        startDate = "04/18/14"
        startTime = "11:19 AM"
        interval = "3600"
        resolveURL = "Yes"
     >
    

    Thank you

    I mean your cse_newsletter.cfm model can be designed to accept parameters to view a newsletter of a certain month and year. If it accepts URL parameters, then you can create a link to it like this:

    http://mydomain.com/cse_newsletter.cfm?month=1&year=2014

    And if the parameters are not passed, you could do that show the user a list of months and years (control for example via the selection list form) so that they can select the month and year they need. That's how he could design in any case. Unless your data is stored somewhere in a database, your model would never work for a scenario (last month), and it's a great limitation because no one can observe beyond newsletters. You may not write files to disc etc, because the model has just need to show correct information letter. You can create any link to the newsletter you need once it has been designed to accept parameters month and year (which are in turn to your CFQUERY tags to get the data).

  • Limit the number of CMIS query results

    Hello
    Can we limit the number of CMIS query results
    my query is
    SELECT * from ora: t:IDC:GlobalProfile WHERE the ora: p:xRegionDefinition AS \'ALERTRD\'
    I want only newer 2 alerts to display.

    Thank you

    You use the CMIS query in a workflow of presenter content in WebCenter Portal? These documents provide a maxResults parameter to set.

  • Create a new sequence in first pro cc

    Please tell me how to create a new sequence that is the size of the selected item?

    Steven explained how do it in the first response to my query.

    Best,

    J

  • generate the debug sequence diagrams in JDev 11.1.1.2.0

    Hi I'm new to JDeveloper.

    How can you generate diagrams of sequence of the debugger? I did some googling pointing me to "Debug with diagram" but I don't see any diagram. I looked at this demo: http://www.oracle.com/technology/products/jdev/101/viewlets/101/sequencemodelerdebugging_viewlet_swf.html

    After the demo, I also created a file of sequence diagram, but I can't find an option "Connect to Debugger", and the demo used Jdeveloper 10 g. But mine is 11.1.1.2.0.

    The secrets I should know? Thank you!

    It turns out that the feature has been removed in this version of JDeveloper. (we forgot to remove the menu option well - I'm this bug).
    For the record can you tell us what exactly you were designed to do?
    Are you interested in generating a sequence for a specific method diagram? or you really interested in creating a diagram to get the procedure specific debugging?

  • How to use the new sequence when it is reached its maxvalue in PL SQL code

    Hello

    Currently, I am the filling of a number of unique product in a table column by using a call sequence to generate the new number. For different products, I have different sequences and in my PL SQL code usiing IF... Else block I fill the serial number for different products. For a sequence more selling product, we reach a Max value in the production in one month and ensure that the application continues to run properly for the different end-users without getting any error on their screens, I want my code to automatically switch to the new sequence. I just need to add another if condition but my problem is how to find precisely when the maximum value is reached in old sequence.

    As the call to the old sequence can occur in different sessions he could be inconsistency and can be found in the error. My new sequence value must begin with AV1000. Please suggest.

    My old sequence look like this:
    SEQUENCE of Prd
    INCREMENT BY 1
    START BY AS1000
    MAXVALUE AS9999
    MINVALUE AS1000
    NOCYCLE CYCLE
    CACHE 2
    Order Yes;

    Published by: user11695088 on July 15, 2009 12:14 AM

    Catch the exception and use your new sequence. But somehow, I'm not like your alternative approach.

    SQL> set line 300
    SQL> set pages 50000
    SQL> set serveroutput on
    SQL> create sequence testing_seq increment by 1 start with 1 maxvalue 3
      2  /
    
    Sequence created.
    
    SQL>
    SQL> create or replace procedure test_seq_proc(p_seq out number)
      2  is
      3  begin
      4     select testing_seq.nextval
      5     into p_seq
      6     from dual;
      7  --
      8     dbms_output.put_line(p_seq);
      9  --
     10  end;
     11  /
    
    Procedure created.
    
    SQL> declare v_out number;
      2  begin
      3     test_seq_proc(v_out);
      4  end;
      5  /
    1
    
    PL/SQL procedure successfully completed.
    
    SQL> /
    2
    
    PL/SQL procedure successfully completed.
    
    SQL> /
    3
    
    PL/SQL procedure successfully completed.
    
    SQL> /
    declare v_out number;
    *
    ERROR at line 1:
    ORA-08004: sequence TESTING_SEQ.NEXTVAL exceeds MAXVALUE and cannot be instantiated
    ORA-06512: at "ETL_ADMIN.TEST_SEQ_PROC", line 4
    ORA-06512: at line 3
    
    SQL>
    

    See you soon
    Sarma.

  • How can I generate a new recovery key

    How to generate a new recovery key having lost it

    For Apple ID, you mean?

    Go to the Apple ID page, click on manage your Apple ID, login, if you have not already. Now, you can click the password and the Security item in the left navigation bar and click on replace lost keys. Follow the steps here, and your old made no valid recovery key, and a new creation.

  • What makes firefox generates a NEW profile when I already have a... ?

    It seems when firefox upgrades it sometimes generates a new profile for me... even if I already have a. _What is firefox looking to make this decision. ? _i work in a windows 7 environment with a roaming profile AD.

    Firefox uses the profiles.ini file to locate the profile folder.

    If this file is not found a new default profile will be created.

  • When I search something, firefox opens a new tab with the results. How can I change the settings to where it will stay all in the same tab?

    When I search something Firefox automatically opens a new tab with the results of this research. How can I change the settings to where the results will appear in the same tab where I made the research?

    If you want to open search results in a new window most often is a parameter of the search engine you use.

  • I can do something that would cause all the new sequence files to have the same local variables?

    I would like to add local or drop some variables global to all the new sequence files I create. I was hoping that I could simply add the variable to the process template and make it appear whenever I created a new sequence or in any order who have used this process model, but it doesn't seem to work.

    Does anyone know a way to do what I'm doing?

    Thank you.

    Skeptic,

    If you use TestStand 4.0 and later versions, you can create a sequence model by adding a sequence selected in the models pane of the TestStand sequence editor.  You can then use this template to create all your future movies.  Once you configure the model you like you will be easy to reuse this sequence skeleton again.

  • Need help to build the query/pl-sql block to get the query result and the name of column from DB table in the form of key-value pairs.

    Hi Experts,

    I have a DB table has columns of more than 50.

    I question this table, it should only return one line at any time. as sqldeveloper below image.

    here, I need to build block pl/sql-query, Discover the column in the table as a key and query result as values.

    Eg:     Key                         -  Value

    TASK_EVENT_ID - 1765

    EVENT_TYPE - ASR_UPDATE

    ... etc until all of the columns in my table.

    Experts please comment on that point, appreciate your help on this.

    Thank you

    -Vincent.

    Here is an approach using DBMS_SQL to iterate over the columns of key / value to assign... (Little code snipped for brevity)

    create or replace procedure (task_expired)

    v_store_id in full,

    v_task_action_id in full,

    v_job_id in full

    )

    as

    -[SNIP code...]

    v_sql VARCHAR2 (4000): = ' select * from my_table where PK = 123';  -Your SQL here!

    v_v_val VARCHAR2 (4000);

    v_n_val NUMBER;

    v_d_val DATE;

    v_ret NUMBER;

    c NUMBER;

    d NUMBER;

    col_cnt INTEGER.

    f BOOLEAN;

    rec_tab DBMS_SQL. DESC_TAB;

    col_num NUMBER;

    vAsString VARCHAR2 (4000);

    BEGIN

    -[SNIP code...]

    Message_properties. CORRELATION: = "EDF_EVENT";

    MSG: = SYS. AQ$ _JMS_BYTES_MESSAGE. Construct();

    Msg.set_string_property ('queueName', ' shipping/csi_cth');

    Msg.set_string_property ('MODE', 'CR8');

    c: = DBMS_SQL. OPEN_CURSOR;

    DBMS_SQL. PARSE (c, v_sql, DBMS_SQL. NATIVE);

    d: = DBMS_SQL. Execute (c);

    DBMS_SQL. DESCRIBE_COLUMNS (c, col_cnt, rec_tab);

    1.col_cnt J

    LOOP

    CASE rec_tab (j) .col_type

    WHEN 2 THEN

    DBMS_SQL. DEFINE_COLUMN (c, j, v_n_val);      -Number

    WHEN 12 CAN

    DBMS_SQL. DEFINE_COLUMN (c, j, v_d_val);      -Date

    ON THE OTHER

    DBMS_SQL. DEFINE_COLUMN (c, j, v_v_val, 2000);   -Else treat as varchar2

    END CASE;

    END LOOP;

    LOOP

    v_ret: = DBMS_SQL. FETCH_ROWS (c);

    WHEN OUTPUT v_ret = 0;

    1.col_cnt J

    LOOP

    -Fetch each column to the correct data type based on coltype

    CASE rec_tab (j) .col_type

    WHEN 2 THEN

    DBMS_SQL. COLUMN_VALUE (c, j, v_n_val);

    vAsString: = to_char (v_n_val);

    WHEN 12 CAN

    DBMS_SQL. COLUMN_VALUE (c, j, v_d_val);

    vAsString: = to_char (v_d_val, ' DD/MM/YYYY HH24:MI:SS');

    ON THE OTHER

    DBMS_SQL. COLUMN_VALUE (c, j, v_v_val);

    vAsString: = v_v_val;

    END CASE;

    Msg.set_string_property (rec_tab (j) .col_name, vAsString);

    END LOOP;

    END LOOP;

    DBMS_SQL. CLOSE_CURSOR (c);

    DBMS_AQ. ENQUEUE (queue_name-online 'cbus.aqjms_common',

    Enqueue_options => Enqueue_options,

    Message_properties => Message_properties,

    Payload-online msg,

    Msgid => Message_handle);

    dbms_output.put_line ('00 Msgid =' |) Message_handle);

    dbms_output.put_line('===Done=');

    -[SNIP code...]

    END;

    /

  • Beginner frame size question-new sequence is not what says PP

    I want to crop 30px from the bottom of a 576 x 352 movie. If only I could drag a marquee selection autour with a crop tool and save it would be perfect.

    All that I know to do is create a new sequence with the new frame size 576 x 322, then copy the old film in it. I have create a new sequence of Custom, and PP dialog box shows that it has the desired size (scrn bottom CAP), but it isn't... its actually much smaller and the most cultivated in all parts. When I copy in the 576 x 352 images in to the new sequence, the image size is not yet near. What I am doing wrong?

    PP CS6 mac

    576x352.png

    576x322.png

    The spacing in pixels between these two screens do not match... are the pixels of your film footage square pixels, or more narrow les.909? Make sure your settings to completely sequence corresponding to the size of the image file - and all other things except to change the dimension of height. So remember to slide images of this sequence, using 'set to the size of the image' and see if it works better.

    Neil

Maybe you are looking for