Trying to create a trigger that adds a value to a field based on another field

Hello

Im trying to set a trigger that will add a field to a table if another field = the same thing and one where the condition is met, but can't seem to get anything to do and can't find anything online suggesting the syntax.

the use of im tables are

Applications_History

Students

I need the trigger to identify if the 'status' field = applicant accepted when a new data column is added, if that is the case I need to identify the scope of student_number of applications_history and match it to the student_number on students field, I then need to add a 'Y' in the field 'put' corresponding to this student in the student table. I'm looking for without stopping for some type of syntax format online but could not find anything, is it still possible?

Thank you

Something like that?

create or replace trigger aiur_applications_history

after insert or update on applications_history

for each line

Start

If nvl (: old.application_status, 'x'). = 'candidate admitted '.

and: new.application_status = 'candidate admitted '.

then

students update

the value = 'y '.

where student_number =: new.student_number;

end if;

end;

/

Kind regards

Zlatko

Tags: Database

Similar Questions

  • Trying to create a script that lists all clusters in a data center

    Hello

    I am trying to create a script that exports a vCenter configuration essentially and imports it in a new vCenter. I want the script to run without specifying a center of data manually. All the scripts I've seen you need to manually enter the data center.

    So, how to do a list of all the data centers with clusters in each of them? I also want to create a variable that contains the groups for the respective data centers. Here's a basic idea of what I want to do:

    $Datacenters = get-data center

    foreach ($Datacenter to $Datacenters)

    {

    $cluster = get-Cluster-location $Datacenter

    Write-Host "list of clusters in $Datacenters.

    Write-Host "$Cluster".

    }

    Who will give me the output like this:

    List cluster Datacenter1

    cluster2 CLUSTER1

    List cluster Datacenter2

    cluster3 cluster4

    But I don't know how I can get so I have variable like this:

    $datacenter1 = cluster1, cluster2

    $datacenter2 = cluster3, cluster4

    Did you mean something like this?

    Get-data center | %{

    New-Variable - Name $_. Name - value ([string]: join ("," (Get-Cluster-location $_ | % {$_.}))) Name})))

    }

  • I am trying to create a button that opens a pop-up window with a video player, sensible size. Also, I would like for the page Web of the background go darker when that happens. Is there a way top make in Muse?

    I am trying to create a button that opens a pop-up window with a video player, sensible size. Also, I would like for the page Web of the background go darker when that happens. Is there a way top make in Muse?

    Hello

    I created a video for you in Muse. Here is the link:- lightboxvideo.mp4 - Google Drive

    I hope that it would give you an idea on how to do just.

    Kind regards

    Rohit Nair

  • I am trying to create a function that would be on the table type returns.

    Gurus,

    I am trying to create a function that returns a table nested with 3
    columns in a table as a guy.

    my query is like

    Select col1, col2, col3 from table_1;

    I am a bit newbie in Oracle and have never used collections.
    Can you please guide?

    >
    I am a bit newbie in Oracle and have never used collections.
    >
    Then you should start with the documentation
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/TOC.htm

    Chapter 5 is all about collections using PL/SQL and examples
    >
    I am trying to create a function that returns a table nested with 3
    columns in a table as a guy.
    >
    This isn't enough of a description to know what you're trying to do, or how you plan to use the service. The query you provided is completely irrelevant to the question you are asking.

    You ask about functions in pipeline? Here is an example of this

    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
      )
      /
    
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
      /
    
    -- pipelined function 
    
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
      /
    
    select * from table(get_emp(20))
    
  • Need to create a trigger that generates multiple rows in another table

    {size: 12} Hello

    I use Oracle9i (9.2.0.4.0)

    My problem is:
    I need to create a trigger that create different in the other table lines when someone will introduce a new line in the first table.

    For this, I use the table 4:

    1. first one where you want the trigger.
    2. a second just to take information.
    3. a third to make a trip meter.
    4. the fourth is the table where I want to create new lines. {size}

    Here is a summary of these 4 tables:

    {color: blue} Table 1
    STOJOU
    Number ¿Nulo? Tipo
    STOFCY_0 NOT NULL VARCHAR2 (9)
    ITMREF_0 NOT NULL VARCHAR2 (60)
    LOT_0 NOT NULL VARCHAR2 (45)
    VCRTYP_0 NOT NULL NUMBER (3)
    VCRNUM_0 NOT NULL VARCHAR2 (45)
    VCRLIN_0 NOT NULL NUMBER (10)
    QTYSTU_0 NOT NULL NUMBER
    NUMVCR_0 NOT NULL VARCHAR2 (45) {color}

    {color: blue} Table 2
    ITMMASTER
    Number ¿Nulo? Tipo
    ITMREF_0 NOT NULL VARCHAR2 (60)
    ZCOEFI_0 NOT NULL NUMBER {color}

    {color: blue} Table 3
    ZCTUART;
    Number ¿Nulo? Tipo
    CTUART_0 NOT NULL NUMBER (10)
    CTUDATE_0 NON NULL DATE {color}

    {color: blue} Table 4
    ZUART
    Number ¿Nulo? Tipo
    ZUARTDM_0 NOT NULL VARCHAR2 (102)
    STOFCY_0 NOT NULL VARCHAR2 (9)
    STOCOU_0 NOT NULL NUMBER
    ITMREF_0 NOT NULL VARCHAR2 (60)
    LOT_0 NOT NULL VARCHAR2 (45)
    CREDAT_0 NOT NULL DATE
    QTYSTU_0 NOT NULL NUMBER
    STA_0 NOT NULL VARCHAR2 (3)
    VCRLIN_0 NOT NULL NUMBER (10)
    VCRNUM_0 NOT NULL VARCHAR2 (45)
    VCRTYP_0 NOT NULL NUMBER (3) {color}

    I do this trigger:
    CREATE OR REPLACE TRIGGER CREA_REGISTROS_TRAZA
    AFTER INSERT ON STOJOU
    FOR EACH ROW
    DECLARE
       n INTEGER;
       ct NUMBER;
       fecha_actual VARCHAR2;
       fecha_old VARCHAR2;
       codigo_dm VARCHAR2;
    BEGIN
       fecha_actual := TO_CHAR(SYSDATE, 'DD/MM/YYYY');
       -- SELECT TO_CHAR(sysdate, 'DD/MM/YYYY') INTO fecha_actual FROM DUAL;
       SELECT TRUNC((STOJOU.QTYSTU_0/ITMMASTER.ZCOEFI_0),0) INTO n FROM STOJOU INNER JOIN ITMMASTER ON STOJOU.ITMREF = ITMMASTER.ITMREF;
          FOR i IN 1 .. n
       LOOP
          SELECT CTUART_0,TO_CHAR(CTUDAT_0, 'DD/MM/YYYY') INTO ct,fecha_old FROM ZCTUART;
          IF fecha_old <> fecha_actual THEN
            ct := 0;
          END IF;
          ct := ct + 1;
          INSERT INTO ZCTUART
            (CTUART_0,CTUDAT_0)
          VALUES
            (ct,SYSDATE);
          codigo_dm := SUBSTR('000000000000000000000',1,20 - LENGHT(NEW.ITMREF_0)) || NEW.ITMREF_0 || SUBSTR('0000000000',1,10 - LENGHT(NEW.LOT)) || NEW.LOT || SUBSTR('0000',1,4 - LENGHT(ct)) || ct;
          INSERT INTO ZUART
            (ZUARTDM_0,ITMREF_0,CREDAT_0,STA_0,QTYSTU_0,LOT_0,STOFCY_0,VCRLIN_0,VCRNUM_0,VCRTYP_0)
          VALUES
            (codigo_dm,NEW.ITMREF_0,SYSDATE,0,NEW.QTYSTU_0,NEW.LOT_0,NEW.STOFCY_0,NEW.VCRLIN_0,NEW.VCRNUM_0,NEW.VCRTYP_0);
       END LOOP;
    END CREA_REGISTROS_TRAZA;
    /
    {size: 12} And the error message I get States is just:
    "The trigger was created with compilation errors."
    Thanks for the help {size}

    You must prefix your NEW "columns" with a colon, as in: NEW.

  • I've created a form that uses the value field text to fill the text of another field.  Does not take into account changes

    I've created a form that uses the value field text to fill the text of another field.  However, if I need to change the text, the second field does not update this change.  Instead of reset the form each time, is the Javascript code to update the fields if they have been modified?

    For example I Text1 and Text2.

    When I type in Hello in Text1 I see Hello in Text2.

    Later, if I decide to change to Goodbye Text1, Text2 remains Hello.

    The shape of the hoe can recognize this change?

    Thank you

    Edit: I think I have misunderstood the situation.

    If you want to both fields have the same value, just to give them the same name.

  • trying to create a clip that bounces off all four sides of the stage

    using the syntax below I have created a video called "BALL" bouncing to the left 'x' and moves to the right of the scene 'x.520' and bounces in the beginning 'x '.

    HOW CAN I CREATE A CLIP THAT BOUNCES OF THE FOUR SIDES OF THE STAGE AND STOPS ON THE BOUNCE FOURTH?

    var ballTween:Tween = new Tween (ball, "x", Bounce.easeInOut, ball.x, 520, 5, true);

    ballTween.addEventListener (TweenEvent.MOTION_FINISH, tweenFinishedF);

    function tweenFinishedF(e:TweenEvent):void {}

    new Tween(ball,"x",Bounce.easeOut,ball.x,0,5,true);

    }

    Thank you very much!!!

  • Create a trigger that send mail with attachment after insertion of a line in Oracle APEX

    I want to create an insert after trigger on a table that is to send a mail with an attachment. Here is my code.

    CREATE OR REPLACE TRIGGER tr_feedback

    AFTER INSERT on REVIEWS

    FOR EACH LINE

    DECLARE

    l_id NUMBER;

    BEGIN

    l_id: = APEX_MAIL. SEND)

                    p_to        => ' [email protected] ',

    P_FROM = >: NEW. E-mail

    p_subj = >: NEW. Object

    p_body = > "Please see the attachment."

    p_body_html = > ' review of < b > please < /b > the attachment ")

    APEX_MAIL. ADD_ATTACHMENT (p_mail_id = > l_id,)

    p_attachment = >: NEW. FILE,

    p_filename = >: NEW. FILE NAME,

    p_mime_type = >: NEW. MIME);

    END;

    But when I insert data, I get the following error:

    ORA-20022: Null value provided for the parameter p_filename.

    ORA-06512: at "APEX_040200.WWV_FLOW_MAIL", line 1070

    ORA-06512: at "APEX_040200.WWV_FLOW_MAIL_API", line 141

    ORA-06512: at "TR_FEEDBACK", line 11

    ORA-04088: error during execution of trigger 'TR_FEEDBACK '.

    Now, how can I fix that? Thanks in advance.

    Agree with the above.  Triggers (ab) should not be used in this way.  Nontransactional process should not be based on a transactional trigger.  These processes are part of the business logic and should be at the level of the company of codification (Summit, you can add a process to be executed once the completed insertion)

  • Trying to create a form that the user can save on their own computers

    Hello!

    I ' v has created a form with Acrobat X with some textfields and tries to send it to others who have Reader installed (X), but they cannot save the data locally, they entered. Why? What I am doing wrong?

    In the end, I also want to add data to the form with a request (form WINDOWS.NET) and that doesn't seem to be a problem, but the most important thing is that users must be able to fill some fields manually, save it to their own machine and send back to me later.

    Please tell me how to solve this problem!

    You must enable the rights of the player. I do not remember where he moved in he AA X.

  • How to create a form that adds information to a list on the site of the muse?

    Hello

    I need to create a form for my site of muse. When the form is submitted the information needs to go to a table or database or the list on this site of muse.

    For example, a customer would go on my site and do not want to publish information on what they are looking for. They fill in their details and what they are after and click on submit. Such information would then appear in a list or a table containing information of other customers who submitted information.

    Is this possible? Is it possible to do in Affairs Cataylst? Any assistance or other means would be appreciated.

    CN

    Hello

    Yes it is possible with BC. You can either use the form of Muse or create a form in British Colombia, and then insert the form html code in the Page of Muse.

    Once the user submits the form, a notification would be triggered for you that would show the summary form as what the user has filled in the details.

    In CRM, submitting a form creates an action in respect of the user entity. You can access the case and see related information. In BC CRM, you can directly access all cases and use the filter options to filter with date etc. Alternatively, you can generate a report on the use of the form or the case where he would list details of the user and the field values that the user has submitted.

    Please note, published Muse site are web hosting sites, which does not include the feature of CRM/CMS in order to get the CRM, you must upgrade the site which is the plan of site different from those you get with your subscription to the CC.

    http://www.BusinessCatalyst.com/features/CRM-database

    http://helpx.Adobe.com/business-catalyst/SBO/customer-database.html

    http://helpx.Adobe.com/business-catalyst/SBO/building-customer-report.html

    In addition, I suggest try all features with a place to test first and then, after finalization, you can upgrade to a paid plan.

    Thank you

    Sanjit

  • I am trying to create a page that resembles an Excel worksheet

    Is there an option in the Apex to create a page for entering data in a table that places the fields in a table, a bit like Excel format?

    In a table? The problem, you will need to insert a number of blank lines before time for the effect to type just data in lines. Perhaps based on a collection and insert a # all empty inside when lines filled?

    Thank you

    Tony Miller
    Webster, TX

  • In Bayside part 6 I am trying to create a trigger for the navigation menu link

    I followed the instructions in the tutorial to insert the new h2 named Menu, added to the #menulink element, and in mode code, the code is as in the example of the tutorial.  I don't see #menulink in the list of selectors.  I don't get #menulink by the h2 in the NIV.  Was an int missing the step of the tutorial, or who should I have hurt.

    The code view is less than

    ELSA

    Being very new DW cc, I didn't create the selector.  A confused.  Now go ahead although probably will have questions in the menu style next week.  Thank you.  ELSA

  • Creating a variable that contains the value of the variable system (Long) Date of change

    Can someone tell me how to write a script to create a variable named DocDate, which contains the value of the variable of system (Long) Date of change? Or write a script that creates a variable named DocDate, which contains the current date? I can't find a lot of documentation on scripting ExtendScript.

    Hi Julee, when you create a user variable in the interface, you cannot include the building blocks of time in the definition. They can only be used in system like the System Date of Modification (Long) variable variables. So the question is, why not just use the variable Date of change (Long) system in your document? What is the purpose of the variable user DocDate? Let me know what you think here, and I can try to help you.

    Here are some ExtendScript resources:

    My blog: FrameAutomation.com | FrameMaker, faster and more effective to

    Debra Herman blog: Extension of FrameMaker

    The large samples of Russ Ward: FrameMaker ExtendScript samples - West Street Consulting

    -Rick

  • ORA-00928: lack of keyword SELECT when you create a trigger

    Hello

    I am trying to create a trigger that is simple for the purpose of verification as below:
    CREATE OR REPLACE TRIGGER customer_audit
    before insert or update or delete on CUSTOMER for each row
    BEGIN
       if :old.cname is null and :new.cname is not null or :old.cname is not null and :new.cname is null  or :old.cname != :new.cname  THEN
          INSERT INTO audit_table (:old.cname,  :new.cname, null, 'cname');
          COMMIT;
       ENDIF;
    end;
    This compiles with warning. When I check the warning, he said:
    TRIGGER customer_audit compiled
    Warning: execution completed with warning
    3/32           PL/SQL: ORA-00928: missing SELECT keyword
    3/7            PL/SQL: SQL Statement ignored
    Do not know how to SELECT is part of what I'm trying to do here, or miss me something of totally. Help, please. Thank you very much.

    Change ENDIF; in END IF; and try again...

  • simple trigger that allows users to connect at certain times

    I am trying to create a trigger that will allow some users only log in the database between 12 am-04:00.
    I can assign a trigger to a user or a role or how to parse out. I don't think I have this trigger just yet...

    Or it can be set in the database it self? I looked the user accounts, profiles, roles and do not see anything on the connection time.
    Oracle 10.2.0.4

    I want to create a trigger that only allows the user to log into the database of 12 at 04:00.
    My next question is can I assign this trigger on the role that the user has been assigned to?

    I pulled a similar code that I would use, but don't know how to change to be either assigned to a user: QNP or for the ntq_ro role.



    create or replace trigger logon_time after logon on database
    Start
    If to_char (sysdate, 'HH24') between 4 and 24
    then
    raise_application_error (-20001, 'not allowed in database connection during this time');
    end if;
    end
    /

Maybe you are looking for