<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Oracle 9i sqlplus Trigger in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553058#M840565</link>
    <description>Hi.. thanks guys for the inputs...&lt;BR /&gt;&lt;BR /&gt;Just somemore query,&lt;BR /&gt;&lt;BR /&gt;IF i want the trigger to update another table (table2) instead of inserting a new value when it gotten a new input from one table (table1). And display data from (table3) when the update is complete.. how can this be done..&lt;BR /&gt;&lt;BR /&gt;Thanks in advance..!!&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 27 May 2005 07:11:12 GMT</pubDate>
    <dc:creator>Henry Chua</dc:creator>
    <dc:date>2005-05-27T07:11:12Z</dc:date>
    <item>
      <title>Oracle 9i sqlplus Trigger</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553054#M840561</link>
      <description>Hi guys,&lt;BR /&gt;  &lt;BR /&gt;  I need to create a trigger using sqlplus. Anyone know how I can do that?&lt;BR /&gt;&lt;BR /&gt;I want to create a trigger after I added newline is added in a table. then using the data from the new line to write to another table. How should I go about doin it?&lt;BR /&gt;&lt;BR /&gt;Thank u&lt;BR /&gt;&lt;BR /&gt;Henry</description>
      <pubDate>Fri, 27 May 2005 00:28:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553054#M840561</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2005-05-27T00:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle 9i sqlplus Trigger</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553055#M840562</link>
      <description>Hi Henry,&lt;BR /&gt;&lt;BR /&gt;I suppose a better site for this is otn.oracle.com. &lt;BR /&gt;Before creating a trigger, decide what kind of a trigger it has to be.&lt;BR /&gt;Here's the syntax:&lt;BR /&gt;CREATE [OR REPLACE] TRIGGER [schema .] trigger &lt;BR /&gt;{ BEFORE | AFTER | INSTEAD OF }&lt;BR /&gt;{ dml_event_clause &lt;BR /&gt;| { ddl_event [OR ddl_event]...&lt;BR /&gt;  | database_event [OR database_event]...&lt;BR /&gt;  } &lt;BR /&gt;  ON { [schema .] SCHEMA | DATABASE }&lt;BR /&gt;}&lt;BR /&gt;[WHEN ( condition ) ] &lt;BR /&gt;{ pl/sql_block | call_procedure_statement }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I 'll also attach the sql reference as gif.&lt;BR /&gt;&lt;BR /&gt;Have fun!&lt;BR /&gt;&lt;BR /&gt;Cheerio,&lt;BR /&gt;&lt;BR /&gt;Renarios</description>
      <pubDate>Fri, 27 May 2005 01:12:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553055#M840562</guid>
      <dc:creator>renarios</dc:creator>
      <dc:date>2005-05-27T01:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle 9i sqlplus Trigger</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553056#M840563</link>
      <description>Hi Henry,&lt;BR /&gt;&lt;BR /&gt;Here an example of one trigger I created here at my site:&lt;BR /&gt;&lt;BR /&gt;CREATE OR REPLACE TRIGGER APPS.CUST_AR_RECEIVABLE_APPLIC_BRIU&lt;BR /&gt;before insert on AR.AR_RECEIVABLE_APPLICATIONS_ALL&lt;BR /&gt;for each row&lt;BR /&gt;BEGIN&lt;BR /&gt;if :new.application_type != 'CM' then&lt;BR /&gt;   if nvl( :new.display, :old.display) = 'Y' and nvl( :new.status, :old.status) in ('ACC', 'APP') then&lt;BR /&gt;    if to_char( nvl( :new.apply_date, :old.apply_date) , 'MON-RRRR') !=&lt;BR /&gt;       to_char( nvl( :new.gl_date, :old.gl_date), 'MON-RRRR') or&lt;BR /&gt;    to_char( nvl( :new.apply_date, :old.apply_date), 'DD-MM-RRRR') = to_char( sysdate, 'DD-MM-RRRR')&lt;BR /&gt;    then&lt;BR /&gt;         RAISE_APPLICATION_ERROR( -20999, 'Invalid date for application!');&lt;BR /&gt;    end if;&lt;BR /&gt; elsif to_char( nvl( :new.reversal_gl_date, :old.reversal_gl_date), 'DD-MM-RRRR') =&lt;BR /&gt;     to_char( sysdate, 'DD-MM-RRRR') then&lt;BR /&gt;         RAISE_APPLICATION_ERROR( -20998, 'Invalid date for reverse!');&lt;BR /&gt; end if;&lt;BR /&gt;end if;&lt;BR /&gt;END;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;&lt;BR /&gt;Eric Antunes&lt;BR /&gt;</description>
      <pubDate>Fri, 27 May 2005 03:08:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553056#M840563</guid>
      <dc:creator>Eric Antunes</dc:creator>
      <dc:date>2005-05-27T03:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle 9i sqlplus Trigger</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553057#M840564</link>
      <description>Hi Henry,&lt;BR /&gt;&lt;BR /&gt;Here is a simple example of how you do it.&lt;BR /&gt;&lt;BR /&gt;Create two tables tab1 and tab2&lt;BR /&gt;&lt;BR /&gt;Create tab1 (eno number(10));&lt;BR /&gt;&lt;BR /&gt;Create tab2 (enum number(10));&lt;BR /&gt;&lt;BR /&gt;Now create a trigger to insert into tab2 each time a row is inserted into tab1 like this:-&lt;BR /&gt;&lt;BR /&gt;  create or replace trigger ins_tab2 AFTER INSERT ON tab1&lt;BR /&gt;          REFERENCING NEW AS N OLD AS O FOR EACH ROW&lt;BR /&gt;          begin&lt;BR /&gt;          insert into tab2l (enum) values (:N.ENO);&lt;BR /&gt;         end;&lt;BR /&gt;&lt;BR /&gt;trigger created.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now insert a record into tab1.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; insert into tab1 (eno) valies (101);&lt;BR /&gt;1 row created.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select * from tab1;&lt;BR /&gt;&lt;BR /&gt;       ENO&lt;BR /&gt;----------&lt;BR /&gt;       101&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select * from tab2;&lt;BR /&gt;&lt;BR /&gt;      ENUM&lt;BR /&gt;----------&lt;BR /&gt;       101&lt;BR /&gt;Here the trigger inserted into tab2 when you inserted into tab1&lt;BR /&gt;&lt;BR /&gt;Indira A&lt;BR /&gt;</description>
      <pubDate>Fri, 27 May 2005 03:28:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553057#M840564</guid>
      <dc:creator>Indira Aramandla</dc:creator>
      <dc:date>2005-05-27T03:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle 9i sqlplus Trigger</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553058#M840565</link>
      <description>Hi.. thanks guys for the inputs...&lt;BR /&gt;&lt;BR /&gt;Just somemore query,&lt;BR /&gt;&lt;BR /&gt;IF i want the trigger to update another table (table2) instead of inserting a new value when it gotten a new input from one table (table1). And display data from (table3) when the update is complete.. how can this be done..&lt;BR /&gt;&lt;BR /&gt;Thanks in advance..!!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 May 2005 07:11:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553058#M840565</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2005-05-27T07:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle 9i sqlplus Trigger</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553059#M840566</link>
      <description>Display where?  If the updating is done using sqlplus, then you can use the dbms_output package.  If it's going through a tool (forms or a custom tool) you may be better off not using a trigger and coding it into the tool.</description>
      <pubDate>Fri, 27 May 2005 09:35:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553059#M840566</guid>
      <dc:creator>John Wimmer_1</dc:creator>
      <dc:date>2005-05-27T09:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle 9i sqlplus Trigger</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553060#M840567</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;I think this is what you want:&lt;BR /&gt;&lt;BR /&gt;create or replace trigger updt_tab2 after insert on tab1&lt;BR /&gt;for each row&lt;BR /&gt;declare&lt;BR /&gt;&lt;BR /&gt;    w_tab3_column tab3.&lt;TAB3_COLUMN&gt;%type;&lt;BR /&gt;&lt;BR /&gt;begin&lt;BR /&gt;&lt;BR /&gt;if :new.tab1_column != :old.tab1_column then&lt;BR /&gt;&lt;BR /&gt;   update tab2 set &lt;TAB2_COLUMN&gt;=&amp;lt;:new.tab1_column&amp;gt;&lt;BR /&gt;   where &lt;TAB2_COLUMN_ID&gt;=&amp;lt;:new.tab1_column_id&amp;gt;;&lt;BR /&gt;&lt;BR /&gt;   select &lt;TAB3_COLUMN&gt;&lt;BR /&gt;   into w_tab3_column&lt;BR /&gt;   from tab3&lt;BR /&gt;   where &lt;TAB3_COLUMN_ID&gt;=&amp;lt;:new.tab3_column_id&amp;gt;;&lt;BR /&gt;   &lt;BR /&gt;   raise_application_error( -20999, 'Your message');  --if you don't want it to be a error message use dbms_output package like John said...&lt;BR /&gt;end if;   &lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Eric Antunes&lt;/TAB3_COLUMN_ID&gt;&lt;/TAB3_COLUMN&gt;&lt;/TAB2_COLUMN_ID&gt;&lt;/TAB2_COLUMN&gt;&lt;/TAB3_COLUMN&gt;</description>
      <pubDate>Fri, 27 May 2005 09:48:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553060#M840567</guid>
      <dc:creator>Eric Antunes</dc:creator>
      <dc:date>2005-05-27T09:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle 9i sqlplus Trigger</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553061#M840568</link>
      <description>Many thanks Eric...&lt;BR /&gt;&lt;BR /&gt;with your help i did this..&lt;BR /&gt;&lt;BR /&gt;  create or replace trigger data_trigger&lt;BR /&gt;     after insert on tab1&lt;BR /&gt;     for each row&lt;BR /&gt;     declare&lt;BR /&gt;     new_data tab2.data%type;&lt;BR /&gt;     begin&lt;BR /&gt;     update tab2&lt;BR /&gt;    set tab2_data = tab2_data -:tab1_data&lt;BR /&gt;    where tab1_id = :new.tab2_id;&lt;BR /&gt;    IF ( new_data &amp;lt; 100) THEN&lt;BR /&gt;            DBMS_OUTPUT.PUT_LINE ( 'amount  = ' || new_data );&lt;BR /&gt;          END IF;&lt;BR /&gt; END;&lt;BR /&gt;/&lt;BR /&gt;&lt;BR /&gt;The trigger works logically subtracting the amount from the total when triggered.. but it wont display the amount when I used the dms_output.put_line function.. if I want the system to display the amount left how should i do it?&lt;BR /&gt;&lt;BR /&gt;thanks!!&lt;BR /&gt;</description>
      <pubDate>Fri, 27 May 2005 11:59:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553061#M840568</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2005-05-27T11:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle 9i sqlplus Trigger</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553062#M840569</link>
      <description>Hi Henry,&lt;BR /&gt;&lt;BR /&gt;You will require to set serveroutput on  &lt;BR /&gt;  &lt;BR /&gt;If serveroutput is not turned on, nothing will be displayed even if you call the DBMS_OUTPUT.ENABLE packaged procedure.  &lt;BR /&gt;  &lt;BR /&gt;In a PL/SQL program, calls to DBMS_OUTPUT.PUT_LINE will add lines to the buffer. &lt;BR /&gt;Nothing is actually displayed until the program executes completely and control is transfered back to SQL*Plus or SQL*DBA.  At this point, if serveroutput is on, SQL*Plus or SQL*DBA will make a call to DBMS_OUTPUT.GET_LINES and print the results to the screen.  &lt;BR /&gt;&lt;BR /&gt;Indira A&lt;BR /&gt;  &lt;BR /&gt;</description>
      <pubDate>Sun, 29 May 2005 21:04:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/oracle-9i-sqlplus-trigger/m-p/3553062#M840569</guid>
      <dc:creator>Indira Aramandla</dc:creator>
      <dc:date>2005-05-29T21:04:45Z</dc:date>
    </item>
  </channel>
</rss>

