As far as I know of, there is no automatic way to do this. You will have to parse out the number, increment it, and then append it to "SG".
On Mon, Nov 26, 2012 at 11:28 AM, Rahil Maknojia <rahilmakno...@gmail.com>wrote: > Hello Experts, > > I found this group in google while I was searching for how to auto > increment strings with the numbers in it. > > I am switching database from access to oracle 11g. I have create all the > required tables, but I am stuck at one point. The previous person who > created access database had auto increment with SG0101, SG0102,........ In > oracle, I know we can auto increment primary keys but only with the numbers > not with characters. > > So I have customerid which is a primary key and it automatically > increments the number, but I have one more column with memberid where I am > inserting all the ids that start with SG0101 bla bla..... > > I already have 800 member ID's that start with SG, but that value doesnt > automatically increment, because I dont have any sequence or trigger to do > that. > > So how do I create a sequence and trigger that will automatically start > value with SG and keeps on auto incrementing? > > Here is the table info: > > CREATE TABLE "CUSTOMERS" > ( "CUSTID" NUMBER, > "MEMBERID" VARCHAR2(30), > "FNAME" VARCHAR2(30), > "MNAME" VARCHAR2(30), > "LNAME" VARCHAR2(30), > "CONTACTNAME" VARCHAR2(30), > "BNAME" VARCHAR2(255), > "FEDERALID" VARCHAR2(30), > "BADDRESS" VARCHAR2(255), > "BCITY" VARCHAR2(30), > "BSTATE" VARCHAR2(2), > "BZIPCODE" VARCHAR2(10), > "MAILADDRESS" VARCHAR2(100), > "MCITY" VARCHAR2(30), > "MSTATE" VARCHAR2(2), > "MZIPCODE" VARCHAR2(10), > "TELEPHONE" VARCHAR2(13), > "CELLPHONE" VARCHAR2(13), > "FAX" VARCHAR2(13), > "EMAIL" VARCHAR2(75), > "JOINDATE" TIMESTAMP (6) WITH LOCAL TIME ZONE, > "STATUS" VARCHAR2(8), > "ZONE" VARCHAR2(5), > CONSTRAINT "CUSTOMERS_PK" PRIMARY KEY ("CUSTID") ENABLE > > > Any help will be appreciate it. > > -- > You received this message because you are subscribed to the Google > Groups "Oracle PL/SQL" group. > To post to this group, send email to Oracle-PLSQL@googlegroups.com > To unsubscribe from this group, send email to > oracle-plsql-unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/Oracle-PLSQL?hl=en > -- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en