SlideShare a Scribd company logo
Extracts of validation trigger examples 
You can integrate the following codes in existing code for different validation triggers: 
1. Check if a textbox is filled 
  IF :STUDENT_INSERT.STUDENT_ID IS NULL THEN 
    MESSAGE('You have not inserted a student ID yet'); 
    RAISE FORM_TRIGGER_FAILURE; 
  ELSE NULL; 
  END IF; 
 
2. Check ID/candidate key duplication 
DECLARE  
ID_COUNT Number(3); 
BEGIN 
‐‐Count the number of student record in the database, given the ID insered by the user, put into 
ID_COUNT variable   
SELECT COUNT(*) INTO ID_COUNT FROM STUDENT  WHERE 
LOWER(STUDENT_ID)=LOWER(:STUDENT_INSERT.STUDENT_ID); 
  ‐‐If there more more than 1 record with this ID, show error 
  IF ID_COUNT>0 THEN 
    MESSAGE('This ID has been used, please use the other one.'); 
    RAISE FORM_TRIGGER_FAILURE; 
  ELSE  
    MESSAGE('You can use this ID'); 
  END IF; 
   
3. Check length of a textbox 
  ‐‐Check the length of the textbox user typed, prompt error when the size less than 8 
  IF LENGTH(:student_insert.student_id) != 8 
  THEN message('Student ID should be in 8‐character, please re‐try.'); 
  RAISE FORM_TRIGGER_FAILURE; 
  ELSE NULL; 
  END IF; 
 
4. Range check (for numbers) 
  ‐‐Check the range, prompt error if user types less than 0 or more than 5 
  IF:STUDENT_INSERT.YEAR<0 
    THEN MESSAGE('The Year of Study should be a positive number.'); 
    RAISE FORM_TRIGGER_FAILURE; 
  ELSIF :STUDENT_INSERT.YEAR>5 
    THEN MESSAGE('The Year of Study should be less than 5.'); 
    RAISE FORM_TRIGGER_FAILURE; 
  ELSE NULL; 
  END IF; 
5. Check date inserted must be before the current date 
  IF :STUDENT_INSERT.DOB>SYSDATE 
    THEN MESSAGE('The date of birth cannot be a future date'); 
    RAISE FORM_TRIGGER_FAILURE; 
  ELSE NULL; 
  END IF; 

More Related Content

Viewers also liked

EVC exercise-novel motor oil
EVC exercise-novel motor oilEVC exercise-novel motor oil
EVC exercise-novel motor oilwelcometofacebook
 
Quantitative exercise-toasty oven
Quantitative exercise-toasty ovenQuantitative exercise-toasty oven
Quantitative exercise-toasty ovenwelcometofacebook
 
database design intro(database)
database design intro(database)database design intro(database)
database design intro(database)welcometofacebook
 
Source code for insert multiple rows(database)
Source code for insert multiple rows(database)Source code for insert multiple rows(database)
Source code for insert multiple rows(database)welcometofacebook
 
Source codes for alerts lovs and reports generation(database)
Source codes for alerts lovs and reports generation(database)Source codes for alerts lovs and reports generation(database)
Source codes for alerts lovs and reports generation(database)welcometofacebook
 
Subnet questions with ans(networking)
Subnet questions with ans(networking)Subnet questions with ans(networking)
Subnet questions with ans(networking)welcometofacebook
 
Source code for search engine(database)
Source code for search engine(database)Source code for search engine(database)
Source code for search engine(database)welcometofacebook
 
Database fundamentals(database)
Database fundamentals(database)Database fundamentals(database)
Database fundamentals(database)welcometofacebook
 

Viewers also liked (20)

CLTV exercise-Instyle
CLTV exercise-InstyleCLTV exercise-Instyle
CLTV exercise-Instyle
 
EVC exercise-novel motor oil
EVC exercise-novel motor oilEVC exercise-novel motor oil
EVC exercise-novel motor oil
 
Quantitative exercise-toasty oven
Quantitative exercise-toasty ovenQuantitative exercise-toasty oven
Quantitative exercise-toasty oven
 
database design intro(database)
database design intro(database)database design intro(database)
database design intro(database)
 
Exercise5(database)
Exercise5(database)Exercise5(database)
Exercise5(database)
 
Exercise1(database)
Exercise1(database)Exercise1(database)
Exercise1(database)
 
Source code for insert multiple rows(database)
Source code for insert multiple rows(database)Source code for insert multiple rows(database)
Source code for insert multiple rows(database)
 
Exercise4(database)
Exercise4(database)Exercise4(database)
Exercise4(database)
 
Source codes for alerts lovs and reports generation(database)
Source codes for alerts lovs and reports generation(database)Source codes for alerts lovs and reports generation(database)
Source codes for alerts lovs and reports generation(database)
 
Exercise2(database)
Exercise2(database)Exercise2(database)
Exercise2(database)
 
Solution4 1(database)
Solution4 1(database)Solution4 1(database)
Solution4 1(database)
 
Subnet questions with ans(networking)
Subnet questions with ans(networking)Subnet questions with ans(networking)
Subnet questions with ans(networking)
 
Exercise6(database)
Exercise6(database)Exercise6(database)
Exercise6(database)
 
Exercise3(database)
Exercise3(database)Exercise3(database)
Exercise3(database)
 
Solution6(database)
Solution6(database)Solution6(database)
Solution6(database)
 
Source code for search engine(database)
Source code for search engine(database)Source code for search engine(database)
Source code for search engine(database)
 
Solution5(database)
Solution5(database)Solution5(database)
Solution5(database)
 
Database fundamentals(database)
Database fundamentals(database)Database fundamentals(database)
Database fundamentals(database)
 
Solution1(database)
Solution1(database)Solution1(database)
Solution1(database)
 
Solution4(database)
Solution4(database)Solution4(database)
Solution4(database)
 

More from welcometofacebook

competing in a global market(4210)
competing in a global market(4210)competing in a global market(4210)
competing in a global market(4210)welcometofacebook
 
distribution strategies calyx and corolla(4210)
distribution strategies calyx and corolla(4210)distribution strategies calyx and corolla(4210)
distribution strategies calyx and corolla(4210)welcometofacebook
 
distribution strategies(4210)
distribution strategies(4210)distribution strategies(4210)
distribution strategies(4210)welcometofacebook
 
product and brand strategies(4210)
product and brand strategies(4210)product and brand strategies(4210)
product and brand strategies(4210)welcometofacebook
 
overview of marketing strategy(4210)
overview of marketing strategy(4210)overview of marketing strategy(4210)
overview of marketing strategy(4210)welcometofacebook
 
Final exam review answer(networking)
Final exam review answer(networking)Final exam review answer(networking)
Final exam review answer(networking)welcometofacebook
 
Midterm review questions ans(networking)
Midterm review questions ans(networking)Midterm review questions ans(networking)
Midterm review questions ans(networking)welcometofacebook
 
IP adress and routing(networking)
IP adress and routing(networking)IP adress and routing(networking)
IP adress and routing(networking)welcometofacebook
 
Layer 2 switching fundamentals(networking)
Layer 2 switching fundamentals(networking)Layer 2 switching fundamentals(networking)
Layer 2 switching fundamentals(networking)welcometofacebook
 
Common types of networks(networking)
Common types of networks(networking)Common types of networks(networking)
Common types of networks(networking)welcometofacebook
 

More from welcometofacebook (20)

consumer behavior(4210)
consumer behavior(4210)consumer behavior(4210)
consumer behavior(4210)
 
competing in a global market(4210)
competing in a global market(4210)competing in a global market(4210)
competing in a global market(4210)
 
promotion strategies(4210)
promotion strategies(4210)promotion strategies(4210)
promotion strategies(4210)
 
pricing strategies(4210)
pricing strategies(4210)pricing strategies(4210)
pricing strategies(4210)
 
Pharmasim
PharmasimPharmasim
Pharmasim
 
distribution strategies calyx and corolla(4210)
distribution strategies calyx and corolla(4210)distribution strategies calyx and corolla(4210)
distribution strategies calyx and corolla(4210)
 
distribution strategies(4210)
distribution strategies(4210)distribution strategies(4210)
distribution strategies(4210)
 
the birth of swatch(4210)
the birth of swatch(4210)the birth of swatch(4210)
the birth of swatch(4210)
 
product and brand strategies(4210)
product and brand strategies(4210)product and brand strategies(4210)
product and brand strategies(4210)
 
stp case jones blair(4210)
stp case jones blair(4210)stp case jones blair(4210)
stp case jones blair(4210)
 
stp(4210)
stp(4210)stp(4210)
stp(4210)
 
situational analysis(4210)
situational analysis(4210)situational analysis(4210)
situational analysis(4210)
 
quantitative analysis(4210)
quantitative analysis(4210)quantitative analysis(4210)
quantitative analysis(4210)
 
overview of marketing strategy(4210)
overview of marketing strategy(4210)overview of marketing strategy(4210)
overview of marketing strategy(4210)
 
Final exam review answer(networking)
Final exam review answer(networking)Final exam review answer(networking)
Final exam review answer(networking)
 
Midterm review questions ans(networking)
Midterm review questions ans(networking)Midterm review questions ans(networking)
Midterm review questions ans(networking)
 
IP adress and routing(networking)
IP adress and routing(networking)IP adress and routing(networking)
IP adress and routing(networking)
 
TCP/IP(networking)
TCP/IP(networking)TCP/IP(networking)
TCP/IP(networking)
 
Layer 2 switching fundamentals(networking)
Layer 2 switching fundamentals(networking)Layer 2 switching fundamentals(networking)
Layer 2 switching fundamentals(networking)
 
Common types of networks(networking)
Common types of networks(networking)Common types of networks(networking)
Common types of networks(networking)
 

Recently uploaded

一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
itech2017
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
An Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering TechniquesAn Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering Techniques
ambekarshweta25
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 

Recently uploaded (20)

一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
An Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering TechniquesAn Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering Techniques
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 

Souce code of validation trigger examples(database)