Custom Search

Wednesday 30 November 2011

Write a Trigger to ckeck the Pincode is exactly six degit or not., Write a PL/SQL Trigger to ckeck the Pincode is exactly six degit or not


Write a Trigger to ckeck the Pincode is exactly six degit or not.,  Write a PL/SQL Trigger to ckeck the Pincode is exactly six degit or not

create table citypin(

pin number(10));


insert into citypin values(&pin);


SQL> select * from citypin;


PIN

---------

2434355

3435465

122

123235467


set serveroutput on

create or replace trigger tri28 before insert on citypin for each row

declare

tpin citypin.pin%type;

begin

tpin:=:new.pin;

if length(to_char(tpin))!=6 then

raise_application_error(-20002,'Your Pincode is Invalid');

end if;

end;

No comments:

Post a Comment

Laptops