Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2013
    Posts
    3

    Thumbs up Unanswered: Trigger for update second table

    create table ravi_1(stage_id varchar2(10),bodysrno varchar2(12),indatetime date,outdatetime date);
    OUTPOUT:
    SQL> SELECT * FROM RAVI_1;

    STAGE_ID BODYSRNO INDATETIM OUTDATETI
    ---------- ------------ --------- ---------
    CW010 BD12345404 25-MAR-13 30-MAR-13
    BR010 BD12345404 25-MAR-13 30-MAR-13
    CS055 BD12345404 25-MAR-13 30-MAR-13
    CFL50 BD12345404 25-MAR-13 30-MAR-13
    ************************************************** *********
    create table ravi_2(bodysrno varchar2(10),CW010_IN DATE,CW010_OUT DATE,BR010_IN DATE,BR010_OUT DATE,CS055_IN DATE,CS055_OUT DATE,CFL50_IN DATE,CFL50_OUT DATE);
    OUTPUT:
    BODYSRNO CW010_IN CW010_OUT BR010_IN BR010_OUT CS055_IN CS055_OUT CFL50_IN CFL50_OUT
    ---------- --------- --------- --------- --------- --------- ---------
    BD12345404 25-MAR-13 30-MAR-13 25-MAR-13 30-MAR-13 25-MAR-13 30-MAR-13 25-MAR-13 30-MAR-13
    ************************************************** *******

    HOW THIS OUTPUT IS GENRATE.... USING ORACLE TRIGGER
    PLS HELP ME...

  2. #2
    Join Date
    Mar 2013
    Posts
    3

    Trigger

    CREATE OR REPLACE TRIGGER rdu
    AFTER INSERT OR UPDATE ON ravi_1
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW

    BEGIN
    INSERT INTO ravi_2 (bodysrno,CW010_IN)
    VALUES (:NEW.BODYSRNO,:NEW.INDATETIME);
    END;

    OUTPUT:
    BODYSRNO CW010_IN
    ---------- ---------
    BD12345404 25-MAR-13

    HOW UPDATE OTHER COLUMN OF RAVI_2 TABLE

    PLS HELP ME........
    Last edited by ravi_uphade; 03-28-13 at 04:21.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >HOW UPDATE OTHER COLUMN OF RAVI_2 TABLE
    UPDATE is different from INSERT. Which really needs to be done?
    which other column?
    from where does the value originate; in other words "update" with what value?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  4. #4
    Join Date
    Mar 2013
    Posts
    3

    tis type of output

    create table ravi_2(bodysrno varchar2(10),CW010_IN DATE,CW010_OUT DATE,BR010_IN DATE,BR010_OUT DATE,CS055_IN DATE,CS055_OUT DATE,CFL50_IN DATE,CFL50_OUT DATE);
    OUTPUT:
    BODYSRNO CW010_IN CW010_OUT BR010_IN BR010_OUT CS055_IN CS055_OUT CFL50_IN CFL50_OUT
    ---------- --------- --------- --------- --------- --------- ---------
    BD12345404 25-MAR-13 30-MAR-13 25-MAR-13 30-MAR-13 25-MAR-13 30-MAR-13 25-MAR-13 30-MAR-13
    ************************************************** *******

    HOW THIS OUTPUT IS GENRATE.... USING ORACLE TRIGGER
    PLS HELP ME...

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    why duplicating data & violating Third Normal Form?
    Why do you insist upon using a trigger?
    Why not just CREATE VIEW based upon content of RAV_1 table?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

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