Insert the sequence number in table

Hi..i created one table and i want to insert the sequence num in one column using sql query is it possible? please help me

Try this..
SQL> create table t1(x number);
Table created.
SQL> create sequence seq_x;
Sequence created.
SQL> insert into t1 values(seq_x.nextval);
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
X
1
2
3
4

Similar Messages

  • How we cn avoid the sequence in remote tables through global temporary tabl

    Hi,
    We have table xx_interface_qualifiers in the remote db and we are inserting the data like this and its on a loop
    INSERT INTO xx_interface_qua
    (interface_id,
    list_line_interface_id, excluder_flag,
    qualifier_context, qualifier_attribute,
    qualifier_attr_value, qualifier_precedence,
    comparison_operator_code, start_date_active,
    end_date_active, list_header_name, list_line_no,
    creation_date, created_by, last_update_date,
    last_updated_by, interface_attribute1
    VALUES (xx_interface_qua_s.NEXTVAL,
    ttt, 'Y',
    xxx, xxx2,
    xxx3, xxx4,
    '=', SYSDATE,
    NULL, xxx4, -1,
    SYSDATE, '-1', SYSDATE,
    '-1', 44 );
    We are trying to avoid the hitting of the database every time for a sequence and try to implement the global temporary tables,i mean to say 1st we need to insert the data to TEMP table and then from temp table we cn inseert all the data to xx_interface_qual in a single shot to improve the performance.
    But how we cn avoid the sequence in this case as we do not know the sequence in remote side.
    Please suggest any other way to improve the performance.
    Regards
    Das

    797846 wrote:
    We have table xx_interface_qualifiers in the remote db and we are inserting the data like this and its on a loop
    We are trying to avoid the hitting of the database every time for a sequence and try to implement the global temporary tables,i mean to say 1st we need to insert the data to TEMP table and then from temp table we cn inseert all the data to xx_interface_qual in a single shot to improve the performance.
    But how we cn avoid the sequence in this case as we do not know the sequence in remote side.Does not make sense. I/O is the slowest database operation.
    You have an unknown performance problem (that you claim is due to a sequence, but failed to provide any evidence for). Now you want to create more I/O, by writing the data twice. Once into a temp table and then again into the destination table. And do that in order to increase performance?
    I do not see how this can solve the underlying, and unknown, performance issue that you claim exists.
    Any problem solution needs to start with correctly and comprehensively identifying the problem.
    You cannot solve a problem without first knowing WHAT the problem is.

  • Insert the data into two tables at a time.

    Hi ,
    i have these two tables
    create table [dbo].[test1](
    [test1_id] [int] identity(1,1) primary key,
    [test2_id] [int] not null
    create table [dbo].[test2](
    [test2_id] [int] identity(1,1) primary key,
    [test1_id] [int] not null
    alter table [dbo].[test1]
    add constraint [fk_test1_test2_id] foreign key([test2_id])
    references [dbo].[test2] ([test2_id])
    alter table [dbo].[test2] add constraint [fk_test2_test2_id] foreign key([test1_id])
    references [dbo].[test1] ([test1_id])
    I want to insert the data into two tables in one insert statement. How can i do this using T-SQL ?
    Thanks in advance.

    You can INSERT into both tables within one Transaction but not in one statement. By the way, you would need to alter your dbo.Test1 table to allow null for first INSERT test2_id column
    See sample code below:
    CREATE TABLE #test1(test1_ID INT IDENTITY(1,1),test2_id INT NULL)
    CREATE TABLE #test2(test2_ID INT IDENTITY(1,1),test1_ID INT)
    DECLARE @Test1dentity INT
    DECLARE @Test2dentity INT
    BEGIN TRAN
    -- Insert NULL as test2_ID value is unknown
    INSERT INTO #test1(test2_ID)
    SELECT NULL;
    -- get inserted identity value
    SET @Test1dentity = SCOPE_IDENTITY();
    INSERT INTO #test2(test1_ID)
    SELECT @Test1dentity;
    -- get inserted identity value
    SET @Test2dentity = SCOPE_IDENTITY();
    -- Update test1 table
    UPDATE #test1
    SET test2_ID = @Test2dentity
    WHERE test1_ID = @Test1dentity;
    COMMIT
    SELECT * FROM #test1;
    SELECT * FROM #test2;
    -- Drop temp tables
    IF OBJECT_ID('tempdb..#test1') IS NOT NULL
    BEGIN
    DROP TABLE #test1
    END
    IF OBJECT_ID('tempdb..#test2') IS NOT NULL
    BEGIN
    DROP TABLE #test2
    END
    web: www.ronnierahman.com

  • I have replaced my computer and when I am asked to enter the redemption code I insert the serial number but it tells me it is not valid

    I purchased Adobe Photoshop Elements  in Dec 2013. I have had to buy a new computer and when I try to install and when I am asked to enter the redemption code I insert the serial number but it tells me it is not valid. What do i  need to do.
    Noel

    noelcj26 wrote:
    I purchased Adobe Photoshop Elements  in Dec 2013. I have had to buy a new computer and when I try to install and when I am asked to enter the redemption code I insert the serial number but it tells me it is not valid. What do i  need to do.
    Noel
    If you registered the product with Adobe (Version 12 and 13 required mandatory registration) then the correct serial number must be recorded in your Adobe account.  You can login and check there and also copy and paste the number to avoid any mistakes in reading the numbers.
    Good luck.

  • Triggers to insert the record in a table

    I have two table 1. Holiday 2. Attendance.
    When I insert the record    in holiday table for his
     advance holiday   with empid, the same time I want to insert it attendance table
     automatically for the same date using a trigger
    Insert into attendance (empid,date,holiday) values (20078,07/10/2014,1). If holiday column value 1 represent holiday marked,
     0 represent  holiday not marked. The same thing can happen vice versa
    If employee mark his current attendance as  holiday through attendance,
     it should   be  inserted into holiday table 
    automatically using triggers.
    Insert into  Holiday (empid,date,holiday) values (20078,06/08/2014,1). If holiday column value 1 represent holiday marked,
     0 represent  holiday not marked. The same thing can happen vice versa
    Please I am looking for your help , how I can make it using triggers 
    to insert both table  in two different ways of options.
    Regards
    Pol
    polachan

    Hi polachan,
    According to your description, if you want to synchronize the data between the holiday table and the attendance table while inserting records into holiday table, you need to create a trigger on the holiday table, please try the following syntax.
    use <databasename>
    go
    create trigger Tr_holiday
    on holiday
    for insert
    as
    declare @empid varchar(20),
    @date datetime,
    @holiday int
    select @empid = empid, @date=date, @holiday=holiday from inserted
    declare @qty int
    select @qty =count(*) from attendance where empid=@empid and date=@date and holiday=@holiday
    if @qty<1
    begin
    insert into attendance
    select i.empid,
    i.date,
    i.holiday
    from inserted i
    end
    Meanwhile, if you want to insert the record into the holiday table when holiday is updated to 1 in the attendance table, you need to create another trigger on the attendance table, please try the following syntax.
    use <databasename>
    go
    create trigger Tr_attendance
    on attendance
    for update
    as
    declare @holiday int
    if update (holiday)
    begin
    select @holiday=holiday from inserted
    if @holiday=1
    begin
    insert into dbo.holiday
    select empid,
    date,
    holiday
    from inserted
    end
    end
    For more details about creating triggers in SQL Server, please review this article:
    CREATE TRIGGER (Transact-SQL).
    Thanks,
    Lydia Zhang

  • T.code S_ALR_87100833: in the aouput list the sequence number ...

    Hi All,
    launching the tax report by t.code S_ALR_87100833, in the output list the sequence number is linked to the tax code. Instead, I need it depends on the number of document listed.
    Any suggestion for me?
    Thanks
    Gandalf

    hi,
    Advance return for tax on sales on purchases
    enter c.code 1000
    Fiscal year    2008
    general selections
    posting dates  01.04.2008  to 31.03.2009
    Select Further Selections tab
    1. Tax on sales purchases Codes   select multipl selection
    enter ur output tax code or input tax code
    than excuite
    2.Transaction  select multiple selection 
    enter ur output tax Account Keys or Input tax Account keys
    than excuites
    next again Excuites
    than see ur advance tax out put or input tax reports
    this is  the way for advance tax retuns
    ur problem not understood
    path : easy access - accounting - financial accounting - general ledger - reporting - Tax reports - general - advance tax returs on sales and purchases - s_alr_87012357 advance tax on sale and purchases
    regards,
    janakiram

  • The sequence number when exporting should represent stacks

    When exporting images, I would like the sequence number to apply to the first image in a stack, but the rest of the images in the stack should have the same number as the first one but with an extra suffix. Something like this:
    stack 1:
    DSCN0010.DNG
    DSCN0011.DNG
    DSCN0012.DNG
    stack 2:
    DSCN0013.DNG
    DSCN0014.DNG
    When exported, I would like them to be:
    DSCN0010.DNG --> "image-01.jpg"
    DSCN0011.DNG --> "image-01b.jpg"
    DSCN0012.DNG --> "image-01c.jpg"
    DSCN0013.DNG --> "image-02.jpg"
    DSCN0014.DNG --> "image-02b.jpg"

    Hi,
    The numbers in a CREATE SEQUENCE statement are all literals; no other kinds of numeric expressions are allowed.
    You need dynamic SQL to do anything like what you want. For example:
    COLUMN     seq_start_col     NEW_VALUE  seq_start
    SELECT     1 + MAX (val)     AS seq_start_col
    FROM     table_x;
    CCREATE SEQUENCE TEST_SEQ.NEXTVAL
    START WITH  &seq_start
    MAXVALUE 9999999999999999999999999999
    MINVALUE 1
    NOCYCLE
    CACHE 20
    NOORDER;

  • Scanner(Warning) : 027: Unable to read the sequence number from the Workstation object.

    Hi
    We are having trouble storing inventory scans from some workstations.
    We have a windows ONLY environment, with middle tier servers. (ZEN65SP1,
    W2KSP4).
    Some workstations are storing fine. The Storer function is working and we
    can see the storer functions for the 'good' workstations in the Inventory
    service window.
    However some workstations can't store to the inventory db, but DO populate
    eDir ZENworks inventory 'minimal information' but show "Scanner(Warning) :
    027: Unable to read the sequence number from the Workstation object." in
    the Scan Status...
    The Inventory service window shows no attempt by these workstations - it's
    almost as though the scan file is not arriving (though eDir knows/displays
    the scan file name)
    How does the workstation access the scandir in Windows only/middle tier
    environment? Does the scan xml stream get sent to the MT via http and then
    on to the scandir via CIFS?
    Any suggestions/explanations welcome!!
    Many thanks
    David

    David,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
    - Check all of the other support tools and options available at
    http://support.novell.com.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://support.novell.com/forums)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://support.novell.com/forums/faq_general.html
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • 027: Unable to read the sequence number from the Workstation object

    Environment:
    NW 6.5 sp4
    Zen 6.5 sp1
    We had a problem with our inventory server processing .STR files a couple
    months ago - had to turn off inv. policies on workstations while we resolved
    it. Now it's resolved and we're running inventory again. We have a large
    number of workstations reporting this error:
    027: Unable to read the sequence number from the Workstation object
    They have no data in the DB, although they do have minimal scan info, and
    the last scan status date matches that of the sequence number error.
    I've seen this sporadically in the past and have been able to resolve it by
    initiating a full scan on the individual workstation. However, that does
    not seem to be making a difference this time.
    Novell's troubleshooting document basically says see if the server's
    running, and see if there's data for the workstation in the db. Then call
    tech support.
    Any other ideas?
    ~~~Nicoya...

    Jared wrote:
    > Nicoya Helm,
    >
    >> 027: Unable to read the sequence number from the Workstation object
    >
    > I am thinking that this can also mean a previous full scan was not
    > found. Or maybe the STR file name is bad.
    >
    > This information is stored here
    > HKEY_LOCAL_MACHINE\Software\Novell\Workstation
    > Manager\InvScanner\"STRFileName"
    The machines I'm troubleshooting have valid formats for their STR names,
    but that doesn't necessarily mean they are valid STR sequence numbers.
    Does removing the value in the reg key cause the STR file name to be
    recreated?
    >
    > Because imaging is used, it's possible that this information is matching
    > on some machines which could cause problems.
    I've verified that none of our images contain the c:\zenworks history
    folder, and we run a script that cleans up any zenworks items before
    sysprep (i.e. makes sure there's no registration info on the
    workstations, etc). Our imaging scripts also clear any ZIS info to
    avoid any duplication as well, so I don't think imaging would be causing
    this.
    > I believe 6x also has a hist.ini file like 3x inventory does, you might
    > delete the file also.
    Good tip about the hist.ini file, I didn't know about that. It does not
    solve the sequence number error, but it does seem to force a full scan
    of the system and cause the new scan to be stored in the DB, which was
    not happening before.
    Thanks!

  • Can i change or modify or insert the data in standard tables

    hi gurus
    can i change /modify/insert the data in standard tables
    witout using module pools
    plz send the  progem lines also
    it ll be very helpful to me
    thank you
    kals.

    Hi Kalyan,
    It is not advisable to update standard tables directly or through your own module pool programs also.  The reasons are,
    1.  It is difficult to find out how many tables are updated through the transaction.  if we leave one table also as Mr.Andrew said data integrity will be lost.
    2.  Authorization objects and profiles will be totally bypassed if data is inserted through custom programs.
    3.  Complete data validation is not possible.  There are certain validations that are executed through code and appropriate errors and warnings are shown in the transactions.  If we insert data directly to the tables anything can be inserted into the table field violating all the validations unless we have field level check constraints on the tables at database level.
    4.  User Exits and BADIs that are implemented for specific business requirements and checks will not function on the data.
    5.  Update & Transaction locks will not work properly.
    Due to above reasons, definitely you should avoid updating standard tables directly.
    There are many tools such as LSMW Recordings, BDCs, BAPIs, IDOCs, Upload Interfaces available in SAP through which bulk data can be updated without using relevant transactions.
    You can collect data from end users in text or excel sheets or through custom programs in required format and upload at once through above mentioned tools.
    Regards,
    Hema

  • How to change the sequence number in the test packages?

    Hello,
    I need to change the sequence number in the test packages. Currently I use "move test case." However you can only move one item at a time.
    There is another option to make this change?
    Best regards,
    Elisabete

    Hi Elisabete,
    Sorry, I've to acknowledge the reply from Fabricius.
    That's poor in release 7.0. A former version provided a solution where it was possible to move a testcase even over pages at once.  May be SAP changed this functionality because of other problems caused by the former solution.
    Therefore I am looking for a business blueprint structure meeting the logical and operational process for little need of changes in sequences.  And I create E2E-scenarios / E2E-processes as an additional structure in a project to have an easier approach in the Test Workbench.  An other option is to divide test packages into smaller ones.
    I hope we can look foreward to a better and more comfortable solution in release 7.1.
    Best regards,
    Adelbert

  • I have a problem when iTunes card insert the card number comes message the code you entered has not been properly activated

    I have a problem when iTunes card insert the card number comes message the code you entered has not been properly activated

    Is the store that you bought it from close so that you could try going back to them and ask them to activate the card properly ? If not then try contacting iTunes Support (you will probably need to give them images of the front and back of the card, and possibly its receipt) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then iTunes Cards And Codes

  • Retrieve the sequence number just used in the insert

    Hi All, is there a way to use the sequence.nextval for an insert and return the sequence value in one call?
    We need to port our application from MS SQLServer to Oracle. The tables in SQLServer have Identity columns as the primary key. We can do the insert and retrieve the identity column value with one call to the database. I wonder if we can do the similar thing with Oracle.
    I found out that there is a "returning into" clause for an insert statement that can return information on the current row, something like: insert into tbl (id, name) values (seq.nextval, 'name') returning id into my_id. I can't get the above query to work.
    Any help is greatly appreciated.
    Xiaoyun

    Hi Tim,
    To avoid this problem you can do one thing. If you are quering the database from java, place both the commands in a synchronised block as follows:
    synchronized(this){
    This will allow only one user to enter the block and hence helps to retrieve the same value.
    The same procedure is followed in Survey Sample located at
    http://otn.oracle.com/sample_code/tech/xml/xmldb/content.html
    Have a look at that. Check the saveChoiceGroups method in ChoiceGroupCache.java
    Regards,
    Anupama

  • How to find the sequence for a table.

    Hi Everyone,
    I've got plenty of sequences. How can I identify that what are the sequences acting on a table?
    Regards,
    BS2012.

    Greg.Spall wrote:
    In my last job, we used the table/column comments to point to the sequence.
    so:
    CREATE SEQUENCE seq_test1;
    CREATE TABLE my_table
    (id   number);
    COMMENT ON TABLE my_table IS 'Test table for demonstration purposes on OTN';
    COMMENT ON COLUMN my_table.id IS 'Primary Key, sequence populated: seq_test1';... or something like that :P
    But yeah, outside of that, good luck if you have no documentation!Of course, ALL of the 'code search' solutions put forth are assuming the references will be found in PL/SQL packages. That ignores the potential that the code could be located somewhere else, like application code that exists OUTSIDE of the database .... Bottom line is that there is no 100% one-size-fits-all method for automating the discovery of relationships between tables and sequences.

  • Inserting the column values into table from view through procedure!!!

    below is my example code
    Create or replace procedure test_proc
    is
    cursor test_cur is
    select a.col1 , b.col2, c.col3, d.col4, e.col5
    from tableA a, tableB b, tableC c, tableD d, tableE e;
    test_cur_rec test_cur%rowtype;
    Begin
    insert into test_stg ( col1, col2, col3, col4, col5, col6, col7)
    Values ( test_cur_rec. col1,
    test_cur_rec .col2,
    test_cur_rec .col3,
    test_cur_rec .col4,
    test_cur_rec .col5
    -- col6, col7 );
    create view test2 (
    select f.col6, g.col7 from tableF f,tableG g);
    I m trying to insert values into the table test_stg but for col6 and col7 i need to get the data from the view test2.
    In simple word, all i need to do is get the 2 columns data from view and insert into a table through procedure. The above code is the example which looks very much like my actual code.
    How do i accomplish this task ??

    well there is joining condition for a, b,c ,d, e tables, i have not mentioned here. The where condition has nothing to do with the other two columns of the view.
    There is no relation ship between the these tables the view. The col 6 and 7 i m inserting from view is sysdate timestamp and the job_id number.
    so its pretty straight forward insertion into the table from view columns. These two columns has just one row with id number and timestamp. so i need to insert these data into the the table when i run a procedure.
    Thank you so much!!!

Maybe you are looking for

  • Update my Adobe Acrobat to version 10.1.12

    i was prompted to update my Adobe Acrobat to version 10.1.12.  i did what i always do and got an error message #1301.  i don't know what this is, even after reading the stuff on this page:  http://helpx.adobe.com/acrobat/kb/troubleshoot-update-errors

  • Handling RFC errors

    When an RFC calls fails I get the standard Rails page with the dump; how to detect and handle rfc errors (like subrc check); thanks

  • Error message when syncing calendars

    I've been successfully syncing my iPhone 4 with iTunes for the past year on my 2011 iMac. I recently upgraded to the latest (thin) iMac and an iPhone 5. Everything has worked smoothly for the past week or so, but just now, when syncing, I got an erro

  • Reference table / reference field for currency/quantity field in tables.

    Hello Sap Experts , Am a newbie and not able to make head or tail of what reference table and reference fields are when related to currency / quantity fields.Someone if could explain to me with a small example it would be great.

  • Canon 1Ds MK3 & Lightroom

    When will Adobe issue the update to enable Canon 1Ds MK3 raw files to be imported into Lightroom?