Serial/Sequence Generation in INFORMIX

Hello Friends,
How can a sequence number be generated in INFORMIX? Its known that there is SERIAL
column... But, is there any way to get this done as below:
func()
id=get_next_id();
EXEC SQL insert into table1 values (id, ...);
get_next_id()
EXEC SQL select .......I don't know what should come here???
return..
This is possible in Oracle as u can read the next value from a sequence. Does
Informix also provide some such functionality??
Thanks for ur time and answers.
Best Regards
MS

As far as I know, you can't. The serial is a property of the table. The new value
is created when you insert a row in the table.
(In fact you can force a value in the column, as long as it does not violate the
UNIQUEness constraint).
The engine will always try to take the next value, except when that is already
present. On startup it takes the highest value in the column + 1.
The serial is returned in the error structure (forgot the name for the moment)
after the insert, so you can use it for other updates.
The mechanism is less flexible than Oracle's, but automatic (as no separate select
is necessary), KISS like.
Regards
"Manoj SASIDHARAN" <[email protected]> wrote:
>
Hello Friends,
How can a sequence number be generated in INFORMIX? Its known that there
is SERIAL
column... But, is there any way to get this done as below:
func()
id=get_next_id();
EXEC SQL insert into table1 values (id, ...);
get_next_id()
EXEC SQL select .......I don't know what should come here???
return..
This is possible in Oracle as u can read the next value from a sequence.
Does
Informix also provide some such functionality??
Thanks for ur time and answers.
Best Regards
MS

Similar Messages

  • Problem on forms for serial number generation with last record next_record.

    Hi Experts,
    currently i'm facing one problem like :
    i'm populating one receipt detail in Multi block , like when user key in one receipt number that time record should go in first record ,and if they key in second receipt number then record should go in second record . mean to say every time record go in last record ..but the problem is i want to generate Serial no correspondence to every last record ..
    here is my approch :
    cursor c1 is
    select * from table
    where cname =:blk_name.clm_name.
    Last record;
    next_record;
    for v1 in c1 loop
    processed record;
    next_record;
    end loop;
    last_record;
    go_block(___);
    first_record;
    :sno := system.cursor_record ;
    next_reocrd;
    end loop;
    first_record;
    And in block level i'm writing code for Serial number generation when user key in manual entry for receipt detail:
    :blk_name.coulumn_name := :system. cursor_record;
    so in this approach their is no problem it is working properly but the problem is that
    when user fetch one receipt automatically and then after he want to enter next record manually and he decided to go in detail block ,
    and once he reached in detail block that time block level trigger i firing .ans serial number 2 generated and then suddenly he came to know no i want to fetch next record automatically mean to say now user going again master block and fetching next receipt detail ,
    but the problem is when user leaving seccond sr no and going in master block and population next receipt detail that time cursor going on 3 record
    but logically have to replace the second Serial no and generate the again serial number 2 record population .mean to say its not refreshing last_record..
    so i'm appreciating is anyone if came accoross this type of issue please corrrect my code and send updated code ..plsssssssssssssssssssssssssssssss
    Thanks
    Abhishek
    [email protected]

    hi
    I put this below code on when_new_record_instance on block level..
    :blk_name.column_name :=system.cursor_record;
    so can you please help me.....
    Thanks
    Abhishek

  • Serial number generation

    Hi friends,
    I have a question regarding the serial number generation.
    1. In serial number generation  do we have option of generating either when creating and releasing the production order or when doing the GR for the production order.
    If yes, please let me know how we can do that.
    2. If we have the serial number activiated for the material can we use auto goods receipt for the material?
    Thanks and regards,
    Satish

    Dear Satish,
    Go to OIS2 and create the serial number profile which will be later assigned to the material master.
    Select the serial number profile and select serializing procedure
    Here,select "PPAU Serial numbers in PP order" and enter the value as desired in serial number usage column.
    Similarly you can try for order release.
    We cannot activate auto GR for the items with serial numbers.
    regards,
    Joseph Charles Vaikathussery

  • Enhancement for Automatic Serial Number Generation

    Hi,
    Has anybody worked on the enhancement iqsm0001?
    If so, please give me some idea on how to use this enhancement for automatic serial number generation.
    Thanks for your kind help.
    Regards,
    Renjith Michael.

    Hi Renjith,
    You can check the following link, Hope it helps you to some extent:
    Re: Implement unique serial number within a client
    And you can also try user exit EXIT_SAPLIPW1_001 for Automatic serial number assignment.

  • Deactivate Serial Number Generation in MIGO

    Hi,
         In MIGO,Serail number generation is made mandatory through Create serial no.s automatically checkbox in serial number tab.The process is such that the user will Check and then Post.So while pressing the Check button,internally serail numbers are generated and while posting the serial numbers are generated skipping the generated numbers in Check.ex.while checking 001 and 002 are internally generated and aftr Post if we check in IQ03 we get 003 and 004;ie 001 and 002 are skiiped.
    Can anybody suggest how to avoid serial number generation while Check?

    Hi,
    Apply Transaction Variant and Screen Variant through transaction SHD0 for MIGO. Hope it will solve your problem.
    Otherwise, discuss this requirement with MM Functional Consultant. In SPRO, it may have some setting to make it display...
    Thanks
    Vikranth

  • Single image sequence generation. ?

    Hello, ..
    Essentially, I'm looking to find the best solution, to the idea of building sequences where and with using - importing, different sequencial, single images.
    — To be clearer perhaps, I'm a Weather student / enthusiast, and this would be toward generating a sequence / different sequences .. of hourly weather-satellite obtained images.
    To this point, or up until very recently, and in fact for several years previous, I have - in fact, been able to do this fairly simply, with using an older version of QuickTime (older logo, I think that main version offered still, through "Tiger".) and, with once I've dropped a first or more initial image more in particular, into the application, then merely dragging and dropping whichever others into its main viewer-window, checking save, and naming the file.
    — Perhaps, unorthodox. But, it's worked just fine for the idea.
    — And, of course, this idea can't be used with the newer version/s of QuickTime.
    "very recently": .... Today, and with having been using this method of "simple sequence" generation, together with older version of QuickTime, on my relatively new "iMac", and running Snow Leopard, Mac OS X v. 10.6.8 - all up to date, ....
    .. I've found that I'm no longer able to access the older version of the application.  (I think this advent, might be related to a "MacKeeper" clean-up that I did recently. ....)
    — In fact, the main reason that I can't say more exactly, which version it is - or was, in fact.
    Beyond this question more general, I'm thinking — (Something, I think that I'd read at one point in the past.) — that I can in fact do what I've suggested above, with / within QuickTime Pro.
    Hope this is clear - at all.
    Any help. ?
    Appreciate your response and time.

    Opening an "image sequence" (folder of sequentially named same dimension files) is a feature found only in QuickTime Player Pro.
    Beginning with Snow Leopard the OS includes QuickTime Player X (in Lion it is 10.1) in the Applications folder and QuickTime 7.6.6 is moved to the Utilities folder.
    QuickTime X has its own feature set but can't be upgraded to "Pro".

  • Sequence generation(urgent)

    Hi
    im new to jdev..I would like to set sequence generation for table fields.Im using JSp as my client and populating fields in the jsp screen.pls let me know is there any thing to set on wizard or any help in tutorial..thnks..

    I'm assuming that you've added your code segment to EmpImpl.java.
    The first parameter to SequenceImpl() should be the name of a database sequence, not the name of a table column.
    Once you've changed that, if you still get the same error, you need to check whether EmpImpl.java has a method called setId(), since this is what your error is complaining about. Your entity should contain accessor (getter and setter) methods by default. If your entity doesn't have these methods, then edit the entity, select the Java tab in the Entity Object Wizard, and check "accessor methods" for the entity object class.
    Lastly, I recommend testing your business components in the business component browser (aka the tester). This is a way of making sure your business logic works before you try to run your client.
    Blaise

  • I am enhancing the automatice serial number generation,, but include pgm ?

    I am enhancing the automatice serial number generation,, but include pgm  is not openings i want to write logic in the include pgm but it is not opening wht can i do, I founded exist in smod and in that the include pgm is not openings plz help me thanking U

    If you are talking about the include in the Exit Function module, then double click the Include, the system gives a warning sig, press Enter , a pop up is displayed saying Include does not exists.Create object ? Say yes here and do the need ful in the code generated.

  • Sequence generation in Oracle RAC env. (Cached, non-ordered)

    Env: Oracle Env. 11G, Transaction Java Application
    How does CACHED, non-ordered sequence behave (for PK generation), here is the scenario,
    Cache size =10
    Node 1 Active - Records created 1,2,3 (3 records total in table)
    Node Changes - 2 is Active - Records created 11,12,13, 14 (7 records total in table)
    Node Changes - 1 is Active - Records created 21, 22 (or are sequences going to be 4, 5) (9 records total in table)
    Node Changes - 2 is Active - No new record added (9 records total in table)
    Node Changes - 1 is Active - 2 more Records created (9 recor11s total in table) - Is it going to be 23, 24 OR or is it going to be 6,7 OR or is it going to be 31, 32 (9 records total in table)
    Please help with accurate generated seq numbers (PKs) for 9 records.
    Also, What happens to PK numbers at:
    * shutdown
    * hotbackup
    * mirroring whole schema or database to another separate db using storage mirroring
    * mirroring whole schema or database to another separate db using datapump
    How about using cached, ordered sequences to start with and change to no-order if needed for performance reasons
    -D

    A necessary problem solving skill in the Oracle environment is the ability to experiment. A couple of minutes constructing a simple test is better than hours of speculation:
    jw1> create sequence s1;
    Sequence created.
    jw1> select s1.nextval from dual;
      NEXTVAL
            1
    jw1> /
      NEXTVAL
            2
    jw1> conn sys/oracle@jw2 as sysdba
    Connected.
    jw2> select s1.nextval from dual;
      NEXTVAL
            21
    jw2> select s1.nextval from dual;
      NEXTVAL
            22
    jw2> conn sys/oracle@jw1 as sysdba
    Connected.
    jw1> select s1.nextval from dual;
      NEXTVAL
            3
    jw1> select s1.nextval from dual;
      NEXTVAL
            4
    jw1> exit
    Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Advanced Analytics and Real Application Testing options
    [oracle@berlin1 ~]$ srvctl start instance -db jw -instance jw1 -startoption force
    [oracle@berlin1 ~]$ sqlplus sys/oracle@jw1 as sysdba
    SQL*Plus: Release 12.1.0.1.0 Production on Sat Aug 16 10:40:40 2014
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Advanced Analytics and Real Application Testing options
    jw1> select s1.nextval from dual;

  • Sequence Generation on Oracle Client

    Hi...
    We have to create sequences on the oc4j client with the format <mobileuser name><date stamp><sequence number>.How do we get the mobileuser name from the mobile client authentication.Can u please tell us the API to login the mobile client and how it can be passed on to include in the sequence.
    Thanks in Advance....

    You need to place that code where ever you are creating your user session object. I don't know the architecture you are using so I really can't tell you exactly where to place it.
    http://download-uk.oracle.com/docs/cd/B19188_01/doc/B15920/nvappdev.htm
    Here is what the documentation has on the subject:
    <blockquote>
    7.2.4.3.2 Web-to-Go User Context
    Web-to-Go creates a user context (or user profile) for every user who logs in to Web-to-Go. Web applications always run within the user's specific context. Servlets, which are always part of an application, can use the user context (in which it is running) to access the services provided by Web-to-Go. The user context can then be used to obtain the following information.
    Name of the user
    Mode the user is running in (online or offline)
    Application that a user is accessing
    The database connection
    Roles that the user has for this application
    Name or value pairs stored in the registry for the user
    Servlets can access the user profile through the standard named java.security.Principal obtained through the getUserPrincipal method of the javax.servlet.http.HttpServletRequest class.
    This object can also be obtained from the HttpSession object. For example,
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException{
    // Retrieve the database connection from the User Profile,
    // which can be accessed from the HttpRequest
    HttpSession session = request.getSession(true);
    OraUserProfile profile = (OraUserProfile)session.getAttribute("x-mobileserver-user");     
    7.2.4.3.3 Database Connectivity in Java Code
    Servlets can obtain a connection to the Oracle database, using the following statement.
    HttpSession sess = request.getSession();
    WTGUser user = (WTGUser)sess.getAttribute("x-mobileserver-user");
    Connection conn = user.getConnection() ;
    </blockquote>

  • Sequence generation issue

    Hi , I am working in Healthcare industry . we have a claim and payment matching process . Every day 1.5 million payments get matched with 70 million claims and the matched payments are stores in some output table . After matching, an oracle seqence number is generated for each matched record and that is the primary key for the output table.
    Match query will be like this,.
    Select seqeunce1.nextval,a.column1,a.column2,b.coulmn1,b.column2 from claim_table a, payment_table b
    where a.column3=b.column3
    We are facing some seqence problem here. some sequence are missed during the first day and the missed sequnces are getting generated in the second day.
    Sequence Query:
    CREATE SEQUENCE ERA_CLAIM_MATCH_S
    START WITH 1
    MAXVALUE 999999999999999999999999999
    MINVALUE 1
    NOCYCLE
    CACHE 500
    NOORDER;
    Example to demonstrated the problem:
    Day 1(15th July) : sequence generated from 1 to 1000000 (some sequence are missed in between)
    Day2 (16th July) : sequence generated from 2500 to 2000000 (some missed sequence in day 1 are generated here)
    Our database in in RAC system.

    Hemant K Chitale wrote:
    I think that the question is : If the highest value generated on Day 1 was 1000000,  how could a value of 2500 be generated on Day 2 ?
    Shouldn't happen if the Sequence is a NOCYCLE.Hemant, but that is possible if Day 1's processing used the sequence on RAC instance 1 - whereas on Day 2, RAC instance 2 (with unused cached sequences from yesterday) is used.
    E.g.
    // on node 1
    SQL> create sequence testseq start with 1 increment by 1 nomaxvalue nocycle;
    Sequence created.
    SQL> select testseq.nextval, sys_context( 'user', 'instance_name' ) as instance from dual;
       NEXTVAL INSTANCE
             1 dev_1
    // on node 4
    SQL> select testseq.nextval, sys_context( 'user', 'instance_name' ) as instance from dual;
       NEXTVAL INSTANCE
            21 dev_4
    // on node 1, use the sequence a couple of times
    SQL> declare i integer; begin loop i := testseq.nextval(); exit when i > 100000; end loop; end;
      2  /
    PL/SQL procedure successfully completed.
    SQL> select testseq.nextval, sys_context( 'user', 'instance_name' ) as instance from dual;
       NEXTVAL INSTANCE
        100002 dev_1
    SQL>
    // on node 4, check the sequence
    SQL> select testseq.nextval, sys_context( 'user', 'instance_name' ) as instance from dual;
       NEXTVAL INSTANCE
            22 dev_4

  • Reg serial number generation at the time of GR-(MB31)

    Dear all,
    can we create a customized serial number  at the time of goods receipt (MB31)like ex: S0900001  where in S stands for plant number , 09 stands for the year and 00001 is running serial number
    please give the required steps to get the customized number for product identification.
    Thanks in advance
    venu

    Dear Venu,
    You want to generate Alphanumeric Serial Number that is possible by following Enhancement for Serial Numbers:
    Pls find here some details about generating alphanumeric serial numbers as below :
    You can generate alphanumeric serial number with the following BADI / Customer Exit:
    Name of Enhancement : IQSM0001
    Name of Function Module Exit: EXIT_SAPLIPW1_001
    Name of Include : ZXQSMU01
    ZXQSMU01:
    This user exit can be used to create the serial numbers automatically for material of a production order. Number of serial numbers generated will be equal to the total number of quantity. The purpose behind development of this user exit was to attach prefix in each serial number generated.
    so as per your requirement you can generate serial number like ABC0001 etc.
    Process Steps:
    For exit: EXIT_SAPLIPW1_001
    1. Get serial number profile for a material in respective plant.
    2. Check if the profile is u2018XYZu2019.
    3. If profile is u2018XYZu2019 generate the serial numbers for the given quantity of material in production order.
    General Program Structure
    For exit: EXIT_SAPLIPW1_001
    1. Get the serial number profile using function module 'MARC_SINGLE_READ' for a material.
    2. Check if the profile is u2018XYZu2019.
    3. If the serial number profile is u2018XYZu2019 then generate the serial numbers for the given production order quantity of a material.
    4. Concatenate ABC as a prefix to the all generated serial numbers
    Provide above details reg. implementation BADI / Enhancement to your ABAPer and go ahead.
    You can implement above Enhancement in CMOD.
    Hope this helps.
    Revert in case of any doubt.
    Award points if useful.
    Regards,
    Tejas

  • Sequence Generation

    Hi,
    I want to generate a sequence of numbers daily remebering where the last sequence number was from the day before.
    Is there a straight solution in lieu of using a JDBC solution.
    Can somebody help on this and give some clarity.

    Hi ,
    I guess by having a counter object ,storing the current sequence in it,and using persistence u can acheive the same.
    But i wud have gone for a database storage.

  • Serial Numbers generation  in XL Report

    Hi  All
    iam designing the reort using XL Report
    In that report i want to display the serial numbers column which should generate automatically at runtime of XL report which is not taken from any field it is
    what i have to do
    thanks in Advance

    Hi,
    The requirement is not under the scope of the xl reporter.
    But it can be achieved through a macro in the excel.
    Try to modify to your requirement with the following macro code
    Sub Macro1()
        ActiveCell.FormulaR1C1 = "1"
        Range("A2").Select
        ActiveCell.FormulaR1C1 = "2"
        Range("A1:A2").Select
        Selection.AutoFill Destination:=Range("A1:A17"), Type:=xlFillDefault
        Range("A1:A17").Select
        End Sub
    Also refer this document on [How to to Apply Microsoft Excel Macros within a Report Definition in XL Reporter|https://websmp206.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_SCENARIO=01100035870000000183&_OBJECT=011000358700002122502006E]

  • How do you implement serial number generation and/or paypal integration?

    Hi,
    perhaps this question is a bit of topic. But have you ever thought about this point or even better do you have an solution for this?
    Rgds - Wilko

    The only ways to find a serial number without having the iPhone are by looking at the iTunes backup or on the packaging. If you don't still have the box and you didn't make a backup in iTunes or it doesn't show the serial number - see:
    http://support.apple.com/kb/HT4061
    then I know of no way you'll be able to get the serial. It will not be shown in your iTunes Store nor in iCloud.
    Regards.

Maybe you are looking for

  • ASA Firepower installation stuck in recovery

    Trying to get the the boot image installed on an ASA5515-X and it appears to hang at this portion of the installation and never finishes the recovery Mod-sfr 797> Starting OpenBSD Secure Shell server: sshd Here is the complete debug (200) output  Mod

  • Optimize process designing with Photoshop (or other Adobe apps)

    Hi I am searching for a long time to optimize my process, and I want to ask you if there is a solution to what I am looking for: 1. can I create a custom panel in Photoshop CS5 where I can save smart objects? for later use?, I am working with Mini-Br

  • Wi-Finetworks are not saved as Known Networks

    Hello everybody! I recently updated my iPhone to 1.1.3 software and I have noticed that the networks I have joined before are not saved anymore, which is very annoying because I have to enter the password every time I want to join to any "known" netw

  • How to move my palm to another laptop

    I've recently bought a new laptop that has Windows 8.1 and I want to put my Palm Tungsten e on to it. Previously it has been on Windows 7 on my old laptop (it's still on there at the moment) I'm not very good on computers so can anyone give me a step

  • JRockit 'could not create the Java virtual machine'

    I installed JRockit (build R28.1.4-7-144370-1.6.0_26-20110617-2130-linux-x86_64) on a server SLES11SP1 (x86_64), but I got the following erros when I tried to run java command: /usr/lib64/jrockit-jdk1.6.0_26-R28.1.4-4.0.1/bin # ./java [WARN ][codegc