More than one squence number

i am using a sequence number to assign a primary key value for an invoice but i want that squence to be set to one at the end of the day (i mean that the compination between the sysdate and the squence will build the primary key) so how can i set the sequence to one for the first invoice for each day.

Magic. If you want to know more about row_number function why not check the SQL Reference manual.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions105a.htm#SQLRF06100
It can be found by going to the documentation library at
http://tahiti.oracle.com
Selecting your database version and then using the search function.
SQL> create table invoice_table (
  2    id number,
  3    invoice_description varchar2(60),
  4    invoice_date date
  5    );
Table created.
SQL> create or replace view invoice as
  2  select cast(to_char(invoice_date,'ddmmyyyy') || '|' ||
  3    to_char(row_number() over (
  4      partition by trunc(invoice_date)
  5      order by invoice_date),'fm000000')
  6      as varchar2(15)) invoice_no,
  7    invoice_description, invoice_date
  8  from invoice_table;
View created.
SQL> create sequence invoice_seq start with 10000 increment by 10;
Sequence created.
SQL> create or replace trigger invoice_trig_bi
  2  before insert on invoice_table
  3  for each row
  4  begin
  5    select invoice_seq.nextval, sysdate
  6    into :new.id, :new.invoice_date
  7    from dual;
  8  end;
  9  /
Trigger created.
SQL> insert into invoice_table (invoice_description)
  2    values ('test 1');
1 row created.
SQL> insert into invoice_table (invoice_description)
  2    values ('test 2');
1 row created.
SQL> insert into invoice_table (invoice_description)
  2    values ('test 3');
1 row created.
SQL> insert into invoice_table (invoice_description)
  2    values ('test 4');
1 row created.
SQL> insert into invoice_table (invoice_description)
  2    values ('test 5');
1 row created.
SQL> select * from invoice_table;
        ID INVOICE_DESCRIPTION  INVOICE_D
     10000 test 1               29-JUN-05
     10010 test 2               29-JUN-05
     10020 test 3               29-JUN-05
     10030 test 4               29-JUN-05
     10040 test 5               29-JUN-05
SQL> /*
SQL>   This update is for demo only to show
SQL>   Invoices entered over two days.
SQL> */
SQL> update invoice_table set invoice_date = invoice_date - 1
  2    where id < 10030;
3 rows updated.
SQL> select * from invoice_table;
        ID INVOICE_DESCRIPTION  INVOICE_D
     10000 test 1               28-JUN-05
     10010 test 2               28-JUN-05
     10020 test 3               28-JUN-05
     10030 test 4               29-JUN-05
     10040 test 5               29-JUN-05
SQL> select * from invoice;
INVOICE_NO      INVOICE_DESCRIPTION  INVOICE_D
28062005|000001 test 1               28-JUN-05
28062005|000002 test 2               28-JUN-05
28062005|000003 test 3               28-JUN-05
29062005|000001 test 4               29-JUN-05
29062005|000002 test 5               29-JUN-05
SQL>

Similar Messages

  • Can i have more than one phone number on my itunes account?

    My son and I use the same apple ID. He has a separate phone number to me and wants to use imessage on his ipad.
    How can I set up my account to use more than one mobile number?

    He would have to use a separate ID for iMessage in order to do this.  You can still share the same ID for iTunes; it doesn't have to be the same as the ID used for iMessage.  To do this, have him go to Settings>Messages>Send & Receive, tap the ID, sign out, then sign back in with a different ID.

  • Creating more than one serial number for a material upon Goods Receipt

    I am trying to configure the system to create more than one serial number automatically for a material and have the equipment record created at the same time with the same number as the serial number.  For example using MB1C, receiving a material for a quantity of 2, the Maintain Serial number pop up box appears, selecting the 'Create serial number automatically' , I receive an error message ' Number of numbers to be assigned must be 1   
        Message no. NR030        
    Can someone help me with this issue.

    I have tried MIGO and get the same error.  The  Plant data/stor 2. tab of the  material master for this particular material is set as follows
                                                                                    Serial no. profile   NS01 SerLevel   1  Keep equipment number and serial number synchronous.
    Would there be configuration missing?

  • Using more than one phone number on single iPhone for iMessage?

    Is it possible to intentionally have more than one phone number listed under Settings > Messages > Send & Receive?  I know I've heard of 'glitches' where more than one phone number is shown accidentally and how that is solved (signing out of iMessage and then back in), but if you want to intentionally have more than one phone number listed there (say, the phone number of your own device and also the phone number of your work-related iPhone), is there a method?  I'm leaning toward the answer of 'no', but I'm wanting to double check.

    robdrage wrote:
    I'm not sure, but if you use the same Apple ID for both iphones and register both with messages, then you may be able to go to device one Settings>Messages>Send&Receive and select device twos number as well.
    I thought about that. For some reason, I think that I've heard it doesn't work. Sadly, however, I don't have two iPhones with which to test it.

  • Bapi for goods movement to transfer more than one serial number

    Dear Gurus
    Is their any BAPI with help of which i can transfer More than one serial Number against a single PO.
    We are having scenario where material is transfer from one client say XYZ to another client ABC.
    Now here the serialised material is transfer angainst diffrent POs with the help of I-Doc from one client to another using movement type 501.
    so please help me .Suggest BAPI with the help of wich i can transfer more than one serial number against one PO.
    I have already tried the following BAPI.
    MB_CREATE_GOODS_MOVEMENT
    BAPI_GOODSMVT_CREATE
    Regards
    Anand Battulwar

    Hi ,
    Already this BAPI (BAPI_GOODSMVT_CREATE) has a structure to handle multiple serial number (BAPI2017_GM_SERIALNUMBER).
    Example of working :
    Assume if you have two materials with Qty 2 each ..
    You need to enter Item 1 , Serial 1 and next line item 1 , serial 2  after that item 2 , serial 1 and  item 2 , serial 2 ..
    Do not sort this table , as system take the serial number base on quantity from qty line..
    What's the issue you are facing ?
    Thanks,
    sudhi

  • MORE THAN ONE PERSONEL NUMBER IN OPERATION OF MO

    Dear Experts,
    My client is asking for entry of more than one personal number for each operation.
    In the Internal Tab of each operation,Now I could able to enter only one personal number.How to enter multiple personal number for one operation .I hope If we enter multiple personal number then it will reflect in confirmation screens also.Pl help guys as the requirement is very urgent
    ISWARI

    Thank you very much for your immediate suggestions.As told my Mr Subash and Mr Vinay,Iam not getting the tab page Requirements assignment in the Internal tab page of operation.I have tried out all options in WC.I don't know where Iam actually missing something.
    More over will it reflect in confirmation through IW42 or IW48.Because my client wants to track the no of hours worked by personal number wise for the particular period.
    As told by Mr Bala,by sub-operation wise Iam able to enter the multiple personal number with actual hours in IW42 or IW44.By doing this way in IW47,I able to track no of hours worked by personal number wise for the particular range of posting period.
    Iam also checking the route suggested by Mr Thiyagarajan.
    I request you all once again to suggest me the absolute correct method
    Thanks in advance
    Regards
    ISWARI

  • How to add more than one phone number in imessage?

    How to add more than one phone number in imessage?

    If you mean sending to multiple phone numbers, place a comma between the numbers in the "To" box, or select the "+" to use numbers in your Contacts

  • Enter more than one personnel number for the same confirmation in CO11N

    More than one labor working on Machine work center simultaneously.
    So that during production orders confirmation in CO11N we need to enter more than one personnel number for the same confirmation but in CO11N the system allow me to enter only one personnel number.
    Note: I can not distinguish between the productions for each labor so that I can not enter separate confirmation for each labor.

    Hi,
    You can use the User Exit: CONFPP07  Single Screen Entry: Inclusion of User-Defined Subscreens
    for this purpose..
    Take help from the ABAPer for this enhancement..
    Regards,
    Siva

  • Regarding having more than one telephone number of customer

    If my customer has more than one telephone and/or fax number, how can i enter them all in the customer master during customer creation??

    Hi Sobhan,
    There is an option beside the text box in customer master to enter the multiple values.
    The option is an arrow is there that is for multiple values.
    Click on that option and then click on new values(The option with icon + button).
    Enter your telephone number.
    Press enter.
    Similarly the same type of option is available for fax also.
    Enter your fax number and then press enter.
    Below that icon you will find a green coloured small box after entering means multiple values are there for that field.
    Regards,
    Mohan.

  • Service PO for more than one activity number

    Hi Experts,
        I'm working on service process, my client requirement is to create a Service PO, SES and Invoice using BAPI's.
        While creating Service PO using BAPI_PO_CREATE1 with
        Item cat 'D' and Acc *** Cat 'P' and more than 1 activity number at the services level,
        service PO is getting created only for the 1st activity and not for the rest of the items.
    Can you please help me in solving this issue.
    Thanks & Regards
    PravithaNambiar

    Hi,
    The profile you would need would look something like this:
    Object Type: P
    Object ID: <blank>
    Maint flag: not checked (for display access)
    Eval Path: <blank>
    Status Vector: <blank> (though the system will probably set it to 12 anyway)
    Function Module: <The name of your function module that returns the second pern of the current user as type HROBJECT. See standard module RH_GET_MANAGER_ASSIGNMENT for an example>
    This profile can then be used to grant users access to their "second PERNR".
    Kind regards,
    Brent

  • HT3529 How do I send a text message to more than one phone number at the same time?

    How do I send the same text to more than one phone at the same time?

    You'll need to see if there's an app in the App Store that does what you want. Search for "Group SMS" or similar.

  • HR authorization for more than one personnel number

    Hi,
    We have some employees created in system assigned to two personnel numbers, because for example, we have some cases that the employee is active, but he is also created in system as pensioner.
    In spite of this, the infotype 105 is only created for the active employee, which means the userid is assigned to only one personnel number.
    There's a portuguese tax report which we need to provide access to these employees, that should print both employees data, but since the user has only access to personnel number assigned in infotype 105, he is not able to see it.
    What kind of authorization do we need to give to these employees, so they can have access to both personnel numbers data?
    Thanks in advance.
    Best regards,
    Sónia Gonçalves

    Hi,
    The profile you would need would look something like this:
    Object Type: P
    Object ID: <blank>
    Maint flag: not checked (for display access)
    Eval Path: <blank>
    Status Vector: <blank> (though the system will probably set it to 12 anyway)
    Function Module: <The name of your function module that returns the second pern of the current user as type HROBJECT. See standard module RH_GET_MANAGER_ASSIGNMENT for an example>
    This profile can then be used to grant users access to their "second PERNR".
    Kind regards,
    Brent

  • More than one map number per topic?

    I have been asked to create context sensitive help with
    RoboHelp6.
    Is it possible to create bookmarks in a topic and have
    different map numbers open to these different bookmarks in the same
    topic OR does each map number have to have one unique topic?
    Judy

    Duplicate thread. Please post follow-ups to:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=449&threadid=1377886
    Pete

  • More than one online number

    How do i purchase another online number? I already have one on my account and need another local number for a different city. 
    Please advise,
    matt

    Same question, I use Skype to place most calls when I am at my computer- but I want to be able to have incoming calls received through my computer as well.
    Additionally, I just purchased an australian number to save money for my australian business partner.
    So, I need to know if purchasing the second one will overridde the other one, or if I can receive calls on either number.
    Please advise.

  • Can i associate more than one number to my iMessage account?

    I live in Canada at the moment and am from Seattle, and am wondering if there is a way to associate more than one phone number to iMessage?

    No.  While you can associate multiple email addresses, only one phone number can be associated, and it is automatically done when you connect the iPhone to iMessage the first time.
    If you changed the SIM to another one with a separate number, it would replace the existing number, not add the new number along with the existing one.
    One possible solution - get a google voice number for the second number and set up GV message forwarding to your mobile number.

Maybe you are looking for