Skip to main content

Posts

Showing posts with the label put line

Write a PL SQL code for reverse digits of given number at run time

To Write a PL SQL code for reverse digits of given number at run time you can use below code.

Create or replace trigger before insert on field in sql

1.Create  or replace trigger before insert on field in sql Create or replace trigger t1 Before insert on Employee For each row declare v_firstname Employee.firstname%type; v_lastname Employee.lastname%type; Begin DBMS_OUTPUT.PUT_LINE('You inserted the first Name:'|| :NEW.FIRSTNAME); DBMS_OUTPUT.PUT_LINE('You inserted the first Name:'|| :NEW.LASTNAME); Begin select distinct firstname into v_firstname from Employee where firstname=:NEW.FIRSTNAME; IF(:NEW.FIRSTNAME = v_firstname) THEN DBMS_OUTPUT.PUT_LINE('This first name exists already in the table Employee.'); end if; exception when no_data_found then DBMS_OUTPUT.PUT_LINE('This first name does not exist in the table Employee.'); End; Begin select distinct lastname into v_lastname from Employee where lastname=:NEW.lastNAME; IF(:NEW.LASTNAME = v_lastname) THEN DBMS_OUTPUT.PUT_LINE('This last name exists already in the table Employee.