Generate select 2 in the same statement consecutive sequence numbers

Hello
Could someone please tell me how to generate 2 consecutive sequence numbers in the same select statement.

See you soon
CREATE SEQUENCE my_seq
INCREMENT BY 2
/

  select nxt_value
        , nxt_value + 1
 from ( select my_seq.nextval nxt_value from dual )
/

Anton

Tags: Database

Similar Questions

  • Hard analysis of the same statement

    Simple example:

    SQL > select * from table_1 where col_1 =: b;  -can also use literal here

    Use "INDEX RANGE SCAN.

    SQL > alter session set OPTIMIZER_INDEX_COST_ADJ = 1000;

    Will cause the same instruction to use "TABLE ACCESS FULL".


    Why the database generates new plan? When the same statement is still hard analyzed, assuming there is enough space in the shared pool and the statement is not 'Compatible with Bind?

    Thank you.

    The view V$ SQL_SHARED_CURSOR shows some of the causes as to why the optimizer will choose not not to share an existing child cursor.

    Change OPTIMIZER_INDEX_COST_ADJ falls under the cover of OPTIMIZER_MISMATCH.

    The question that arises is almost reversed from what you ask.

    It is not so when the optimizer chooses to make a difficult analysis.

    It's more when a cursor existing being/not reusable.

    that is, you will get an analysis hard whenever there is no such thing as an existing child shareable cursor.

    So, if you run the SQL statement in a session and lend an existing child cursor reuse does not exist, then you will get a difficult analysis.

  • How to maintain the same State of the application after closure and reopen the app?

    Hello

    My problem is while accessing the request, if I close and reopen the application then the previous state of the application is at a loss.  Please help me to maintian the same State of the application after close and reopen the app means reopen after application, enforcement should be focused on the last viewed item and I used the browser component if I reopen the app, then content browser also be there under the previous state.

    Advanced thanks for any help.

    One proposed by Simon is 'Close' and that you save enough information to rebuild your Application in the State was restoring it when it is reopened.

    Alternately, instead of really close your application, you could just put it on the bottom using

    UiApplication.getUiApplication () .requestbackground ();

    Once in the background, when the user selects again your application it will start immediately and will be exactly as it was left.

    This does not, of course, runs through judgment or commissioning of treatment you could want, so, for example, will not store all resources you want to put away when you know that the user is going to use your app for a while.  To help with this, look at the Application.activate () and Application.deactivate () methods.

    I hope this helps.

  • Select Insert on the same partition: RELATIONAL() - REMOVE a GLOBAL INDEX

    Hi all

    I found on v$ sqlarea suite statament:

    insert / * + / RELATIONAL PARALLEL ("TABLENAME") ("TABLENAME", 1) ADD NESTED_TABLE_SET_SETID NO_REF_CASCADE * /

    in "SCHEMA." "" TABLENAME ' partition ('DAY20151015')

    (

    Select / * + RELATIONAL("TABLENAME") PARALLEL("TABLENAME", 1) * /.

    *

    a 'schema '. " TABLENAME' partition ("DAY20151015") ".

    )

    Remove the global index

    This is a query that reads and writes the same data on the same partition!

    I think that it is generated by Oracle, but I don't undestand what he does.

    Can you give me some explanation or assistance on this query?

    Thank you very much

    This is a query that reads and writes the same data on the same partition!

    Well not - enough is NOT that.

    The RELATIONAL indicator causes unnest Oracle object data and insert the data from the attribute itself rather than the object.

    The indicators used are usable only by Oracle-c ' is why they are undocumented. You can find songs on the web, but practically everything you find is "best estimate".

    Oracle SQL tips - other indicators [HelloDBA.COM]

  • dynamically generate multiple instances of the same subform

    I have the field box where the user can select up to 10 accounts.  For each account, I need to have a certain display subform.  So if the user selects 5 accounts need 5 occurrences of the same subform.

    Is it possible by programming?  Or do I have to have 10 subforms and just hide/show what I need?  I prefer the former, if can be done.

    Please advise,

    Thank you

    Elaine

    Of course, it is not too hard once you know what you're doing.  First of all, make sure that all subforms of 'parent' of your subform are defined to be "Flowed" in the object tab, and that your subform is set to "repeat subform for each data element" in the binding tab.  For example, your user enters the number of accounts they have in a numeric field or text (we'll call it Number_of_Accounts).  At this point, you might have the form to generate the number of instances of the subform you want when the user leaves this area, or you could have a button that says something like "generate accounts."  Whatever it is, your script will be something like this:

    _Accounts_Subform.Count = Number_of_Accounts.rawValue;

    This will generate the number of instances of the requested subform.  A warning-if the person changes the value of Number_of_Accounts after they put a (i.e. in a first step, they said 5 but then it changed to 3), the instances at the end to go (so in our example the 4th and 5th instances would be deleted).  I suggest putting a warning in the same place, you put the script above, so it will look like

    If (_Accounts_Subform.count > Number_of_Accounts.rawValue) {}

    If (xfa.host.messageBox ("attention! You are about to permanently delete all accounts after the number"+ Number_of_Accounts.rawValue +".. "  Are you sure you want to continue? ', ' danger! "(, 3, 2) (= 4) {}".

    _Accounts_Subform.Count = Number_of_Accounts.rawValue;

    }

    else {}

    Number_of_Accounts.RawValue = _Accounts_Subform.count

    }
    }

    else {}

    _Accounts_Subform.Count = Number_of_Accounts.rawValue;

    }

    In addition, I suggest putting a delete button with each instance of the subform, so they can remove a case at a time and specifically (i.e. delete the first instance without deleting all subsequent instances).  A start-up caution-make sure that your "addresses" are correct (in this case Accounts_Subform and Number_of_Accounts).  If you are not sure if an address is correct, select the object on which you are scripting, go in the script editor, hold down Ctrl, and click in Design view, on the object you are trying to reference.  I'm sorry if this is not clear, but I can't imagine a better way to explain this right now.

  • different results for the same statement 9i / 10g why?

    Hi all

    I have problem in the SQL statement that it worked very well in oracle 9i, once I upgrade to 10g, this statement does not work

    I create a table:
    create table TEST_TAB (colA tank (6));

    insert into TEST_TAB values ('A');

    now when I run the following statement in oracle 9i

    Select count (*)
    of TEST_TAB
    where colA as "A";


    Count (*)
    ---------------
    1

    But in oracle 10g

    It gives
    Count (*)
    -----------
    0

    I know I can fix education by adding % at the end to bring data or triming CLC, but I can't because that statement use frequently in the application source

    My question, how can I solve this problem, what the related setting for this I check all the nls_... setting, it's the same in oracle 9i


    all boards

    Yes, it's Bug 2883715 possible bad results of AS against a column of type CHAR with no wildcard

    [Bug 2883715| https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=2883715.8]

    If you have everything you need to tell the developers what needs to be done.

  • How to select data using the same remote database column name 3

    Hello


    Can anyone help me on how to get the data with the same remote database column names 3 and a unique nickname.

    E.g.

    SELECT *.
    B.SID, b.status, SUM (b.qty) qantity MAX (b.) date_as_of
    Of
    * ((table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) has, *)
    (* (table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) b). *
    WHERE b.dept = 'finance '.
    AND a.position = "admin".
    AND a.latest = 'Y' AND (b.status <>"MLT") AND b.qty > 0;
    B.SID GROUP, b.status;

    NOTE: the instructions "BOLD" is just an example of what I want to do but I always get an error beacause of ambiguous column.

    Thanks to advnce. :)

    Published by: user12994685 on 4 January 2011 21:42

    user12994685 wrote:

    Can anyone help me on how to get the data with the same remote database column names 3 and a unique nickname.

    Not valid. This makes no sense and breaks all the rules of scope-resolution. And if it is in a single database, or uses tables in databases, is not relevant.

    Each object must be particularly well identified. If you cannot do this:

    select * from (table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) a
    

    3 objects cannot share the same alias. Example:

    SQL> select * from (dual, dual) d;
    select * from (dual, dual) d
                       *
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    

    You need to combine objects - by using a join union or similar. He will have to be done as follows:

    SQL> select * from (select * from dual d1, dual d2) d;
    select * from (select * from dual d1, dual d2) d
           *
    ERROR at line 1:
    ORA-00918: column ambiguously defined
    

    However, we need to have unique column in a projection of SQL names - so the join of the need to project a unique set of columns. So:

    SQL> select * from (select d1.dummy as dummy1, d2.dummy as dummy2 from dual d1, dual d2) d;
    
    DUM DUM
    --- ---
    X   X
    
    SQL> 
    

    I suggest that you look carefully at what opportunities are and how it applies in SQL - and ignore if the referenced objects are local or remote, because it has no effect on the basic principles of scope-resolution.

  • Not all the same States menu

    On the Organization , there is a menu for 'organization '.

    I still for the button States, the text itself has no distinct States, so it will not interfere with each other.

    But for the first two buttons "Schulleitung und Secretariat" and 'Aktuelles und ends' the 'ACTIVE' State does not show what I had put it.

    Any ideas?

    If you need the file Muse, ask for it.

    Thanks in advance

    Uwe

    OK, I see now. Perhaps, I was too mesmerized by the scroll...

    But he really needs to be something with the States, you want to bet?

    You can send me your Muse , if you want: [email protected]

  • Two tasks that share the same resource in sequence

    I'm the current exception "the specified resource is reserved.". I understand that you can not run two tasks that share the same resource at the same time. However, is it true that you can not run two tasks that share the same resource, one right after the other, without the eliminate completely from the first task?

    for example

    Task1 and task2 share the same resource
    Task1. Start();
    Task1. Stop();
    Task2. Start(); This will always throw an exception until you have a task1 (i.e. task1.) Dispose()?
    Task2. Stop();

    Hi cafarm,

    You're right, the fact to just stop at one task does not allow that run you another task with the same resources immediately after. That being said, you can start the next task without having to erase or dispose of the first by making use of the task status template DAQmx. As you can see on the next page, stop a task simply going to the State of "Clerks", which means that the material is still used by the task even if she does not actively.

    http://zone.NI.com/reference/en-XX/help/370466AC-01/mxcncpts/taskstatemodel/

    Instead, you can use the control functionality of task for the first task of transition to the status "verified" after stopping it, then start the second task. This keeps the parameters of the task without having to have the task, but it should free up resources to be used by other tasks.
    http://zone.NI.com/reference/en-XX/help/370473H-01/mstudiowebhelp/HTML/verifycommitstartstopdaqtask/

  • Not the same State (<>) of nested loops

    Hi gurus and Experts.

    I need advice/suggestion on the query plan below. This plan is go for Nested Loops, am not able to force to go to the hash join or Merge Join with tips.
    Can someone help me please what is happening, and it is possible to escape from nested loops.
    I don't want to take the help of index for this scenario.

    D/B: Oracle 11 g 2,
    create table parent as
    with main as (select --+materialize 
    round(dbms_random.value(low=>1,high=>100)) SAMPLE_ID,dbms_random.string(opt=>'U',len=>10) SAMPLE_TEXT,rownum id from dual
    connect by level<=100000)
    select sample_id,rpad(sample_text,10,'*') padding,sample_text,id from main order by id
    create table child as
    with main as (select --+materialize 
    round(dbms_random.value(low=>1,high=>100)) SAMPLE_ID,dbms_random.string(opt=>'U',len=>10) SAMPLE_TEXT,rownum id from dual
    connect by level<=10000)
    select sample_id,rpad(sample_text,10,'*') padding,sample_text,id from main order by id
    select --+use_hash(p c)
    p.id from parent p,child c where p.id<>c.id
    Plan
    SELECT STATEMENT  ALL_ROWSCost: 973,076  Bytes: 8,999,910,000  Cardinality: 999,990,000            
         3 NESTED LOOPS  Cost: 973,076  Bytes: 8,999,910,000  Cardinality: 999,990,000       
              1 TABLE ACCESS FULL TABLE APP.CHILD Cost: 12  Bytes: 40,000  Cardinality: 10,000  
              2 TABLE ACCESS FULL TABLE APP.PARENT Cost: 97  Bytes: 499,995  Cardinality: 99,999  

    902629 wrote:

    I need advice/suggestion on the query plan below. This plan is go for Nested Loops, am not able to force to go to the hash join or Merge Join with tips.

    You will not be able to use a hash join

    http://docs.Oracle.com/CD/E11882_01/server.112/e16638/optimops.htm#i36043

    >
    The optimizer uses hash join to join two tables if they are added by using an equijoin and if one of the following conditions are met:
    >

    You may be able to force a sort merge join, it does not mention if different will work, I don't see how it would be

    http://docs.Oracle.com/CD/E11882_01/server.112/e16638/optimops.htm#i49183

    >
    Sort merge joins are useful when the join condition between two tables is a condition of inequality such as <,> <=,>, or > =. Fusion type joints are more successful than joins loops nested for large sets of data. You cannot use hash joins unless there is a condition of equality.
    >

    I can't imagine this treatment an antijoin more efficiently than nested If loops.

  • Why don't I have any oriental language attached to my tabs? Each open tab has the same statement

    It's already happened and I closed the browser to get rid of him. I'm worried about security

    Hello aldubrow, this is not a security problem, but simply a default display caused the extension Advisor to mcafee site - please try to disable or remove that in case you have a present that there is a mcafee update that may resolve the problem.

    http://service.McAfee.com/faqdocument.aspx?ID=TS100162
    https://community.McAfee.com/thread/76071

  • generate a diff xmlelements at the same level

    How can you generate different xmlelements at the same level. for example as follows:
    <APPLICATION NAME="test" DATE="30-NOV-12">
      <ELEMENT1>
         <ELEMENT1_ATTRIBUTE1>
      </ELEMENT1>
      <ELEMENT2>
         <ELEMENT2_ATTRIBUTE1>
      </ELEMENT2>
    
    </APPLICATION>
    item 1 and item 2 are at the same level.

    I tried to generate, but have failed so far.
    I want to extract data from table 1 element1, item 2 data from another table, both tables are not related.

    Hello

    You can nest 2 XMLELEMENTs inside an another XMLELEMENT, like this:

    SELECT XMLSERIALIZE ( DOCUMENT     -- for display only
         XMLELEMENT
         ( "APPLICATION"
         , XMLATTRIBUTES ( 'test' AS "NAME" )
         , XMLELEMENT
           ( "ELEMENT1"
           , d.dummy
           )
         , XMLELEMENT
           ( "ELEMENT2"
           , u.username
           )
         )
           )               -- XMLSERIALIZE
                          AS txt
    FROM         dual     d
    CROSS JOIN  user_users  u
    ;
    

    Output:

    TXT
    ----------------------------------------
    
      X
      FUBAR
    
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • several objects have the same rollover both State (but the link to different pages)

    Hello

    I have a mac

    I would like to know how I can get several images with the same States of reversal - but who appear both on several images, (but each element having its own binding property applied to this)?

    See image below: I want the two box 'A' of pop with the same State of turning even if I'm hovering on one of the boxes. But I want that each of the boxes to post a link to different pages of my site.

    Ive tried to group the images and moving them to their own layer, but the bearings are not "and" associate on several objects

    Help!

    Thank you

    rollover.png

    It is not, but you don't need that to get the behavior you described. A1, a trigger will States and the hyperlink you want. On rolling, it will show its rollover State and show its target container that will be directly on top of A2. It will look like a rollover for A2 State. Repeat for A2, B1 and B2 and I think get you the behavior you described. It is simply a different way of approaching the problem (what happens to adapt the tools available in Muse).

  • Prevent the same selection in the menu in a Table expanding

    Hi all

    I have a table 2 x 2 in which the top line is a header line and the line of the low 'Row1 '. Row1 Cell1 has two buttons, one to add a new Row1 using Javascript click script of the instance:

    this.parent.parent.instanceManager.addInstance)

    .. .and one for delete all Row1 using Javascript click script of the instance:

    rowNum var = this.parent.parent.index;

    this.parent.parent.instanceManager.removeInstance (rowNum);

    Row1 Cell2 contains a datadropdown object.  Basically, when a user adds an extra Row1, I need prevent the to select a previously selected item in the list of dropdowndata.  I can't understand because I'm trying to set up output instance script (or would be - this script validate?) who's trying to reference Row1 [*].  In most simple situations where I have two fixed objects, I just made this as an output FormCalc script:

    If (Object1 = Object2)

    then xfa.host.messageBox ("you cannot select the same thing again")

    and xfa.host.resetData ("Object1")

    endif

    ... that prevents the user to select something with the same rawvalue by alerting the, then turning off the field.

    I hope this makes sense and someone can help!  Thanks in advance for all the gurus of adobe there

    Hello

    Would it not possible to filter the choices in the drop-down list that have already been selected.  If so, you could try something like this JavaScript in the event your falling down preOpen.

    dropDownItems var is ['abc', 'def', 'hij'];.

    var lines = Table1.resolveNodes ("Row1 [*]");

    for (var i = 0; i)< rows.length;="">

    {

    var line = rows.item (i);

    If (! line.) DropDownList1.isNull)

    {

    dropDownItems = dropDownItems.filter (function (item) {element return! == row.}) DropDownList1.rawValue});

    }

    }

    this.setItems (dropDownItems.join(","));

    The first line Initializes a variable with all possible values and then we will although each line filter those already selected.

    You will probably have to change the names of form objects depending on you form, but here's my sample to test the code, https://files.acrobat.com/preview/eb0256dc-af30-4f7c-9187-469ba84464a4

    Concerning

    Bruce

  • Generation and acquisition at the same time, acquisition of data USB-6356

    Hello

    I have a VI how is able to read entries with a USB DAQ-6356 and I use a generator of signals 'Agilent 33522 A '. I want to generate and acquire with the acquisition of data.

    In fact it works but not well, the frequency is not very stable and does not stop the 2nd loop with 1 (2nd is generating, 1 is Acquire).

    Thanks in advance

    P.S my VI isn't a state machine true because I need to fight against it at the moment.

    OK, so you're at 3 ms/s in writing and reading at 1.25Ms / sec and you wonder why he has a little difference in the frequency set?  Ideally, you want to read and write to share a sample clock but by selecting at least the same frequency clock (or one that is one multiple of the other) would go a long way to fixing this source of your error.

    The second source of error: you generate a contineous waveform.  unless you select 'whole number of cycles' there is a discontinuity when the end is reached at an arbitrary phase and the phase is reset to zero at the beginning of the wave.  DAQ assistant writing can "Use Waveform Timing" to adapt its sync settings to the dt waveform and the number of samples.

Maybe you are looking for