Trigger - both equal to column values

Hi, I need your help once again ;)

I'm trying to create a trigger that the value of column = value in column B and columnB = column
So the values of columnA and columnB should always be equal

CREATE OR REPLACE TRIGGER tr_e_mvag_mva
AFTER
INSERT or UPDATE on buko_e_mvag
REFERRING AGAIN AS NINE OLD AND OLD
FOR EACH LINE
BEGIN
Update buko_e_mvag set: new.dummy_mvag = 1 where: new.mva = 1
Update buko_e_mvag set: new.dummy_mvag = 0 where: new.mva = 0
END;

This trigger is error, any help please?

Now, there's just a few more of code necessary for relaxation.

If :Old.Col1 != :new.Col1 Then
   :New.Col2:= :new.Col1;
ElsIf :Old.Col2 != :new.Col2 Then
   :New.Col1:= :new.Col2;
End If;

HTH
* 009 *.

Tags: Database

Similar Questions

  • Trigger that fires on the value of a column

    Hello everyone,
    I'm willing to do a trigger working on the column value.
    the requirement is that the column has the date and time I want to automatically update another table on the specified time. like for ex. leaves saying the value of this column is 26 October 2008 21:00 then date and time the trigger triggers, delete this value and update another table.
    so is it not to write something like this, or any other way to do this.
    Thank you
    Rahul

    like for ex. leaves saying the value of this column is 26 October 2008 21:00 then date and time the trigger triggers, delete this value and update another table.

    What you could try is:
    1 create the procedure that makes some logic you want
    2 create a trigger on the table (before integration), in which you can create a task (dbms_job/dbms_scheduler) who perform the previous procedure at the time defined by the value of the column.
    3. a validation will validate your changes of data and validate the creation of jobs, cancel rollback job creation.

    That way, your work (aka trigger) fires exactly at the scheduled time.

    Nicolas.

  • Merge two column in single column value

    Team,

    I have a requirement where in I need to merge 2 column values in a single column.

    e.g. I Percent_complete column in my table. and my table has only one record.

    I need to ask questions that I need to store the values of percent_complete and (100-percent_complete) in a single column.

    ex

    Percentage complete is set to 30.

    I need to select the 30 and 70 (100-30) both in a single column.

    Thank you

    If you mean like this?

    SQL > ed
    A written file afiedt.buf

    1 with t (select 30 as double percent_complete)
    2  --
    3 end of test data
    4  --
    5. Select decode(rownum,1,percent_complete,100-percent_complete) as percent_complete
    6 t
    7 * connect by rownum<=>
    SQL > /.

    PERCENT_COMPLETE
    ----------------
    30
    70

  • Uppercase column values

    Hi all

    Database: 11g

    Is it possible to store the value of a particular column to uppercase? If users commands insert with tiny problems, is possible to store default uppercase?

    I searched if there is any default column is available while creating the table itself, but could not find any useful results.

    It's impossible to predict if problems users insert statement with lowercase or uppercase column value.
    I didn't have any application to combat it.


    Kind regards

    SK

    Hello

    SK says:
    Is trigger only the way to control? In my case, there may be large number of insert statements must be executed. It is collected from different users. As I said I have no any application to fight against it. For each insert if the trigger is activated, process could get slow. It would be good if there is no alternative if anyone knows.

    Sorry, if users write their own statements INSERT (or UPDATE or MERGE), then a trigger is the only way to guarantee that the column still gets capitalized. You can do the trigger fire only when the relevant column is changed.

    If you have a CHECK constraint in the table (which is a good idea, even if you have a trigger), then the DML statements that try to put lowercase letters in this column will fail. This puts the burden on users to call TOP in their own code.

    You could store the data to uppercase-lowercase, but display using TOP in a view (or, from Oracle 11, add a virtual coumn to the table). If you want to search on the string in uppercase, you can use a function-based index. (Columns virtual oracle 11 can be indexed).
    Using TOP in a view will queiries slower, but it is not slower DML.

  • Trigger when only eno column change!

    Hello

    I have column A, B, C.
    I wonder if create a trigger that is fired when ONLY column b is changed?
    In this release I want to insert this old record of column B in another table.
    What would be the best solution for my problem?


    Kind regards
    Igor

    IgorKSCon wrote:
    When the ONLY column b is changed?

    If you want to call the trigger code only when the value of the column is changed then... you can also do like

    CREATE OR REPLACE TRIGGER trg_name AFTER
       UPDATE OF col1 ON testing FOR EACH row
       WHEN (new.col1 != old.col1) --check this line
    BEGIN
        -- your trigger body here
        NULL;
    END;
    
  • convert the column values to a single line...

    I have to return the column values to a single line separated by commas.
    If the nulls in the column just ignore without a comma.
    Here is one for example. There are three values and two NULL values in the table
    SQL> select ID from temp_fa;
    ID
    -----
    
             1
             2
    
             3
    
             5
    
    6 rows selected.
    
    
    I am expecting an output as 1,2,3,5
    Help, please

    There is always more than one title in the Oracle world ;)
    You can use the TRIM, for example (same configuration as your example):

    hoek&XE>  create table t as select level col  from dual connect by level <= 6;
    
    Tabel is aangemaakt.
    
    hoek&XE> update t set col = null where col in (1,3,5);
    
    3 rijen zijn bijgewerkt.
    
    hoek&XE> select * from t;
    
           COL
    ----------
    
             2
    
             4
    
             6
    
    6 rijen zijn geselecteerd.
    
    hoek&XE> select ltrim(sys_connect_by_path(col, ','), ',') output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6,,,
    
    1 rij is geselecteerd.
    
    hoek&XE> select trim ( both ',' from sys_connect_by_path(col, ',')) output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6
    
    1 rij is geselecteerd.
    
  • By the way a column value to Javascript

    Hi all

    I have an interactive relationship with the following SQL:

    Select

    EmpNo,

    Ename,

    "< a href =" # "onclick = 'test ("show it");' > ' |" jobs jobs | "< /a > ' job

    de)

    Select 10 empno, ename 'John', 'Manager' of the double job

    Union

    Select the 20 empno, ename 'Bookmark', 'Clerk' double work

    )

    Here is the definition of the test() function:

    < script type = "text/javascript" >

    function test (x) {}

    Window.Alert (x);

    }

    < /script >

    The report works very well. I can click on the column values of work e.g. Manager, the value hardcoded clerk alerts and function 'show it '. I want to show the value of employment, so if I click Manager, the alert must be 'Manager' and if I click on clerk then the alert should be "clerk." I tried to call the function like test(#job#) but no use.

    Help, please.

    Thank you

    ZKay wrote:

    I have an interactive relationship with the following SQL:

    Select

    EmpNo,

    Ename,

    '' | job |'' as job

    de)

    Select 10 empno, ename 'John', 'Manager' of the double job

    Union

    Select the 20 empno, ename 'Bookmark', 'Clerk' double work

    )

    Here is the definition of the test() function:

    The report works very well. I can click on the column values of work e.g. Manager, the value hardcoded clerk alerts and function 'show it '. I want to show the value of employment, so if I click Manager, the alert must be 'Manager' and if I click on clerk then the alert should be "clerk." I tried to call the function like test(#job#) but no use.

    It does not seem very useful, but all that is needed is to concatenate the value of employment in the event hours code:

    select
      empno,
      ename,
      '' || job || '' as job
    from(
    select 10 empno, 'John' ename, 'Manager' job from dual
    union
    select 20 empno, 'Mark' ename, 'Clerk' job from dual
    )
    
  • By using the link in the column to pass column values

    Hello

    I have a link to the column in my report which opens a modal page, now I want to use the value of the column clicked in the page that opens.

    I don't want to put any article on the opening page of the column value of click rather I want to use the value of the column of the click in my sql query.

    for example:

    1 P1 has the report < column link by clicking on it opens P2 >

    2. on page 2, I want to use the value of the clicked column.

    So far, I did

    1 link to page 2

    2. ask - #column_value_clicked #.

    3. in the sql query, I use the same above in the where clause.

    Any help...

    Thank you

    Rakesh

    fac586 wrote:

    Sunil Bhatia wrote:

    Hi Rakesh,

    Make use of x 01 parameter included in apex 5.0

    You can create a URL to page 1 as:

    f? p = 103:1:3241341234123: & x 01: #column_value_clicked #.

    Make use on request P2 in the form:

    Select * from test_table where id = APEX_APPLICATION. G_X01;

    You have not tested who, did you?

    I tested it buddy.

    Link https://apex.oracle.com/pls/apex/f?p=56971

    Click any bar chart and then wait that he freshen up.

    Click on report of ENAME and see that he went through the parameter.

    Report URL: f? p = 56971:2: & APP_SESSION. : No.: & x 01 = #ENAME #.

    -Sunil Bhatia

  • Put text Logo with SORT column values?

    Hello

    I have a page open IRR w / filters IRR past as follows.

    .. /f?p=200:21:0::no:CIR:IREQ_RELEASE,IREQ_PLATFORM:11.2.0.4,Linux:Yes

    I want to give the page a title with the SORT column values passed as follows.

    "LINUX 11.2.0.4 Report" on the text Logo.

    Is it possible that I can do this? Or if not possible, a way to put it on the field of text or something?

    Hello

    To set the value of your property, you will need to pass something in it:

    https://Apex.Oracle.com/pls/Apex/f?p=9086:2:113599573679605:P2_TITLE:Linux % 20Server % 20Report

    So when I had a session in your application and a value passed to the item value has changed

    I'm not fully grasp what you are trying to reach.  Are you try to click on the pencil edit go to one another form of change in the title of your page will be set to the column name in the report on your previous page?

    You try to dynamically update an element on the page you are on when a filter is added?

    If you can give me more tips, I'm happy to help, if your app is just a demo app on apex.oracle.com and you are happy for me to connect and make changes that might help, I'm happy to do.

    Thank you

    Paul

  • Transpose the unique column values online

    Hi all

    How to transpose the values of one column in a row,

    COL

    1

    2

    3

    4

    5

    6

    7

    8

    and I want to convert this column into the line as follows:

    Line (each in a separate column value). Number of values is not constant.

    1,2,3,4,5,6,7,8

    Solution without converting them to XML:

    WITH row_values

    AS (SELECT DISTINCT property_name,

    column_order

    OF v_rd_property_definition

    WHERE lp_id = 5171

    ORDER BY column_order)

    SELECT Regexp_substr(Wm_concat(property_name), "[^,] +' 1, 1") AS col1,.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 2"). AS col2.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 3") AS col3.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 4") AS col4,.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 5") AS col5,.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 6") AS col6,.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 7") AS col7

    OF row_values;

  • two column values in a single column

    Hi guys,.

    I have a requirement that i want to be viewing the two column values in a single as column... values year & product will be exposed in a unique column values

    Kind regards

    Sree

    Karthickumar Pillaiyarsamy yours is a database, in OBIEE is similar with some limitations...

    Sree! you have 2 ways to do this: by using the CONCAT function or the | operator, examples here are 2 concatenating year, a space and production:

    "Time". "" T05 annually name | ' ' || ' 'Products ' '. Product P1.

    CONCAT ("Time". "T05 per year of name', CONCAT (" ","Products".)" P1 product"))

    CONCAT in OBIEE accept only 2 params, so you if want to add a space between the 2 items, you must nest your function call.

    In case your year column is a number, you can convert it to a string using CAST ("your column" as VARCHAR (10)).

  • How to replace column values

    Hello

    I have the table as below, I need to replace the name column value b with X.how to get it.

    Table

    IDname
    1one
    2b
    3c
    4d
    5e

    Output

    IDname
    1one
    2X
    3c
    4d
    5e

    Hello

    Maybe a little decode?

    select id, decode( name, 'b', 'X', name) from ...
    

    concerning

    Kay

  • A column value a comma, which leads to a column different while export to CSV file

    Hi all

    I have a few columns that will be built in the CSV file. The problem is in one of the column value of a comma in there. Thus, it creates a separate column two in CSv file.

    For example:

    Name of the column: description.

    Value: Bumpers, cushion

    But then that export in CSV file, it gives me bumper as a column and seat cushion in the second column.

    I'm using Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Appreciate your help.

    Thank you

    Suresh

    Hello

    REPLACE (str

    , '"'

    , '"'

    )

    Returns a copy of the string str, but with all the ' "" ' changed substrigs in ' ' ' "

    This assumes that your front-end is not treat & like variable substitution marker.  If it is so, and -is your SQL * more escape character, then you can say

    REPLACE (str

    , '\"'

    , '"'

    )

  • Compare the column values for multiple lines

    I am new to oracle and I have a requirement to compare the values of column across multiple lines.  If all column values are the same, I want to display that value, if the columns are not the same, I need to display 'no match' as value.   I need id to group values and display a status value based on the above logic.   Can anyone offer assistance with dispalying the result expected below?

    Sample

    Table

    State ID

    1         S

    2         L

    1         S

    2          S

    expected results

    State ID

    1         S

    2 no match


    Hello

    That's what you asked for:

    SELECT id

    CASE

    WHEN COUNT (DISTINCT status) > 1

    THEN "no match."

    For ANOTHER MIN (status)

    The END as status

    T

    GROUP BY id

    ;

    Want that if each State ID is NULL?  The CASE expression above returns NULL in this situation.

  • How to display the database column value in a component of choice selected?

    Hello everyone;

    I use Jdeveloper 11.1.1.4 and right now I have the .jspx UI page that includes < af:selectonechoice / > components and according to the requirment I have to fill one of the column in the table in this drop-down list.

    can someone tell me how to fill the database column value in this drop-down list. I know I need to create the VO for the same thing, but I'm new to this technology. Then please suggest.

    Thanks in advance.,

    This will help u

    https://blogs.Oracle.com/prajkumar/entry/create_lov_in_adf_application

    How to create LOV in ADF 11 g | Techartifact

    Oracle Fusion Middleware Technologies: 11G: how to create a list of Values (LOV)?

    http://www.baigzeeshan.com/2010/03/creating-lov-in-ADF-application.html

    http://husaindalal.blogspot.de/2010/05/How-to-default-lov-with-its-first-value.html

Maybe you are looking for

  • Bootcamp not to proceed with the installer after partitioning

    I just bought a new retina 15 inch macbook pro mid 2015. I downloaded the iso of windows normal 10 of microsoft, and I use the bootcamp assistant. the thing works completely and partitioning the disk and once its finished my computer restarts and mac

  • Problem on Satellite A100-847 - printer and scanner USB do not work

    Hello Both of my printer and my scanner genius works fine on my PC but when I the connected to the satellite A100-847, it seems that there is not! Even the mistakes no. USB and two of them are on, plug unplug turn change anything. Known that I have i

  • Headphone Jack does not not on Sony Vaio

    All of a sudden, I have no sound from the headphones Jack. Portable speakers work fine, but when I plug in the headphones, there is no sound. Please someone help me: o)

  • How to find the 2012 LabVIEW DSC module?

    Hello We use different versions of LabVIEW, version 8.6 to LV2013. Its always a pain in the back to locate the different toolkits / modules for most not uptodate LV version. For now, I'm looking for DSC 2012, but I can't find, all links point to 2013

  • IGet error net dot keypass executing folowing:

    Have windows Xp sp3, Iget the error net the next point when you run the keypass utility: EventType clr20r3, P1, P2 2.1.7.16602, P3, P4 4e9e86a4 keepass.exeSystem.Configuration, P5 2.0.0.0, P6, P7 1 to 6 4889de74, 136 P8, P9ioibmurhynrxkw0zxkyrvfn0boy