Shirish,

If the last 7 digits of this column has to be unique throughout the table,
why not, upon insert, move this value to another column in the table and
place a unique key on that column?  This will prevent the record from being
inserted.  

CREATE OR REPLACE TRIGGER TEST_TRIGGER
 BEFORE INSERT
 ON TEST_TABLE
 FOR EACH ROW

begin
  :new.number_column := to_number(substr(:new.full_column,-7,7));
end;
/

I have to ask the question - if a "part" of this data field is so important,
shouldn't it be in a separate column anyway?  It seems to me that the design
of this data column is incorrect.

I think I would break it up into several pieces like:

existing value XYZ_A_LO0000_0000001

col_prefix     =  XYZ
col_header     =  A
col_log        =  LO0000
col_nbr        =  0000001

Is this the primary key for the record?  You could still have the PK be the
above 4 columns.

hope this helps

Tom Mercadante
Oracle Certified Professional


-----Original Message-----
Sent: Tuesday, June 26, 2001 1:11 PM
To: Multiple recipients of list ORACLE-L


i am getting duplicate records if the whole (say XYZ_A_LO0000_0000001) value
is repeated without much probs..
but my prob is checking duplication of the last 7 digits..

Shirish Khapre, SE Rolta India Ltd.
Off Ph No. (+91) (022) 8326666,8262222,8300568
Ext'n 2730
Minds are like parachutes. They only function when they are open


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Shirish Khapre
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mercadante, Thomas F
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to