How to compare the value of a link with a 'HOLD' string variable...?

Hi all

I have two tables - TABLE1 and TABLE2, and the tables are having the STATUS column. The requirement is as if the STATE of TABLE1 column is updated as 'HOLD', then the same value must be updated the column STATUS of TABLE2.


create or replace trigger "TEST_TRG".
FRONT
update of 'STATUS' on 'Table1 '.
for each line
Start
if(:New.) STATUS = 'HOLD') then
{
insert into TABLE2 (STATUS)
value (: new.) STATUS);

}
end if;
end;


COMPILE ERROR:
Compilation failure, line 3 (02: 40:14) line numbers associated with compilation errors are relative to the first BEGIN statement. This affects only the compilation of database triggers.
PLS-00103: encountered the symbol "{" when waiting for one of the following numbers: (begin case declare exit for goto rise back loop mod null pragma select update while < ID > < a between double quote delimited identifiers of > < a variable binding > < < continue the current closing delete fetch locking insert opening rollback to savepoint sql set run commit forall fusion pipe purge "{" symbol has been ignored.) Compilation failure, line 7 (02: 40:14) line numbers associated with compilation errors are relative to the first BEGIN statement. This affects only the compilation of database triggers.
PLS-00103: encountered the symbol "}" when expecting one of the following values: (begin case declare end elsif else goto exit rise back loop mod null pragma select update while < ID > < a between double quote delimited identifiers of > < a variable binding > < < continue the current closing delete fetch locking insert opening rollback to savepoint sql set run commit forall fusion pipe purge the symbol "} ' was ignored.)




I get the errors as above when the trigger is compiled. Can someone please help me fix it.


Thank you and best regards,
Suhas








CREATE OR REPLACE TRIGGER "TEST_TRG"
   BEFORE UPDATE OF "STATUS"
   ON "TABLE1"
   FOR EACH ROW
BEGIN
   IF (:NEW.status = 'HOLD')
   THEN
      INSERT INTO table2
                  (status
                  )
           VALUES (:NEW.status
                  );
   END IF;
END;

You should learn how to write PL/SQL code.

Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Apress.com/9781430235125
http://Apex.Oracle.com/pls/Apex/f?p=31517:1
http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
-------------------------------------------------------------------

Tags: Database

Similar Questions

  • How to compare the value of two combo

    I have two Combo Box (cbFirst & cbSecond). I want to compare the value that has been selected by the user and according to the result, the output is displayed. In the two combo box, I have provided the value.

    Here is my code:

    var a: number;
    var b:Number;

    function First(evt:Event):void {}
    a = evt.target.value;
    trace (a);
    }
    cbFirst.addEventListener (Event.CHANGE, first);

    function Second(evt:Event):void {}
    b = evt.target.value;
    trace (b);
    }
    cbSecond.addEventListener (Event.CHANGE, second);

    If (a > b) {}

    trace ("more")

    on the other

    trace (b is higher);

    Trace the statement inside the functions work very well and the value correct a & b is printed. But the comparison in the if statement does not seem to work. Could you please help me.

    There is a typing error.  Fix it or delete it:

    var a: number;
    var b:Number;

    function First(evt:Event):void {}
    a = evt.target.value;

    trace (a);
    compareF();
    }
    cbFirst.addEventListener (Event.CHANGE, first);

    function Second(evt:Event):void {}
    b = evt.target.value;
    trace (b);

    compareF()
    }
    cbSecond.addEventListener (Event.CHANGE, second);

    function compareF() {}

    If (a > b) {}

    trace ("more")

    on the other

    trace (b is higher);

    }

  • How to change the value of an element with another element?

    Hello guys,.

    I now have two or three elements in my form page, according to an order of the day, I want to change (from disable to activate or vice versa), the values of all the other elements in this form...

    I thnk for this javascript is needed... but I'm new Bee so if anyone can help me with these...

    How do I? is - that someone has good example or any link...

    Please help me with this question... enjoyed

    thxs


    Kind regards
    GK

    Hello GA,.

    Try this:
    OnChange = "$f_DisableOnValue (this, 'Y', 'P1_DETAILS_YN');"

    BTW: You are missing a hook closing in your function. You must use FireFox and with the FireBug extension and you would have noticed it...

    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this response in marking it as useful or Correct ;-)

  • How to set the value of a * APPLICATION * with apex.server.process?

    If I have a page named point P1_MY_PAGE_ITEM, I could put its value in the session by doing this:

    $s('P1_MY_PAGE_ITEM', 'I Like Pie!');
    
    apex.server.process(   'dummy'
                           , { pageItems: "#P1_MY_PAGE_ITEM" }
                           , { dataType: "text",
                             async: false,
                               complete: function( ajaxResponse )
                                     {
                                          var ignoredReturn = ajaxResponse.responseText;
                                     }
                             });

    Which works very well. If you check the session, the P1_MY_PAGE_ITEM will now have the value: I like pie!

    However, if I have an Application element (not a page element!) named MY_APP_ITEM, how could I do the same thing? How can I use apex.server.process to set the value of MY_APP_ITEM in the session? I wouldn't be able to use "pageItems" because MY_APP_ITEM is not a page element, it is a part of the application.

    What is the correct syntax to do this?

    Thank you

    -Joe

    Hey Joe,

    Returning to that thread you made a couple of months ago, the answer is here:

    Post adjustment Application items in the apex.server.process for a * process application *.

    Defining a point of application is as easy as providing the name of the application element to p_arg_names Bay and set a corresponding value in the p_arg_values table.

    For example, in an application with article SOME_ITEM of the application, I can put the value as follows:

    (function(){
    var arrNames = [], arrValues = [];
    arrNames.push("SOME_ITEM");
    arrValues.push('some value');
    apex.server.process(   'dummy'
                         , { p_arg_names: arrNames, p_arg_values: arrValues }
                         , { dataType: "text"
                           });
    })()
    

    Any required application process. Should the item be free that you set it from the browser.

  • compare the value of previous line with the current value

    I need to compare the previous value with the current value. All Oracle functions could there be to do?
    Something similar as a result.
    If previous (Amt {}) > Current (({Amt}) then 0 Else Null.)

    Something like that?

    SQL> WITH test_data AS
      2  (
      3          SELECT 107019 AS ID, 1583 AS AMT FROM DUAL UNION ALL
      4          SELECT 107019 AS ID, 1572 AS AMT FROM DUAL UNION ALL
      5          SELECT 107019 AS ID, 1572 AS AMT FROM DUAL
      6  )
      7  -- END SAMPLE DATA
      8  SELECT  ID
      9  ,       (CASE
     10                  WHEN LAG(AMT,1) OVER (PARTITION BY ID ORDER BY ID) = AMT THEN NULL
     11                  ELSE AMT
     12          END) AS AMT
     13  FROM test_data;
    
            ID        AMT
    ---------- ----------
        107019       1583
        107019       1572
        107019
    
  • How to compare the value of the line with header element element? in RTF


    Hello


    My question is not correct but see details below


    I have an XML file like this


    & lt; PO_HD & gt;


    & lt; PO_NUMBER & gt; 3456 & lt; / PO_NUMBER & gt;


    & lt; PO_LINES & gt;


    & lt; LINES_ROW & gt;


    & lt; PO_LINE_ID & gt; 1234 & lt; / PO_LINE_ID & gt;


    & lt; / LINES_ROW & gt;


    & lt; LINES_ROW & gt;


    & lt; PO_LINE_ID & gt; 6789 & lt; / PO_LINE_ID & gt;


    & lt; / LINES_ROW & gt;


    & lt; LINES_ROW & gt;


    & lt; PO_LINE_ID & gt; 5678 & lt; / PO_LINE_ID & gt;


    & lt; / LINES_ROW & gt;


    & lt; / PO_LINES & gt;


    & lt; PO_LINE_ATTCH & gt;


    & lt; TEXT & gt; This text is for ID 1234 & lt; / TEXT & gt;


    & lt; ID & gt; 1234 & lt; / ID & gt;


    & lt; TEXT & gt; This text is for ID 5678 & lt; / TEXT & gt;


    & lt; ID & gt; 5678 & lt; / ID & gt;


    & lt; / PO_LINE_ATTCH & gt;


    & lt; / PO_HD & gt;



    I created the RTF template like this



    & lt;? for each: PO_HD? & gt;


    & lt; name of xsl: variable = "var1" select = "(PO_HD/PO_LINE_ATTCH)" / & gt;


    & lt;? for each: LINES_ROW? & gt;


    & lt; name of xsl: variable = "first_rec" xdofo:ctx = 'incontext' select = 'position ()' / & gt;


    This is row in. ID: & lt;? PO_LINE_ID? & gt;


    & lt;? [$first_rec] TEXT / $var1? & gt;


    & lt;? end foreach? & gt;


    & lt;? end foreach? & gt;



    The output shows like this



    It comes in. line ID: 1234


    This text is for ID 1234



    {color: #ff0000} This is row in. ID: 6789 {color}


    {color: #ff0000} This text is for ID 5678 {color}



    This is row in. ID: 5678



    It is false (see the text id line and the line isn't even)



    What I want is



    It comes in. line ID: 1234


    This text is for ID 1234



    This is row in. ID: 6789



    This is row in. ID: 5678


    This text is for ID 5678



    Is this possible? Kindly help me



    Thank you


    Rahul

    "< name of xsl: variable ="var1"= sΘlectionner ' PO_HD/PO_LINE_ATTCH / *" / > "

    <? for-each: LINES_ROW? >

    This is line in. ID: <? PO_LINE_ID? >
    < name of xsl: variable = 'ID' xdofo:ctx = 'incontext' select = "PO_LINE_ID" / >

    <?-foreach: $var1? >
    < name of xsl: variable = "pos" xdofo:ctx = 'incontext' select = "position () - 1" / >
    <? If: () = $ID text? > <? \[$pos\ $var1]? > <? end if? >
    <? end foreach? >

    <? end foreach? >

  • How to compare the clone of a partition with partition source?

    I just cloned two partitions of a HARD resident to an auxiliary Momentus XL HARD drive in a case connected to the computer via eSATA.

    Is there a way to compare each partition cloned with its original for integrity? If it was just a file, I would use a unix/cygwin utility like diff or cmp.

    However, it is a partition.

    Sorry, but I don't understand the relationship between your question and the recovery of Toshiba.

    You know that copy of image recovery or cloning can be used for the installation of recovery?

  • How to read the value of list boxes by iteration in a loop For?

    I have a lot of list boxes on the front of my VI. I want to know how to read the value of this combo with a loop boxes For. The point is that I don't know how to get the reference of each combo box in a loop.

    Any information would be welcome. Thank you!

    su27 wrote:

    I have a lot of combo boxes on the front of my VI [...]

    Be sure to close the references that you have finished with them.

  • How to get the value with DBSequence in EL links

    Hello

    I have a DBSequence type id and check if the value is null or positive

    #{bindings. Id.inputValue! = null and links. Id.inputValue > 0? {"Edit": "Create"} does not work because the links. Id.inputValue returns a DBSequence and cannot convert Long

    How to get the value?

    JDev 11.1.1.6

    You can try this:

    #{bindings. Id.inputValue.sequenceNumber.value! = null and links. Id.inputValue.sequenceNumber.value > 0? {'Edit': 'Create'}

    Jean Lou

  • How to compare the new values with the old values in triggers.

    Dear all,

    Please tell me how to compare the new values with the old values in triggers.

    Hi, the employee example is in the document. You'd better read yourself.

    CREATE OR REPLACE TRIGGER Print_salary_changes
      BEFORE DELETE OR INSERT OR UPDATE ON Emp_tab
      FOR EACH ROW
    WHEN (new.Empno > 0)
    DECLARE
        sal_diff number;
    BEGIN
        sal_diff  := :new.sal  - :old.sal;
        dbms_output.put('Old salary: ' || :old.sal);
        dbms_output.put('  New salary: ' || :new.sal);
        dbms_output.put_line('  Difference ' || sal_diff);
    END;
    /
    
  • How can I compare the value of column within the COUNT() function?

    I want to compare the value of the column within the COUNT() function as below how ever it gives me the error. I want to calculate the percentage, how can I do this task?
    Thank you.


    SELECT department_id
    , COUNTY (salary < 250000) / COUNT (*)
    OF plch_employees
    GROUP BY department_id
    ORDER BY department_id;
    SELECT  department_id.
            COUNT(CASE WHEN salary < 250000 THEN 1 END) / COUNT(*)
      FROM  plch_employees
      GROUP BY department_id
      ORDER BY department_id
    /
    

    SY.

  • How to send the value of the prompt to an another dashboard with action link?

    Dear all,

    I find how to send the parameter to a different dashboard with the link of the action.

    URL = http://hostname/analytics/saw.dll?Dashboard & PortalPath = % 2Fusers % 2Fweblogic % 2FMartin % 20Test % 2FMartin & Page = page 1 & Action = Browse & P0 = 1 & P1 = eq & P2 = entity. "" Gen6, entity ' & P3 = % 22EntityCode % 22

    But I don't know how to send the value of the command prompt. I tried @{EntityCode}, Entity.Gen6, Entity, etc. None of them worked. They just be send as a string.

    Anyone know the solution? Thank you.

    Best regards
    Martin

    Try to do a manual URL to see if it works. Static variables are called as Valueof (variable) and presentation of variables such as @{variable}
    Discover th url below and add your variables as needed and of course override other settings.

    '' || Link | ''

  • How to compare, present value: block.text_item with the value of data

    Hello
    Could you please tell me
    How to compare the current value: block.text_item with the corresponding database column value.
    I use form 10g

    It has block and there is a text element in this block.
    When I run the form and query the block (in a table), the: block.text_item show me any value it in the database.
    Now I add value in the: block.text_item to the existing value.

    now
    the: block.text_item contains the old + new added value
    While
    the database table contains the value 'old '.

    Now, with a click of button, I want to know what value I added

    Please can you me, is it possible without writing a select query?

    Hello

    Now, with a click of button, I want to know what value I added

    So you're saying always user will bring added value to the existing value. Because it will fail in a case. Let's say that
    Database value is = ABCD
    The user opens the form and he took the D and write E and now value is ABCE and length is always the same 4. There is therefore no need to add.

    In any case, you can know that the value of database at run time, there is a property for the element called DATABASE_VALUE. She gives the value that is in the database while you run the form before save. and you can use it like that...

    Trigger = WHEN-MOUSE-DOUBLE-CLICK on item level
    DECLARE
      vItemValue DATATYPE; -- Set the data type according to your desired field.
      vValueAdded DATATYPE; -- Set the data type according to your desired field.
    BEGIN
      vItemValue:=GET_ITEM_PROPERTY('ITEM_NAME',DATABASE_VALUE);  -- It will return you the database value in vItemValue variable.
      IF LENGTH(vItemValue)>LENGTH(:FORM_ITEM_NAME) THEN  -- It mean something change or added
        vValueAdded:=SUBSTR(:FORM_ITEM_NAME,LENGTH(vItemValue)+1);
        MESSAGE('Added value is : '||vValueAdded);  -- It will show you the added value.
      END IF;
      -- now suppose you want to show the old and new value in message not the added one
      -- Then no need of IF condition. You can just use message like this
      -- And i would prefer to use like this way
      MESSAGE('Old Value : '||vItemValue||'  New Value - '||:FORM_ITEM_NAME);
      MESSAGE('Old Value : '||vItemValue||'  New Value - '||:FORM_ITEM_NAME);
    END;
    

    Hope that's clear.

    -Clément

  • How to pass the value?

    Hello.. I'm creating an application of streaming, in which I have a list field in a screen like this...

    1

    --------

    2

    --------

    3

    --------

    and when the item 1 is selected means a url must be passed to the video player...

    I created the list field screen in a package and a video player in other package... but I do not know how to pass the value of the field from the list to the player... Help, please... its URGENT...

    You can get the index selected by the listname.getSelectedIndex () method and compare that value with Vector data (data store URL) .that you will give a correct value from the URL and pass it.

  • How to find the value dated the same day in the last year

    I want to know how to find the value dated the same day in the last year.

    I use now, there is the function with the year and the result is

    Year Rev There are Rev
    20113000
    201240003000
    201320004000
    201450002000

    It works but it's not that I want. I'm trying to add the column date (Ex.20140101) in my report but it'snot work.

    I want to show:

    Date Rev There are Rev
    20110112200
    20120112100200
    20130112300100
    20140112500300

    If use (< degree >, < time_dim >. < date >, 365), it works but does not correct 100%

    Please help me...

    Thank you very much

    Check this link cool - bi.com

Maybe you are looking for

  • Qosmio F50-127 DVD write error

    I have Win 7 64 bit on my qosmio F50-127 and I there is a clerical error DVD on my HL-DT-ST DVDRAM GSA-T50N RR09 SATA (). I can't burn DVDs.Here is the screenshot http://imglink.ru/show-image.php?id=0262ed580cff5c6174e6db97e6340b89ideas pls

  • restore icons on pc

    I transferred my hard drive from one pc to the other and now my icons are all the same. How can you restore back to normal?

  • Dimensions of the OfficeJet 6100 with tray in use

    I'm wondering someone can tell me the 'other' dimensions of the OfficeJet 6100 printer.  They give the dimensions with the ferry closed paper but I would like to know the measures (particularly depth) when the printer is used. Also... the paper go in

  • I need free software to utiliserdans window 7 bluetooth

    I need free software to use in Windows 7 bluetooth. My mini hp laptop have not come with built-in Bluetooth, so help me know where to download it for use in Windows 7.

  • DVD won't play in the computer, will play in the dvd player

    Hello. I have burned several dvds of our showcase of dance for participants using first elements 14. Because of the length, I did an image ISO bootable first, then he burned from that. Some tell me that they cannot play on their computers (Lenovo lap