How to create temp Sequence  for multi sessions

Hi,
I"m using Global Temp table and I need to insert Identity (or Seq-Number) column into it, but I also have multiple sessions for my sp and each case shold have it's own Seq-Number, starting from 0.
Is there any kind of "temp sequence" in Oracle ? that works in the same fashion like GTT , so multiple sessions each will get fresh zero anytime they will refer it.
I also found out that ROWNUM will not work in my case.
Probably I also can create SEQUENCE in my sp with some unique name let say with SID , something like:
select sys_context('SID') into tmp_SID from dual ;
CREAT SEQUENCE 'MYSEQ'||tmp_SID start with 0 .....
Tx
Trent

if several sessions will create sequence with same static name could it be collission ? Should I go with dynamic sequence name instead ?You cannot have the same SEQUENCE (i.e. "static name") created from multiple sessions. A SEQUENCE is a Database Object that is not transient, but permanent (until it is dropped).
Although you could "generate" dynamic sequence names and use them, you should look for a better implementation than running CREATE and DROP statements like that.
Furthermore, you would have difficulty in doing a bulk insert of multiple rows unless you add a trigger that fires FOR EACH ROW.
If you need to assign an increasing value to each row, use a ROWNUM to assign to a new column.
insert /*+ -- optional APPEND -- */ into target_table
select s2.*, rownum-0  from (select * source_table s where .....  order by ....) s2on the assumption that target_table as n+1 columns where the last column is for the increasing value. (rownum-0 is to set the first row to 0).
Hemant K Chitale
http://hemantoracledba.blogspot.com
Edited by: Hemant K Chitale on Sep 16, 2010 2:13 PM
correcteed the SQL statement

Similar Messages

  • How to create a sequence for an particular item in my apex form

    Hi friends,
    I created an database application, of a form with a report, and it is working fine...
    But in my form, i have a requirement....The below are the existing fields in my form
    issue no
    created by
    start date
    status
    priority
    due date
    Among these fields in my form i need to create a 'Sequence' for my field "issue no",
    So that whenever i opened the form the 'issue number' must generate automatically like 1 for the first time, 2 for the second time and so on..
    For that i created a sequence
    CREATE SEQUENCE "ORDERS_SEQ"
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    INCREMENT BY 1
    START WITH 1000
    NOCACHE
    NOCYCLE;
    But for validation where i need to write the sequence query for the particular item 'issue no'....i dont have any idea of where to write the validation query for the sequence..
    please tell where i need to write in step wise manner..please help me friends...
    As the below is my validated sequence query for item 'issue no'
    'select seq.issue_id.nextval into issue_no'
    This is my above validation query whether the query that i mentioned is right..if not let me know the validation query..
    And also i need where to apply this validation query in steps..
    Thanks in advance
    Regards,
    Harry...

    Harry,
    Rik is on the right track. Here is a sample insert trigger: Would need to substitute you sequence ORDERS_SEQ with my sequence las_log_seq, how you define or use timestamps is up to you.
    DROP TRIGGER LASDEV.BINS1_LAS_LOG_TBL;
    CREATE OR REPLACE TRIGGER LASDEV."BINS1_LAS_LOG_TBL"
       BEFORE INSERT
       ON las_log_tbl
       FOR EACH ROW
    BEGIN
       -- Description: Insert log_seq, creation_dt, creation_id,
       --              lst_updt_dt and lst_updt_id.
       -- Maintenance:
       -- Date        Actor          Action
       -- ====        =====          ======
       -- 07-Sep-2010 J. Wells       Create.
       :new.creation_id := nvl( v( 'app_user' ), user );
       :new.creation_dt := SYSDATE;
       :new.lst_updt_dt := :new.creation_dt;
       :new.lst_updt_id := :new.creation_id;
        SELECT las_log_seq.NEXTVAL
          INTO :new.las_log_seq
          FROM DUAL;
    END bins1_las_log_tbl;
    /Heff

  • How to use a dictionary for multi languages when displaying mess

    how to use a dictionary for multi languages when displaying messages??

    1st you have to define new messages in the dictionary:-
    1.     We have to open the application.
    2.     Functional administrator responsibility.
    3.     Core services.
    4.     Messages.
    •     Create message button.
    •     Now fill the name of the message that we want to call it from our code in the Code field.
    •     Fill the application name with short name of the application.
    •     Choose the language.
    •     Set the text you want to be displayed.
    2nd, Now in the CO in the in the process form request you will code throw new OAException ("application short name","Code").
    Now run and see the result.
    3rd we want to use Arabic messages, use the same one you have created for saving as an example but you choose duplicate and set the language Arabic.
    •     Run the page.
    •     Choose preferences.
    •     Current Session language = Arabic.
    Now you can see the result.

  • How to create temp files in temp tablespace

    Dear all,
    Due to outage of our SAN, we our out of production for the
    last 3 days. By the grace of Almighty we have restored production by
    database recovery from our standby backup. Since temp tablespace and
    temp data files do not taken as backup for standby, now after recovery
    we are getting abap dumps asking for temp_1 and temp_2 datafiles.
    Please guide us how to create temp files. v$tablespace is showing tablespace PSAPTEMP but datafile are not there
    Abap dumps are giving these errors as mentioned below
    ====================================================
    The exception must either be prevented, caught within the procedure            
    "DATA_SELECTION"                                                              
    "(FORM)", or declared in the procedure's RAISING clause.                       
    To prevent the exception, note the following:                                  
    Database error text........: "ORA-01157: cannot identify/lock data file 256 -  
    see DBWR trace file#ORA-01110: data file 256:                                 
    '/oracle/SD1/sapdata4/temp_2/temp.data2'"                                     
    Internal call code.........: "[RSQL/FTCH/MARA ]"                               
    ===================================================
    another one asking for 
    '/oracle/SD1/sapdata3/temp_1/temp.data1'"
    Best Regards
    Waqas

    if you want to add a new tempfile to your TEMP Tablespace,you can do like that.
    <i>ALTER TABLESPACE</i> <<b><u>name of TEMP Tablespace</u></b>> ADD TEMPFILE <<b><u><b><u>pfad to the file_and_file name</u></b></u></b>> <b>SIZE</b> <size>;
    You can use also the options <i>REUS</i>E <i>autoextend off</i> or <i>on</i> .
    e.g:
    <i>alter tablespace</i> <u><b>PSAPTEMP</b></u> add <i>tempfile</i> <b><u>'/oracle/SD1/sapdata4/temp_2/temp.data2'</u></b> <i>SIZE 1000K</i> <i>REUSE</i>;
    The directory <b><u>temp_2</u></b> should exist.
    Or you can use the BR*Tools to create a new datafile. Enter brtools and follow the instructions or menu.
    More to TEMP Tablespaces see please following SAP notes:
    <u><b>659946</b></u> - FAQ: Temporary tablespaces
    <u><b>600513</b></u> - ORA-25153 after recovery due to missing tempfiles
    and the Oracle Note:
    <u><b>160426.1</b></u>: TEMPORARY Tablespaces : Tempfiles or Datafiles ?
    I hope it helps.

  • How to Create Test Sequence Document in HTML using command line

    How to Create Test Sequence Document  in HTML using command line
    I have lot of sequences and I want to create Test Sequence Documentation in HTML format using Command Line automatically, is there a way to automate this task using .bat file or using   C#  .Net

    If you aren't able to figure out how to call a C++ DLL in .net then there may be another option.  Unfortunately I don't know how to do this off the top of my head and I don't have an example.
    The other option would be to change docgen.seq a little bit to the dialog doesn't display and you just hardcode the options.  Then you can use a command line to call testexec.exe: http://zone.ni.com/reference/en-XX/help/370052K-01/tsfundamentals/infotopics/startup_opt/
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • How to Create a Sequence Number from BI Publisher Layout editor?

    How to Create a Sequence Number (1,2,3,4,......,etc) from BI Publisher Layout editor

    Thank you for your replay, but <?position()?> we can used it in template builder only not from BI layout editor
    I found a solution in this case we can used the following query.
    SELECT
    ROW_NUMBER() OVER(order by item_status) as Row,

  • How to create a sequence in oracle forms6i

    Oracle forms 6i
    Hai All
    I am working in leave application entry so i need to create a sequence for giving a unique number for each entry
    Pls tell me the steps how to created and how to call the sequence from database
    Thanks in Advance
    Srikkanth.m

    Hi,
    Create sequence <sequence_name>
    Start with <number>
    increment by <number>
    in database
    eg:- create sequence test_seq
    start with 1
    increment by 1;
    in forms
    you can assign value in pre-insert trigger
    Declare
    cursor cur_seq is
    select test_seq.nextval from dual;
    begin
    open cur_seq;
    fetch cur_seq into :item_key ; /* :item_key give name of ur primary key field*/
    close cur_seq;
    end;

  • Creating Kerberos Identity for RD Session Host Farms for w 2012 r2

    anyone knows how Creating Kerberos Identity for RD Session Host Farms for w 2012 r2.
    I tried what they said the post
    to w 2008, With
    powershell I find the possibility and the
    script indicates the error class is not
    valid

    Hi,
    Referring to your comment, here providing you article for Kerberos authentication in server 2012. Please refer to the below article.
    What's New in Kerberos Authentication (You can refer for Server 2012 R2)
    http://technet.microsoft.com/en-us/library/hh831747.aspx
    Hope it helps!
    Regards.

  • How to create a macro for a planning type in MC8b transaction

    Hi,
    I am presently working for a product allocation demand, which have a information structiure with characteristic and key field.
    the characteristic are production allocation quantity, incoming order quantity, and open order quantity.
    i have created a planning type in which the data updation takes from the excel file to the planning type in mc95.
    but i need to create a macro for this planning type .
    can any body give the details information how to create a Macro for a planning type.
    Thanks and regards
    GopalKrishna

    Dear Gopal
    May be the link would be helpful to you.
    [Planning Types and Macros|http://help.sap.com/saphelp_46c/helpdata/en/a5/631cc443a211d189410000e829fbbd/frameset.htm]
    Drill down the left tab once you opened the link, for more information.
    Thanks
    G. Lakshmipathi

  • How to create custom infotype for training and event management

    hai freinds can any one tell me how to create custom infotype for training and event managment with following fields
    PS No – PA0000-> PERNR
    Name   - PA0001 -> ENAME
    IS PS.No. – PA0001-> PS no. of Immediate Superior
    IS name PA0001 -> ENAME
    thanx in advance
    afzal

    Hi,
    Your question is not clear for me. Since it is a TEM infotype, it could be a PD infotype.
    If you wish to create a PD infotype, use transaction PPCI to create the infotype.
    But before that you need to create a structure HRInnnn (where nnnn is the infotype number) with all the fields relevant for the infotype.
    If you wish to create a PA infotype, use transaction PM01 to create the infotype.
    But before that you may be required to create a strcuture PSnnnn  (where nnnn is the infotype number) with all the fields relevant for the infotype.
    Regards,
    Srini

  • How to create one TO for multiple TRs

    Dear All,
    how to create one TO for multiple TRs, kindly suggest me
    Regards,
    balu

    As for your question: it is discussed in sAP online help:
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/c6/f841f24afa11d182b90000e829fbfe/frameset.htm
    Sorry I misunderstood your question.
    The above mentioned solution won't create one single TO from multiple TR.
    Edited by: Csaba Szommer on Aug 11, 2010 9:46 AM

  • How to create one checksum for 264 vis

    Hi,
    How to create "one Checksum" for 264 Vis.These 264 Vis are Interlinked if i change code for any .vi the checksum Should be update.This checksum is shown on the main window.
    Regards
    Ravindranath
    Solved!
    Go to Solution.

    Here's a slightly simplified version (saved in 8.6).  There's no need for the Get/Set File Position.  The file position is already being incremented with the read.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Multiple File MD5 Checksum (Version 8.6).vi ‏23 KB

  • How to create new scope for SharePoint calendar?

    How to create new scope for SharePoint calendar?
    I have a calendar list to which I want to create following scopes-
    Annual View
    Half Year 1 (Jan-June)
    Half Year 2 (Jul-Dec)
    Quarter 1 (Jan-Mar)
    Quarter 2 (Apr-Jun)
    Quarter 3 (Jul-Sep)
    Quarter 4 (Oct-Dec)
    How this can be created. Any help appriciated. Thanks.

    Hi Pratima,
    Can you please see below link and code snippet for how to
     format date in gridview.
    http://www.aspdotnet-suresh.com/2011/05/how-to-set-date-format-in-gridview.html
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Gridvew Date format</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:GridView runat="server" ID="gvdetails" DataSourceID="dsdetails" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="false">
    <RowStyle BackColor="#EFF3FB" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <AlternatingRowStyle BackColor="White" />
    <Columns>
    <asp:BoundField DataField="Date1" HeaderText="Date1" HtmlEncode="false" DataFormatString="{0:s}" />
    <asp:BoundField DataField="Date2" HeaderText="Date2" HtmlEncode="false" DataFormatString="{0:D}" />
    <asp:BoundField DataField="Date3" HeaderText="Date3" HtmlEncode="false" DataFormatString="{0:m}" />
    <asp:BoundField DataField="Date4" HeaderText="Date4" HtmlEncode="false" DataFormatString="{0:d}" />
    <asp:BoundField DataField="Total" HeaderText="Total" HtmlEncode="false" DataFormatString="{0:C2}" />
    </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="dsdetails" runat="server" SelectCommand="select * from DateFormat" ConnectionString="<%$ConnectionStrings:dbconnection %>"></asp:SqlDataSource>
    </div>
    </form>
    </body>
    </html>
    Hope this will help you.
    Regards
    Soni K

  • How to create a PR for each Maintenance Order

    Dear All,
    Please guide me how to create a PR for each Maintenance Order.
    I test on Ides, I have some Maintenance Orders, all of them require the same stock material. When I run MRP, system always create one PR for all requirements. I don't know how to change.
    Regards,
    QuangDD

    Hi,
    As you planning for Stock Items, by running MRP, system will create single PR only. If it is non stock items, then it would be possible to create different PR based on Orders.
    Regards,
    Maheswaran.

  • How to create t-code for a table and how to create transaction variant???

    Hi,
    I have created a custom table zsark.
    Now my requirement is : I have to create a transaction variant zsark_var for sm30 and table zsark. I have to disable the output of the first screen. I have to assign the transaction variant to the transaction code of table zsark.
    Now,
    1.     how to create transaction code to a table. Can any one give me the 
                    staps??
    2.     how to create transaction variant for the above requirement???
    Thanks & Regards,
    Sarkar

    Hi
    1 Goto SE93 transaction
    2 Choose 5th option Transaction with parameters
    3 Give transaction : SM30, Check Skip Initial Screen Press Enter
    4 Goto Bottom left corner, click F4 select viewname, on right hand side give table name
    5 Press one more time F4, choose update , mark it X on right side.
    6 save the transaction.
    Thanks
    sandeep
    reward if helpful

Maybe you are looking for

  • Wireless Problems with my Macbook Pro

    I recently bought an Apple Macbook Pro, and I have been experiencing wireless connection issues. I have a D-Link DIR 655, and it is running in the mixed mode (wireless n and wireless g). The problem that I am experiencing is that my Macbook Pro loses

  • Safari is extremely slow to load pages & saving my bookmarks to my folders

    why is safari so extremely slow in loading pages? it can just about load my e-mail, if I wait about 5 minutes & I cannot check my t mobile cell phone balance because it gets stuck loading the page. Also I cannot get it to save bookmarks into my desig

  • How do you make curve window smaller? Much better in the PS CC version then PS CC 2014 version

    The size of the curve window is huge in comparison to all other previous versions. Any way to make is smaller? Looked through all the settings, and I have PS formated for smaller monitors already as well. Thank you!

  • Stop forcing upgrades

    I have been forced, by repeated interruptions to my work telling me that software had been downloaded, to upgrade Adobe Reader through two steps, first to 9.3.1 then to 9.3.2. This is a pure pain because I do not use Reader, having switched to Previe

  • Problem opening Organizer in PSE8

    I bought Photoshop Elements 8 and Photoshop Premiere 8 last year. Install them on my laptop and they worked fine. Three days ago, I was trying to open Photoshop Elements when I ran into problem. When I clicked on Elements ,it opened, and I got the wi