Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to user sequence numbers uniquely
Just create a field (varchar2) in the desired table and store the formatted
date concattenated with the cust name.
Create table CUST_INFO (
cust_id number, cust_first_name varchar2(30), cust_last_name varchar2(30), unique_id varchar2(100)
In your application, insert using the following syntax:
insert into CUST_INFO values ( 1, 'Frank', 'Naso'||to_char(sysdate, 'yyyymmddhh24miss') );
This will allow a unique_id per customer per second. If you want it per day, use: to_char(sysdate, 'yyyymmdd')
hope this helps, as far as "sample code", it depends what your coding in?
PERL, VB, C, C++, PL/SQL, COBOL, SQL*PLUS, ....???
In article <6smdat$lmg$1_at_nnrp1.dejanews.com>,
maadhav_at_yahoo.com wrote:
> Hi I can create sequence numbers for a table. But i want to create a sequence
> number which is unique on a daily basis. Suppose i am assiging a customer
> mr.xyz an id then the sequence number should be generated as xyz090398 ie it
> should have todays date,month and year . Can some one help me generating this
> kind of sequencenumber.If you are able to give sample code it will be nice of
> you Thanks in advance. Maadhavan
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Thu Sep 03 1998 - 12:47:39 CDT