<?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: Create sequence and trigger... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182989#M693202</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You could do that in a single trigger and also referencing of the sequence value could be achieved at the procedure/package level. &lt;BR /&gt;&lt;BR /&gt;NB. it is advisable to include all the logic in a package and call it from the trigger than to include it into the trigger itself...&lt;BR /&gt;&lt;BR /&gt;&amp;gt;auto-populate with date and time&lt;BR /&gt;Will it be sysdate?&lt;BR /&gt;&lt;BR /&gt;revert!&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
    <pubDate>Sat, 19 Apr 2008 04:59:10 GMT</pubDate>
    <dc:creator>Yogeeraj_1</dc:creator>
    <dc:date>2008-04-19T04:59:10Z</dc:date>
    <item>
      <title>Create sequence and trigger...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182988#M693201</link>
      <description>Oracle 10g&lt;BR /&gt;I have a table that needs two columns to auto populate.&lt;BR /&gt;One with a sequence which I think I have but the other column I need to auto populate with date and time.&lt;BR /&gt;&lt;BR /&gt;Can I combine the two into one trigger, if not how do I create the trigger for the date?&lt;BR /&gt;****&lt;BR /&gt;create sequence ADVXRT_ODB.SEQ_EAIERRJNLSEQN&lt;BR /&gt;START WITH 000000000000001&lt;BR /&gt;MAXVALUE 999999999999999&lt;BR /&gt;increment by 1 &lt;BR /&gt;CYCLE&lt;BR /&gt;CACHE 20&lt;BR /&gt;ORDER;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;CREATE OR REPLACE TRIGGER ADVXRT_ODB.INS_TRANSACTIONAUDIT_EAI&lt;BR /&gt;BEFORE INSERT&lt;BR /&gt;ON ADVXRT_ODB.TRANSACTIONAUDIT&lt;BR /&gt;REFERENCING NEW AS NEW&lt;BR /&gt;FOR EACH ROW&lt;BR /&gt;BEGIN&lt;BR /&gt;SELECT ADVXRT_ODB.SEQ_EAIERRJNLSEQN.NEXTVAL INTO :NEW.EAIERRJNLSEQN FROM dual;&lt;BR /&gt;END;&lt;BR /&gt;&lt;BR /&gt;****&lt;BR /&gt;I thought this would work for the date...&lt;BR /&gt;&lt;BR /&gt;CREATE OR REPLACE TRIGGER ADVXRT_ODB.INS_TRANSACTIONAUDIT_ROWCREH&lt;BR /&gt;BEFORE INSERT&lt;BR /&gt;ON ADVXRT_ODB.TRANSACTIONAUDIT&lt;BR /&gt;REFERENCING NEW AS NEW&lt;BR /&gt;FOR EACH ROW&lt;BR /&gt;BEGIN&lt;BR /&gt;:NEW.ROWCREW :=SYSDATE;&lt;BR /&gt;END;</description>
      <pubDate>Fri, 18 Apr 2008 20:19:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182988#M693201</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2008-04-18T20:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create sequence and trigger...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182989#M693202</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You could do that in a single trigger and also referencing of the sequence value could be achieved at the procedure/package level. &lt;BR /&gt;&lt;BR /&gt;NB. it is advisable to include all the logic in a package and call it from the trigger than to include it into the trigger itself...&lt;BR /&gt;&lt;BR /&gt;&amp;gt;auto-populate with date and time&lt;BR /&gt;Will it be sysdate?&lt;BR /&gt;&lt;BR /&gt;revert!&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Sat, 19 Apr 2008 04:59:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182989#M693202</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-04-19T04:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create sequence and trigger...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182990#M693203</link>
      <description>hi again,&lt;BR /&gt;&lt;BR /&gt;Allow me to demonstrate how i would go about implementing something similar.&lt;BR /&gt;&lt;BR /&gt;yogee@mydb.mu&amp;gt;create table tab1 (val1 number(2));&lt;BR /&gt;&lt;BR /&gt;Table created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.08&lt;BR /&gt;yogee@mydb.mu&amp;gt;create table audit_table(audit_date date default sysdate,audit_col1 number(2));&lt;BR /&gt;&lt;BR /&gt;Table created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.06&lt;BR /&gt;yogee@mydb.mu&amp;gt;create sequence myseq&lt;BR /&gt;  2  START WITH 1&lt;BR /&gt;  3  MAXVALUE 10&lt;BR /&gt;  4  increment by 1&lt;BR /&gt;  5  CYCLE&lt;BR /&gt;  6  noCACHE&lt;BR /&gt;  7  order;&lt;BR /&gt;&lt;BR /&gt;Sequence created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.03&lt;BR /&gt;yogee@mydb.mu&amp;gt;create or replace PACKAGE BODY pkg1 IS&lt;BR /&gt;  2  procedure sproc_transaction_audit is&lt;BR /&gt;  3  begin&lt;BR /&gt;  4   insert into audit_table(audit_date,audit_col1) values(sysdate,myseq.nextval);&lt;BR /&gt;  5  end;&lt;BR /&gt;  6  END;&lt;BR /&gt;  7  /&lt;BR /&gt;&lt;BR /&gt;Package body created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.07&lt;BR /&gt;yogee@mydb.mu&amp;gt;create or replace TRIGGER TRG_AFT_INSTAB1_1&lt;BR /&gt;  2    AFTER INSERT&lt;BR /&gt;  3    ON TAB1 REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW&lt;BR /&gt;  4  BEGIN&lt;BR /&gt;  5    pkg1.sproc_transaction_audit;&lt;BR /&gt;  6  END;&lt;BR /&gt;  7  /&lt;BR /&gt;&lt;BR /&gt;Trigger created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.13&lt;BR /&gt;yogee@mydb.mu&amp;gt;insert into tab1 values(1);&lt;BR /&gt;&lt;BR /&gt;1 row created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.05&lt;BR /&gt;yogee@mydb.mu&amp;gt;select * from audit_table;&lt;BR /&gt;&lt;BR /&gt;AUDIT_DATE       AUDIT_COL1&lt;BR /&gt;________________ __________&lt;BR /&gt;19/04/2008 09:49          1&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.04&lt;BR /&gt;yogee@mydb.mu&amp;gt;insert into tab1 values(2);&lt;BR /&gt;&lt;BR /&gt;1 row created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.03&lt;BR /&gt;yogee@mydb.mu&amp;gt;select * from audit_table;&lt;BR /&gt;&lt;BR /&gt;AUDIT_DATE       AUDIT_COL1&lt;BR /&gt;________________ __________&lt;BR /&gt;19/04/2008 09:49          1&lt;BR /&gt;19/04/2008 09:52          2&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.07&lt;BR /&gt;yogee@mydb.mu&amp;gt;rollback;&lt;BR /&gt;&lt;BR /&gt;Rollback complete.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.03&lt;BR /&gt;yogee@mydb.mu&amp;gt;insert into tab1 values(3);&lt;BR /&gt;&lt;BR /&gt;1 row created.&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.03&lt;BR /&gt;yogee@mydb.mu&amp;gt;select * from audit_table;&lt;BR /&gt;&lt;BR /&gt;AUDIT_DATE       AUDIT_COL1&lt;BR /&gt;________________ __________&lt;BR /&gt;19/04/2008 09:53          3&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.04&lt;BR /&gt;yogee@mydb.mu&amp;gt;select * from tab1;&lt;BR /&gt;&lt;BR /&gt;      VAL1&lt;BR /&gt;__________&lt;BR /&gt;         3&lt;BR /&gt;&lt;BR /&gt;Elapsed: 00:00:00.06&lt;BR /&gt;yogee@mydb.mu&amp;gt;&lt;BR /&gt;    &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hope this helps!&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Sat, 19 Apr 2008 05:00:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182990#M693203</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-04-19T05:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create sequence and trigger...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182991#M693204</link>
      <description>attached a more readable version.</description>
      <pubDate>Sat, 19 Apr 2008 05:01:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182991#M693204</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-04-19T05:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create sequence and trigger...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182992#M693205</link>
      <description>hi again,&lt;BR /&gt;&lt;BR /&gt;sorry. my demo does not include this portion:&lt;BR /&gt;&lt;BR /&gt;create or replace PACKAGE pkg1 IS&lt;BR /&gt;  procedure sproc_transaction_audit;&lt;BR /&gt;END;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;sorry for inconveniences.&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Sat, 19 Apr 2008 05:03:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/create-sequence-and-trigger/m-p/4182992#M693205</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-04-19T05:03:32Z</dc:date>
    </item>
  </channel>
</rss>

