Updating checkbox in realtime based on other table

Hi All,
using apex 2.2.1, database 10.2.0.3
I have a check box that I want to update based on the user selecting a radio box. e.g. Once the user has updated the radio box the checkbox is either switch on or off.
I understand this needs to be done via a javascript but the issue I'm facing is that I need to do a SQL statement to get the the correct value as it is on another table.
cheers
James

After doing more searching I'm pretty sure I need to call PL/SQL in a javascript. I'm new to all this and the only examples seem to complicated to understand.
I'm sure someone has done this before. I would be gratefull if some could post their PL/SQL and the javascript / AJAX into this note so I can reverse engineer it.
cheers
James

Similar Messages

  • Update view ( view is based on 3 tables)

    i have view based on 3 tables.
    create view view_master
    select '1' as no , name , no from a
    union all
    select '2' as no , name , no from b
    union
    select '3' as no , name , no from c
    actually i wanted to update view base table, Can i update a view view_master ?
    My question here is does oracle support view update ( view is based on 3 tables)
    Please advise ,,,

    Apart from Instead of trigger any other work around? The best way to answer that question is if you let us know:
    - your database version ( select * from v$version; )
    - give us a narrowed down example of the 'begin-situation' and the desired 'final situation'.\
    See:
    {message:id=9360002} for more details.
    MY ORACLE DBA hates tiggers .He's not the only one ;)

  • Want to update data in a view based on multiple tables

    Hi
    I am facing a problem i want to update data in tables using a view. As that view is based on multiple tables so i am unable to update data. i came to know we can update table from view only if view is based on single table. so if anyone knows any alternative please let me know.
    Thanx
    Devinder

    Devinder,
    The table can be updated through a view based on multiple tables, if and only if the table is a "key preserved" table. Rather than explaining myself, i avoided the burden of typing by finding the material in Oracle Docs and pasting it for you :-)
    If you want a join view to be updatable, all of the following conditions must be
    true:
    1. The DML statement must affect only one table underlying the join.
    2. For an INSERT statement, the view must not be created WITH CHECK
    OPTION, and all columns into which values are inserted must come from a
    key-preserved table. A key-preserved table in one for which every primary
    key or unique key value in the base table is also unique in the join view.
    3. For an UPDATE statement, all columns updated must be extracted from a
    key-preserved table. If the view was created WITH CHECK OPTION, join
    columns and columns taken from tables that are referenced more than once
    in the view must be shielded from UPDATE.
    4. For a DELETE statement, the join can have one and only one key-preserved
    table. That table can appear more than once in the join, unless the view was
    created WITH CHECK OPTION.
    HTH
    Naveen

  • How to update one table based on another table ??

    Hello Friends:
    I am trying to run the following query in oracle but it won't run.
    UPDATE BOYS
    SET
    BOYS.AGE = GIRLS.AGE
    FROM GIRLS
    WHERE
    BOYS.FIRSTNAME = GIRLS.FIRSTNAME AND
    BOYS.LASTNAME = GIRLS.LASTNAME;
    This query runs fine in sql server but in oracle its saying can't find "SET". PLease tell me what is the correct syntax in oracle to update one table based on another table.
    thanks

    See if this helps.
    If you wrote an SQL statement:
    update boys set age = 10;
    Every row in the boys table will get updated with an age of 10. But if you wrote:
    update boys set age = 10
    where firstname = 'Joe';
    Then only the rows where the firstname is Joe would be updated with an age of 10.
    Now replace the 10 in the above statements with (select g.age from girls g where g.firstname = b.firstname and g.lastname = b.lastname) and replace where firstname = 'Joe' in the second statement with where exists (select null from girls g where g.firstname = b.firstname and g.lastname = b.lastname). The same concepts apply whether 10 is an actual value or a query and whether you have a where clause with the update statement to limit rows being updated.
    About the select null question regarding the outer where clause:
    Since the query is checking to see if the row in the girls table exists in the boys table what the column is in this select statement doesn't matter, this column isn't being used anywhere. In this case Todd chose to use null. He could have also used a column name from the table or a lot of times you'll see the literal value 1 used here.

  • My requirement is to update 3 valuesets daily based on data coming to my staging table. What is the API used for this and how to map any API to our staging table? I am totally new to oracle and apps. Please help. Thanks!

    My requirement is to update 3 valuesets daily based on data coming to my staging table. What is the API used for this and how to map any API to our staging table? I am totally new to oracle and apps. Please help. Thanks!

    Hi,
    You could use FND_FLEX_LOADER_APIS.UP_VALUE_SET_VALUE to upload them from staging table (I suppose you mean value set values...).
    You can find a sample scripts if you google around.
    What do you mean "how to map any API to our staging table" ?
    You should do at least the following mapping (which column(s) in the staging table will provide these information):
    - the 3 value sets name which you're going to update/upload (I suppose these are existing value sets or which have been already created)
    - the value set values and  description
    Try to start with something and if there is any issues the community could then help... but for the time being with the description of the problem you have provided, that's the best I can do...

  • One block based on two table when update/insert result in FRM-40654

    Hi,
    I ahve a multi line block based on two tables.
    Customers - AFCUSTOMER
    Maintenance - AFMAINT
    Some customers exist when maintenance doesnt so in my where clause i have
    AFCUSTOMER.CUSTID=AFMAINT.MAINT_CUSTID(+) AND AFCUSTOMER.CUSTBRANCHID=1 AND AFCUSTOMER.CUSTSTATUSID=2
    I have primary key set as the AFMAINT table primary key and have set DML data targetr name as AFMAINT.
    I am displaying customer name (from AFCUSTOMER) and type of payment (from AFMAINT) on screen and i want to change the type of payment which then uses pre update trigger to fil in the primary key of AFMAINT.
    Querying works fine and displays all records. But when i try to insert a record into the AFMAINT table by changing the type of payment list item i get FRM-40654 Record updated by another user. I have checked and block status is QUERY right before the list item is changed.
    Any ideas on where i am going wrong.

    But when i try to insert a record into the AFMAINT table by changing the type of payment list item i get FRM-40654 Record updated by another userWhen you start editing a record which is already stores in the database forms "rereads" the record from the database and check id all values in the database are the same as in the form. If there is some difference, forms assumes that someone else changed the record after you did the query.
    The main causes for that are:
    -Some database-trigger which changes the value of a column which is included in the form
    -numeric column with a higher precision in forms, than in the database
    -a block based on a view or "select from clause" which does not return the same values as inserted/updated through forms.
    I guess you run into the third issue. Check all the values in the forms-items after your dml and compare them to the values saved to the database, there will be some difference. If you find it, correct the error, if one, or re-read the data in the POST-UPDATE-trigger.

  • How can I make a new genius mix? Apple has made two automatically, but I would like one based on other genres within my iTunes library. I have tried updating my genius mixes to no avail.

    How can I make a new genius mix? I do not want to make a genius playlist. Genius has already created two mixes but I would like another based on other genres within my extensive music library. I have tried updating Genius from Store>Update Genius but to no avail. Thank you!

    Hi. The two user tips both describe a sequence of steps that should get your library from the point where it threatens to wipe data from your device to where it is syncing normally, while recovering as much information as possible. It may still be necessary to wipe and reload the device but this should only take place once all the data that can be recovered has been recovered.
    Doing step 1 of 8 and then complaining things aren't the way you want them to be yet strikes me as premature...
    Since you appear to have all your media content, and we are discussing an iPod classic, not an iOS device, the main worries are already taken care of. What's left is ratings, playcounts, playlist membership and checked status. Since your device holds only part of your library at best you could only recover the missing data for the content that is on the device using third party tools.
    Recreating the previous checked/unchecked status of every track in your library from where you are now may not be that easy. Syncing with selected playlists has many advantages, one of which would have been that you would have a named playlist that could have been retrieved by 3rd party software if you had used this method.
    You haven't explained what caused your problem in the first place, but if you have a Previous iTunes Libraries folder holding old copies of your iTunes database (generated with each iTunes update) then it would be possible to restore the most recent of these and then update the library with any changes in your media folder.
    BTW Apple doesn't offer free support for this kind of issue with iTunes.
    tt2

  • Help on triggers needed-update other tables

    Hi,
    I am using 10g and is very new to triggers and I hope I can gain some advises here.
    I have the following 3 tables. MainInterfaceTable is a table where it stores records of values which are to be updated to tables: log1 and log2 respectively. One application will insert record into MainInterfaceTable and the inserted record contains only values for columns which are to be updated into tables: log1 and log2 respectively. Columns which contain null values are not to be updated into log1 and log2 tables.
    I can only think of using many "if" statements in my trigger to concatenate the UPDATE DML to update log1 and log2 tables. But if the MainInterfaceTable table contains many columns, it is not very efficient. {color:#800080}Is there any built in oracle functions or a more efficient to perform this task??{color}
    {color:#800080}Any advises are greaatly appreciated. Thanks{color}
    For E.g. In the below MainInterfaceTable record, I only update table log1 with txt1A column values. And update log2 table with col1 and col2B column values.
    Column Values
    txt1 null
    txt1A 6
    txt1B null
    col1 ‘new orders'
    col2A null
    col2B ‘new purchase'
    ------------------------------my trigger -------------------------------------
    CREATE TRIGGER TRG_MainInterfaceTable
    AFTER INSERT ON MainInterfaceTable
    FOR EACH ROW
    DECLARE
    sqlStmt VARCHAR2(2000); -- the SQL statement
    BEGIN
    sqlStmt := 'UPDATE log1 a SET 1=1 ';
    if :*new*.txt1 is not null then
    sqlStmt := sqlStmt || ' ,a.txt1 = ' || :*new*.txt1;
    END IF
    if :*new*.txt1A is not null then
    sqlStmt := sqlStmt || ' ,a.txt1A = ' || :*new*.txt1A;
    END IF
    if :*new*.txt1B is not null then
    sqlStmt := sqlStmt || ' ,a.txt1B = ' || :*new*.txt1B;
    END IF
    prc_run_update_sql_log1(sqlStmt);
    ------repeat more IF THEN for other tables
    EXCEPTION
    WHEN
    -- exception handling
    end TRG_MainInterfaceTable
    --------------------------------------Table Structure------------------------------------------------------------------
    create table MainInterfaceTable (
    statuscol char(1),
    txt1 varchar2(20),
    txt1A number(6),
    txt1B varchar2(20),
    col1 varchar2(20),
    col2A number(6),
    col2B varchar2(20),
    create table log1 (
    txt1 varchar2(20),
    txt1A number(6),
    txt1B varchar2(20),
    create table log2 (
    col1 varchar2(20),
    col2A number(6),
    col2B varchar2(20),

    Thanks. I put the IF ELSE.. into a function and my codes looks neater. However I encounter a error when i try to pass in a DATE value.
    ORA_06502 numeric or value error: host bind array too small
    The error occur at the line in bold .
    I try to run
    Select TO_CHAR(sysdate, 'DD-MON-YYYY HH24:MI') from dual
    in PL/SQL screen and it works.
    Why the same TO_CHAR() syntax doesn't work in a function????
    FUNCTION concatupdatequery(pVal IN DATE, pCol IN VARCHAR2, pSql IN VARCHAR2) RETURN VARCHAR2 IS
    lvQueryStr VARCHAR2(30000);
    lvTempDate VARCHAR2(100);
    BEGIN
    lvQueryStr := pSql;
    IF pVal IS NOT NULL THEN
    dbms_output.put_line('pVal = ' || pVal);
    lvTempDate := TO_CHAR(pVal, 'DD-MON-YYYY HH24:MI:SS');
    lvQueryStr:=pSql||','||pCol||'=TO_DATE('''||lvTempDate||''',''DD-MON-YYYY HH24:MI'')'; -- DATE data type
    dbms_output.put_line('lvTempDate = ' || lvTempDate);
    END IF;
    RETURN lvQueryStr;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('concatupdatequery (DATE) :pCol:'||pCol||' ,pVal:'||pVal||' ,pSql:'||pSql);
    dbms_output.put_line(SQLCODE||' - '||SQLERRM);
    RAISE;
    END concatupdatequery;

  • Updating a column from other table

    Hi all,
    I have a simple update query problem. I have four tables
    activist(activist_id,first_name,last_name,c_state),
    membership(activist_id,g_n_id),
    group_network(g_n_id,g_n_type_id),
    school_grop_det(g_n_id,state). For some records in activist table the c_state column is null, i want to update that column with state column of school_group_det table.
    Here is the query for the states which are null
    select distinct a.activist_id,a.first_name,a.last_name,
    a.c_state,sd.state from activist a,membership m,
    group_network g,school_group_det sd where
    a.activist_id=m.activist_id and g.g_n_id=m.g_n_id and
    g.g_n_id=sd.g_N_id and a.c_state is null and g.g_n_type_id='1001'
    order by a.activist_id
    I got the activist_id,first_name,last_name,c_state from activist and state from school_group_det. now i as i told you want to update the c_state with state column of school_group_Det table.
    Pleae any one help me
    Thanks
    Srinivas

    For ur query the reply whay u have got is correct one. For further quries similar to one u had u can download a tool named TOAD (Tools for Oracle Application Developer) from quest site (www.quest.com). Install it a proceed.
    Do let me know how and what u feek about TOAD.

  • Update joining two other tables.

    Hi,
    I have a question on update of one table using two other tables.
    There are three tables: a_visitors(vis_str, vis_flag), b_hub(vis_str ), c_uv_xref(vis_str, user_str).
    And a_visitors.vis_flag needs to be updated with '1', '2' or '3'.
    1 - if there is a record in b_hub table exists where a_visitors.vis_str = b_hub.vis_str
    and a_visitors.vis_str = c_c_uv_xref.vis_str and c_uv_xref.user_str like *'%type_1%'*
    2 - if exists where a_visitors.vis_str = b_hub.vis_str
    and a_visitors.vis_str = c_c_uv_xref.vis_str and c_uv_xref.user_str like *'%type_2%'*
    3- if exists where a_visitors.vis_str = b_hub.vis_str
    Thanks a lot for your help !!!
    And here's the code
    CREATE TABLE "A_VISITORS"
        "VIS_STR"  VARCHAR2(20 BYTE),
        "VIS_FLAG" VARCHAR2(20 BYTE)
    REM INSERTING into A_VISITORS
    Insert into A_VISITORS (VIS_STR,VIS_FLAG) values ('aaa',null);
    Insert into A_VISITORS (VIS_STR,VIS_FLAG) values ('bbb',null);
    Insert into A_VISITORS (VIS_STR,VIS_FLAG) values ('ccc',null);
    Insert into A_VISITORS (VIS_STR,VIS_FLAG) values ('ddd',null);
    Insert into A_VISITORS (VIS_STR,VIS_FLAG) values ('eee',null);
    CREATE TABLE "B_HUB"  ("VIS_STR" VARCHAR2(20 BYTE)   );
    REM INSERTING into B_HUB
    Insert into B_HUB (VIS_STR) values ('aaa');
    Insert into B_HUB (VIS_STR) values ('bbb');
    Insert into B_HUB (VIS_STR) values ('fff');
    Insert into B_HUB (VIS_STR) values ('ggg');
    Insert into B_HUB (VIS_STR) values ('hhh');
    CREATE TABLE "CARAW"."C_UV_XREF" (
        "VIS_STR"  VARCHAR2(20 BYTE),
        "USER_STR" VARCHAR2(20 BYTE)
    REM INSERTING into C_UV_XREF
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('aaa','type_1');
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('aaa','aaaaa');
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('bbb','type_2');
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('ccc','ttt');
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('ddd',null);
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('eee','kkk');
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('fff','lll');
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('ggg','aaaaa');
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('hhh','aaaaa');
    Insert into C_UV_XREF (VIS_STR,USER_STR) values ('aaa','type_2');Edited by: lsy_nn on Sep 20, 2010 12:06 PM
    Edited by: lsy_nn on Sep 20, 2010 12:07 PM

    Hi,
    Thanks for posting the sample data.
    Don't forget to post the results you want from that data (that is, the contents of a_visitors after the UPDATE.)
    Here's one way:
    MERGE INTO     a_visitors     a
    USING  (
            SELECT    NVL (b.vis_str, c.vis_str)     AS vis_str
            ,          COUNT (CASE WHEN c.user_str LIKE '%type_1%' THEN 1 END)     AS type_1_cnt
            ,          COUNT (CASE WHEN c.user_str LIKE '%type_2%' THEN 1 END)     AS type_2_cnt
            FROM                 b_hub     b
            FULL OUTER JOIN  c_uv_xref     c     ON     b.vis_str     = c.vis_str
            GROUP BY  NVL (b.vis_str, c.vis_str)
           )                          bc
    ON     (a.vis_str            = bc.vis_str)
    WHEN MATCHED THEN
    UPDATE  SET  a.vis_flag     = CASE
                        WHEN  bc.type_1_cnt > 0  THEN  '1'
                        WHEN  bc.type_2_cnt > 0  THEN  '2'
                                                    ELSE  '3'
                          END
    ;

  • Lock row in 1 table while update other tables

    Gurus,
    I want to read 1 table. If the date is less than today, I want to update 4 other tables. I only want to do this update once a day.
    While the 4 other tables are being updated, I want the other web users to pause for the update while this procedure runs.
    Is there a better way to do this?
    TIA
    Steve42
    Here is what I have:
    CREATE OR REPLACE PROCEDURE TEST_TODAY2 AS
    -- to create the table
    -- create table test_today(updated_date date);
    -- insert into test_today(updated_date) values (sysdate-1);
    -- select * from test_today;
        cursor daily_update_cur is
        select updated_date from test_today
          for update of updated_date;
       last_updated_date date;
    BEGIN
      NULL;
        open daily_update_cur;
        fetch daily_update_cur into last_updated_date;
        IF  trunc(last_updated_date) < trunc(sysdate) THEN
           -- update 4 other tables
           -- After those are updated,  update test_today
           dbms_output.put_line('After updating tables');
           update test_today set updated_date=sysdate;
        ELSE
           dbms_output.put_line('Tables already up to date');
           null;
        END IF;
        execute immediate 'commit';
        close daily_update_cur;
    END TEST_TODAY2;Edited by: BluShadow on 15-Oct-2012 14:22
    Please use {noformat}{noformat} tags before and after your code as described in the FAQ: {message:id=9360002}.
    I've corrected it this time for you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Steve,
    I just checked your requirements and program. It seems fine.
    You can modify something on this. As below part is not required as it ll never happen.. :)
        ELSE
           dbms_output.put_line('Tables already up to date');
           null;
        END IF;
    /* execute immediate 'commit';  -- No need to write in dynamic sql as its not a DDL statement */
    commit;Sorry for going out of topic.
    Since I'm a NEWBIE, I just wanted to make sure that this would work before
    we roll this out to LIVE PRODUCTION.Newbie is defined on the basis of the date you joined/registered. It never asked for your experience or a screening while signing up.
    Better you can have an other idea to filter out people by their replies/sense with quality/weight of statements as newbies or experts ! .. :)
    Thanks!

  • Check two columns and update other table

    HI ,
    I have a table called trackCenterline .Below is the table.
    What i want to do is If the segmentSequenceID is 1 it should pick the corresponding SegmentID i.e 10001 and Check for the same segment id in other table called TrackSegment which is below.  and pick the BeginMilepost of that segmentID and Update That
    Milepost in a new table .At end SegmentSequenceID number it should pick ENDMilepost and update
    TrackCenterline table.
    TrackSegment table
    In the below table for 10001 SegmentID it should pick BeginMilepost. For end Number of SegmentSequenceID in above table ID ends at 121 for that end sequenceID It should refer TrackSegment table below and pick EndMilepost and should be updated in another
    table Milepost column.
    after that a new segment starts with new sequence .and so on ...
    bhavana

    Hi Deepa_Deepu,
    According to your description, since the issue regards T-SQL. I will help you move the question in the T-SQL forums at
    http://social.technet.microsoft.com/Forums/en-US/home?forum=transactsql. It is appropriate and more experts will assist you.
    When you want to check two columns from two tables then return some results and update the third table. I recommend you use join function and combine two tables, then use update select from statement for modifying the Mailpost table. You can refer to the
    following T-SQL Statement.
    -----using join to connect to two tables
    select TrackCenterline.FeatureId,TrackCenterline.SegmentId,
    TrackCenterline.SegmentSequenceId,TrackSegment.BeginMilepost,TrackSegment.EndMilepost
    from dbo.TrackCenterline join dbo.TrackSegment
    on TrackCenterline.SegmentId=TrackSegment.SegmentId
    order by TrackCenterline.SegmentId, TrackCenterline.SegmentSequenceId
    ---the result shows as following.
    FeatureId SegmentId SegmentSequenceId BeginMilepost EndMilepost
    AMK100011 10001 1 61.0000 61.3740
    AMK100012 10001 2 61.0000 61.3740
    AMK100013 10001 3 61.0000 61.3740
    AMK1000121 10001 121 61.0000 61.3740
    AMK100021 10002 1 61.1260 61.7240
    AMK100023 10002 3 61.1260 61.7240
    AMK100033 10003 3 61.3740 62.9530
    -----Then you can use update select from statement to modify the Mailpost table, Or you can post the table structure of Mailpost
    And for more information, you can review the following article about update statement.
    http://www.techonthenet.com/sql/update.php
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Updating table with query of 2 other tables?

    Greetings
    I apologize in advance if this seems too easy to do- but I am missing something.
    I have 8000 records in an Access DB (I know- it's going into SQL soon) in which all  the departmental office IDs need to be updated.
    The column in the main table  is named "q_office_ID".
    The user table includes  user_ID &  office_ID.
    The office table also includes office_ID.
    This UPDATE sets all the values to the number 10?:
    <cfquery name="update" datasource="#Request.BaseDSN#">
    SELECT     queue_ID, q_user_ID, user_ID, office_ID
    FROM     main_helpdesk, lookup_user
    WHERE  q_user_ID = user_ID
    </cfquery>
    <cfloop query="update"><cfquery name="updatedata" datasource="#Request.BaseDSN#">
    UPDATE main_helpdesk
    SET q_office_ID = #office_ID#
    </cfquery></cfloop>
    I know there is something obviously wrong with the update- any help would be greatly appreciated.
    Thank You

    Actually, it was:
    <cfquery name="update" datasource="#Request.BaseDSN#">
    SELECT queue_ID, q_user_ID, user_ID, office_ID
    FROM main_helpdesk, lookup_user
    </cfquery>
    <cfloop query="update">
    <cfquery name="updatedata" datasource="#Request.BaseDSN#">
    UPDATE main_helpdesk
    SET q_office_ID = #office_ID#
    WHERE q_user_ID = #user_ID#
    </cfquery></cfloop>
    My mistake.

  • How to track the changes to a table and update the other table ?

    Hi Guys,
                   I am looking to track deletion of entries on KONV table and sync these missing entries in an other table which has primary key entries of KONV.
    How to do this.. is ALE change pointer is any good for this purpose ?
    Thanks
    AJ

    Hi Sam,
      In order to track the changes in the KONV table, go to table CDHDR and give objectclass and objectid, you will get all the details.
    Regards,
    ramesh.

  • Field != then Insert Into Other Table

    Hi,
    I cannot figure out how to create a trigger that will insert data based on if a old.field != new.field. If the field was changed in
    one table tbl_test then insert that record into the other table tbl_test_history. This is a little different since I want to insert a record if a update
    took place. The update will still take place in tbl_test but I want a insert to take place in tbl_test_history.
    CREATE OR REPLACE TRIGGER AU_INSERT_TEST_HISTORY
      AFTER UPDATE
      ON TBL_TEST   FOR EACH ROW
    WHEN (
        OLD.Orange != NEW.Orange
    OR OLD.Apple != NEW.Apple
    BEGIN
    INSERT INTO TBL_TEST_HISTORY
    (ORANGE,
      APPLE
      BANANA,
      GRAPE
      select ORANGE,
             APPLE
             BANANA,
             GRAPE
    FROM TBL_TEST, TBL_TEST_HISTORY
      WHERE  TBL_TEST.PK_TEST_ID = TBL_TEST_HISTORY.PK_TEST_ID;
    END AU_INSERT_TEST_HISTORY;
    /I will have a separate trigger that will insert records from tbl_test to tbl_test_history. This trigger compiles with no errors but when I
    create a record in tbl_test I receive an error. I am not sure if the syntax is correct, can anyone help me with this?

    My bad. I put the colon : into the when clause. They weren't there in your code. Usually I use an if condition, which is a little different.
    I added some NVL logic to to consider comparison of NULL values too.
    CREATE OR REPLACE TRIGGER AU_INSERT_TEST_HISTORY
      AFTER UPDATE  ON TBL_TEST  
      FOR EACH ROW
    BEGIN
      if nvl(:old.ORANGE,'xxx') != nvl(:new.ORANGE,'yyy')
         OR nvl(:old.APPLE,'xxx') != nvl(:new.APPLE,'yyy')
      then
        INSERT INTO TBL_TEST_HISTORY
         (ORANGE, APPLE, BANANA, GRAPE)
        values (:new.ORANGE,
                 :new.APPLE,
                 :new.BANANA,
                 :new.GRAPE);
      end if;
    END AU_INSERT_TEST_HISTORY;
    / You can additionally consider to make this trigger an AFTER INSERT OR UPDATE trigger.
    Then you would also put the inserted values from the start into your history table.
    Edited by: Sven W. on Aug 9, 2012 4:14 PM

Maybe you are looking for