Oracle Trigger Programming

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Oracle Trigger Programming as PDF for free.

More details

  • Words: 626
  • Pages: 10
Untitled SQL> ed f2 SQL> @ f1 15 / 1SUNDARRAJAN.R 2SABAREESAN 3SRINIVASAN 3SRINIVASAN PL/SQL procedure successfully completed. SQL> @ f2 8 / Warning: Trigger created with compilation errors. SQL> ed f2 SQL> @ f2 8 / Warning: Trigger created with compilation errors. SQL> ed f2 SQL> @ f2 8 / Page 1

Untitled Trigger created. SQL> desc emplist; Name Null? T ----------------------------------------- -------- EID N ENAME C SEX C BASICPAY N HRA N DA N NETPAY N ITSEP N TOTAL N SQL> create table emplist1(eid number,ename char(25)) Table created. SQL> desc emplist1; Name Null? T ----------------------------------------- -------- EID N ENAME C SQL> ed f2 Page 2

Untitled SQL> @ f2 8 / create or replace trigger s3 * ERROR at line 1: ORA-04095: trigger 'S3' already exists on another tab

SQL> ed f2 SQL> @ f2 8 / Trigger created. SQL> insert into emplist1 values(&eid,'&ename'); Enter value for eid: 1 Enter value for ename: sundar old 1: insert into emplist1 values(&eid,'&ename') new 1: insert into emplist1 values(1,'sundar') 1 row created. SQL> / Enter value for eid: 0 Enter value for ename: sujith Page 3

Untitled old 1: insert into emplist1 values(&eid,'&ename') new 1: insert into emplist1 values(0,'sujith') insert into emplist1 values(0,'sujith') * ERROR at line 1: ORA-20040: Input less than one ORA-06512: at "SCOTT.S4", line 3 ORA-04088: error during execution of trigger 'SCOTT.S

SQL> ed f3 SQL> ed f2 SQL> ed f3 SQL> alter table emplist1 add(age number); Table altered. SQL> desc emplist1; Name Null? T ----------------------------------------- -------- EID N ENAME C AGE N Page 4

Untitled SQL> select * from emplist1; EID ENAME AGE ---------- ------------------------- ---------1 sundar SQL> update table emplist1 set(age=1)where eid=1; update table emplist1 set(age=1)where eid=1 * ERROR at line 1: ORA-00903: invalid table name

SQL> update emplist1 set(age=1)where eid=1; update emplist1 set(age=1)where eid=1 * ERROR at line 1: ORA-00907: missing right parenthesis

SQL> update emplist1 set(age)=1 where eid=1; 1 row updated. SQL> select * from emplist1; EID ENAME

AGE Page 5

Untitled ---------- ------------------------- ---------1 sundar 1 SQL> ed f3 SQL> @ f3 8 / Trigger created. SQL> insert into emplist1 values(&eid,'&ename',&age); Enter value for eid: 2 Enter value for ename: sujith Enter value for age: 19 old 1: insert into emplist1 values(&eid,'&ename',&a new 1: insert into emplist1 values(2,'sujith',19) 1 row created. SQL> / Enter value for eid: 3 Enter value for ename: vairam Enter value for age: 60 old 1: insert into emplist1 values(&eid,'&ename',&a new 1: insert into emplist1 values(3,'vairam',60) 1 row created. Page 6

Untitled SQL> / Enter value for eid: 0 Enter value for ename: vinoth Enter value for age: 0 old 1: insert into emplist1 values(&eid,'&ename',&a new 1: insert into emplist1 values(0,'vinoth',0) 1 row created. SQL> insert into emplist1 values(0,'vinu',0); 1 row created. SQL> @ f3 8 / Trigger created. SQL> ed f3 SQL> @ f3 8 / Trigger created. SQL> insert into emplist1 values(0,'vinu',0); Page 7

Untitled 1 row created. SQL> insert into emplist1 values(&eid,'&ename',&age) Enter value for eid: -2 Enter value for ename: 5 Enter value for age: 0 old 1: insert into emplist1 values(&eid,'&ename',& new 1: insert into emplist1 values(-2,'5',0) 1 row created. SQL> ed f3 SQL> ed f5 SQL> @ f5 8 / before update on tri for each row * ERROR at line 2: ORA-00942: table or view does not exist

SQL> ed f5 SQL> @ f5 Page 8

Untitled 8 / Warning: Trigger created with compilation errors. SQL> ed f5 SQL> @ f5 8 / Warning: Trigger created with compilation errors. SQL> ed f5 SQL> @ f5 8 / Warning: Trigger created with compilation errors. SQL> ed f5 SQL> @ f5 8 / Warning: Trigger created with compilation errors. SQL> ed f5 Page 9

Untitled SQL> @ f5 8 / Warning: Trigger created with compilation errors. SQL> ed f5

Page 10

Related Documents

Oracle 10g Trigger
July 2020 14
Trigger
November 2019 31
Trigger
November 2019 30
Trigger
June 2020 22
Trigger
November 2019 31