Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    42

    Unanswered: writing a function

    Sorry it seems i wasn't clear ,i need a function that return a serial no in this formate v00000,v00001,....


    thanks
    Last edited by F.I.K; 06-02-04 at 07:49.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    I think what you are looking for is:

    return 'V' || ltrim(to_char(last_base,'000000'));

    BTW, have you considered using a Sequence?

    create sequence base_seq;
    Code:
    create or replace
    function get_base return varchar2 is
      last_base number;
    begin
      select base_seq.nextval
      into   last_base
      from   dual;
    
      return 'V' || ltrim(to_char(last_base,'000000'));
    end;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •