Title: RE: Trigger

Hi....

if (col1,col2,col3) are forming primary key means, then how come you
insert value for any one of primary key columns, if so it would not give error for NOTNULL....

nIRMAL,

    -----Original Message-----
    From:   Mercadante, Thomas F [SMTP:[EMAIL PROTECTED]]
    Sent:   06 ����, 1422 04:15 PM
    To:     Multiple recipients of list ORACLE-L
    Subject:        RE: Trigger

    Hamid,

    Change your trigger as follows:

    Create or replace trigger cre_PK
    before insert
    declare
      loc_seq number;
    begin
       select seqname.nextval into loc_seq from dual;
       insert into tableA(col1) values(loc_seq)
    end
    /


    Hope this helps

    Tom Mercadante
    Oracle Certified Professional


    -----Original Message-----
    Sent: Thursday, December 20, 2001 12:55 PM
    To: Multiple recipients of list ORACLE-L


    List,

    I need some help for creating a trigger, here is my question?

    I have a table  TABLEA(col1,col2,col3) col1 is Primary Key for this table
    and an application insert records into this table, but I want to write a
    trigger on this table to generate primary key with using nexval of a
    sequence I have tried but doesn't work , if any of you have some sample or
    some links I really appreciate,
    This is my trigger:

    Create or replace trigger cre_PK
    before insert
    insert into tableA(col1) values(seqname.nextval)
    end

    Thanks in Advance





    Hamid Alavi
    Office 818 737-0526
    Cell    818 402-1987

    The information contained in this message and any attachments is intended
    only for the use of the individual or entity to which it is addressed, and
    may contain information that is PRIVILEGED, CONFIDENTIAL and exempt from
    disclosure under applicable law. If you have received this message in error,
    you are prohibited from copying, distributing, or using the information.
    Please contact the sender immediately by return e-mail and delete the
    original message from your system.
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Hamid Alavi
      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