SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Advance features in stored procedures and triggers. Keshava Murthy, Architect, Informix Software Session Number TIX-2258
Disclaimer ,[object Object],[object Object],[object Object],[object Object],[object Object]
Trigger Enhancements employee_tab Insert trigger Delete trigger Select triggers employee_tab Pre 11 server 11 server Single insert and delete triggers, and multiple update and select triggers on mutually exclusive columns Multiple insert, update, delete  and select triggers without exclusivity rule. The multiple insert and delete triggers feature is new in Cheetah. Update triggers Insert triggers Delete triggers Update triggers Select triggers New Feature: Multiple Triggers New feature:  No Exclusivity rule
Insert Trigger ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Insert Trigger  -- add a new trigger ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Delete Trigger ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Update Trigger ,[object Object],[object Object],[object Object]
Writing trigger code, easily. ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],-- new syntax. New boolean functions:  INSERTING SELECTING DELETING  UPDATING  -- You can modify the new row values.
Explain Enhancements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
New Functions and Expressions ASCII(character_expression) The ASCII function returns the decimal representation of the  first character  in a character string. ASCII(‘a’)  returns:  97 ASCII(‘Hello World!’)  returns:  72 ASCII  ADD_MONTHS(date/datetime expression ,  integer )   Adds months to a date or datetime value or expression.  The first argument is date or datetime expression and second is an integer.  Return type is same as first argument. ADD_MONTHS('4/16/2004', 20)  returns: 12/16/2005 ADD_MONTHS(CURRENT, 3)  returns: 2007-09-19 10:04:11.00000 ADD_MONTHS()
New Functions and Expressions CEIL (numerical_expession) returns the DECIMAL(32) representation of the  smallest integer  that is greater than or equal to its single argument.  FLOOR(numerical_expression) returns the DECIMAL(32) representation of the  largest integer  that is smaller than or equal to its single argument. CEIL(-54.232)  returns  -54   FLOOR(-54.232)  returns  -55 CEIL(54.232)   returns  55   FLOOR(54.232)   returns  54 CEIL FLOOR BITAND(num1, num2) – returns the bitwise ANDed value. BITOR(num1, num2) – returns the bitwise ORed value. BITXOR(num1, num2) – returns the bitwise XORed value. BITNOT(num1) – returns the bitwise ANDed value. BITANDNOT(num1, num2) – is a short form for  BITAND(arg1, BITNOT(arg2)) Bitwise  functions
New Functions and Expressions LAST_DAY(date or datetime expression) Returns last day of the month in the argument. SELECT TODAY AS today, CURRENT AS current, LAST_DAY(TODAY) AS last_from_today, LAST_DAY(CURRENT) AS last_from_current FROM systables WHERE tabid = 1; today  06/19/2007 current  2007-06-19 10:23:01.000 last_from_today  06/30/2007 last_from_current  2007-06-30 10:23:01.00000 LAST_DAY FORMAT_UNITS(number, precision, units) Helps formatting of numbers in kilobytes to peta bytes.  Detailed explanation with examples is in IDS SQL Syntax guide. SELECT FORMAT_UNITS( SUM(chksize), 'P') size, FORMAT_UNITS( SUM(nfree), 'p') free FROM syschunks; size  117 MB free  8.05 MB  FORMAT_UNITS
New Functions and Expressions MONTHS_BETWEEN(date/datetime expr, date/datetime expr) Returns the difference between two date or datetime expressions in decimal, based on 31day months. SELECT CURRENT, MONTHS_BETWEEN(TODAY, LAST_DAY(CURRENT)) FROM systables WHERE tabid = 1; (expression)  (expression) 2007-06-19 10:51:57.000  -0.3694433243728 MONTHS_BETWEEN LTRIM(source_string, pad_string) Returns the source_string after removing specified leading pad characters from a string.  LTRIM will remove leading blanks when you simply pass the source string.  LTRIM(‘Hello Cheetah!’, ‘Hello ‘)  returns: Cheetah! LTRIM
New Functions and Expressions TO_NUMBER(character or numeric expression) converts a number or a character expression representing a number value to a DECIMAL. TO_NUMBER NULLIF(arg1, arg2) Returns NULL if arg1 and arg2 are equal, else returns arg1.  If both are NULL – they won’t be equal – but still returns NULL because arg1 is NULL. NULLIF Next_day(date or datetime expr, abbreviated day of the week) Returns the date or datetime for next day matching the second argument. EXECUTE FUNCTION NEXT_DAY(TODAY, 'Mon')  returns: 06/25/2007 EXECUTE FUNCTION NEXT_DAY(CURRENT, 'Mon')  returns: 2007-06-25 6:57:52.00000 NEXT_DAY
Enhancements to Functions Works same as POW() function. POWER Returns the same value as CURRENT DATETIME year to fraction(5) SYSDATE These two functions can now take date and datetime expressions.  IDS Syntax guide explains this in detail. TRUNC  ROUND TO_CHAR(numeric expression) In addition to exisiting functionality, in IDS v11.10, this function will convert a number into a charater string. TO_CHAR
SYSDBOPEN() and SYSDBCLOSE()  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Named Parameters Support for JDBC ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Named Parameters Support for JDBC Here is the same code rewritten using named parameter notation: // Set parameters (named notation) cstmt.setInt(" cust_id ", 5739 ); Chapter 9. SQL Language 275 cstmt.setInt(" item_id ", 8294); cstmt.setString(" shipping_addr ", "345, University ave."); cstmt.setInt(" shipping_zip ", 94303); cstmt.setString(" billing_addr ","4100 Bohannon Dr."); cstmt.setInt(" billing_zip ", 94025); cstmt.setInt(" count ", 5); // Execute cstmt.execute();
Stored Procedure Enhancements ,[object Object],[object Object],[object Object]
GO TO Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
LOOP Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
LOOP Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
LOOP Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Stored Procedure language(SPL) routines IDS Client IDS Client Informix routine manager Informix Dynamic Server Query processing and Optimizer C Language routines Java language routines
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
SQL Injection http://xkcd.com/327/   http://imgs.xkcd.com/comics/exploits_of_a_mom.png   This work is licensed under a   Creative Commons Attribution- NonCommercial  2.5 License .  This means you're free to copy and share these comics (but not to sell them).
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Stored Procedure Recompilation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 
Savepoints. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Savepoints. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Savepoints ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

computer notes - Memory organization
computer notes - Memory organizationcomputer notes - Memory organization
computer notes - Memory organization
ecomputernotes
 

Was ist angesagt? (9)

Is java8a truefunctionallanguage
Is java8a truefunctionallanguageIs java8a truefunctionallanguage
Is java8a truefunctionallanguage
 
Is java8 a true functional programming language
Is java8 a true functional programming languageIs java8 a true functional programming language
Is java8 a true functional programming language
 
The Ring programming language version 1.7 book - Part 24 of 196
The Ring programming language version 1.7 book - Part 24 of 196The Ring programming language version 1.7 book - Part 24 of 196
The Ring programming language version 1.7 book - Part 24 of 196
 
Logistic Regression, Linear and Quadratic Discriminant Analysis and K-Nearest...
Logistic Regression, Linear and Quadratic Discriminant Analysis and K-Nearest...Logistic Regression, Linear and Quadratic Discriminant Analysis and K-Nearest...
Logistic Regression, Linear and Quadratic Discriminant Analysis and K-Nearest...
 
The Ring programming language version 1.5.3 book - Part 21 of 184
The Ring programming language version 1.5.3 book - Part 21 of 184The Ring programming language version 1.5.3 book - Part 21 of 184
The Ring programming language version 1.5.3 book - Part 21 of 184
 
computer notes - Memory organization
computer notes - Memory organizationcomputer notes - Memory organization
computer notes - Memory organization
 
Designing and implementing embedded synthesizer UIs with JUCE (Geert Bevin, A...
Designing and implementing embedded synthesizer UIs with JUCE (Geert Bevin, A...Designing and implementing embedded synthesizer UIs with JUCE (Geert Bevin, A...
Designing and implementing embedded synthesizer UIs with JUCE (Geert Bevin, A...
 
The Ring programming language version 1.6 book - Part 23 of 189
The Ring programming language version 1.6 book - Part 23 of 189The Ring programming language version 1.6 book - Part 23 of 189
The Ring programming language version 1.6 book - Part 23 of 189
 
Admission for b.tech
Admission for b.techAdmission for b.tech
Admission for b.tech
 

Ähnlich wie Advance Features In Procedues And Triggers

MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
gilpinleeanna
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
Reka
 
Understand when to use user defined functions in sql server tech-republic
Understand when to use user defined functions in sql server   tech-republicUnderstand when to use user defined functions in sql server   tech-republic
Understand when to use user defined functions in sql server tech-republic
Kaing Menglieng
 

Ähnlich wie Advance Features In Procedues And Triggers (20)

IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql Features
 
4sem dbms(1)
4sem dbms(1)4sem dbms(1)
4sem dbms(1)
 
Oracle: Functions
Oracle: FunctionsOracle: Functions
Oracle: Functions
 
Oracle: Functions
Oracle: FunctionsOracle: Functions
Oracle: Functions
 
Oracle_Analytical_function.pdf
Oracle_Analytical_function.pdfOracle_Analytical_function.pdf
Oracle_Analytical_function.pdf
 
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
 
Unit 3
Unit 3Unit 3
Unit 3
 
Enhancements in Oracle 23c Introducing the NewOld Returning Clause
Enhancements in Oracle 23c Introducing the NewOld Returning ClauseEnhancements in Oracle 23c Introducing the NewOld Returning Clause
Enhancements in Oracle 23c Introducing the NewOld Returning Clause
 
The Ring programming language version 1.5.1 book - Part 175 of 180
The Ring programming language version 1.5.1 book - Part 175 of 180 The Ring programming language version 1.5.1 book - Part 175 of 180
The Ring programming language version 1.5.1 book - Part 175 of 180
 
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
DOODB_LAB.pptx
DOODB_LAB.pptxDOODB_LAB.pptx
DOODB_LAB.pptx
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
 
The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210
 
Go Faster With Native Compilation
Go Faster With Native CompilationGo Faster With Native Compilation
Go Faster With Native Compilation
 
Preprocessor directives
Preprocessor directivesPreprocessor directives
Preprocessor directives
 
"Functional Programming in a Nutshell" by Adityo Pratomo (Froyo Framework)
"Functional Programming in a Nutshell" by Adityo Pratomo (Froyo Framework)"Functional Programming in a Nutshell" by Adityo Pratomo (Froyo Framework)
"Functional Programming in a Nutshell" by Adityo Pratomo (Froyo Framework)
 
The Ring programming language version 1.9 book - Part 93 of 210
The Ring programming language version 1.9 book - Part 93 of 210The Ring programming language version 1.9 book - Part 93 of 210
The Ring programming language version 1.9 book - Part 93 of 210
 
Understand when to use user defined functions in sql server tech-republic
Understand when to use user defined functions in sql server   tech-republicUnderstand when to use user defined functions in sql server   tech-republic
Understand when to use user defined functions in sql server tech-republic
 

Mehr von Keshav Murthy

Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLBringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Keshav Murthy
 

Mehr von Keshav Murthy (20)

N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0N1QL New Features in couchbase 7.0
N1QL New Features in couchbase 7.0
 
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018Couchbase Tutorial: Big data Open Source Systems: VLDB2018
Couchbase Tutorial: Big data Open Source Systems: VLDB2018
 
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
N1QL+GSI: Language and Performance Improvements in Couchbase 5.0 and 5.5
 
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
XLDB Lightning Talk: Databases for an Engaged World: Requirements and Design...
 
Couchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing featuresCouchbase 5.5: N1QL and Indexing features
Couchbase 5.5: N1QL and Indexing features
 
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram VemulapalliN1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
N1QL: Query Optimizer Improvements in Couchbase 5.0. By, Sitaram Vemulapalli
 
Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.Couchbase N1QL: Language & Architecture Overview.
Couchbase N1QL: Language & Architecture Overview.
 
Couchbase Query Workbench Enhancements By Eben Haber
Couchbase Query Workbench Enhancements  By Eben Haber Couchbase Query Workbench Enhancements  By Eben Haber
Couchbase Query Workbench Enhancements By Eben Haber
 
Mindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developersMindmap: Oracle to Couchbase for developers
Mindmap: Oracle to Couchbase for developers
 
Couchbase N1QL: Index Advisor
Couchbase N1QL: Index AdvisorCouchbase N1QL: Index Advisor
Couchbase N1QL: Index Advisor
 
N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0N1QL: What's new in Couchbase 5.0
N1QL: What's new in Couchbase 5.0
 
From SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSONFrom SQL to NoSQL: Structured Querying for JSON
From SQL to NoSQL: Structured Querying for JSON
 
Tuning for Performance: indexes & Queries
Tuning for Performance: indexes & QueriesTuning for Performance: indexes & Queries
Tuning for Performance: indexes & Queries
 
Understanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune QueriesUnderstanding N1QL Optimizer to Tune Queries
Understanding N1QL Optimizer to Tune Queries
 
Utilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and IndexingUtilizing Arrays: Modeling, Querying and Indexing
Utilizing Arrays: Modeling, Querying and Indexing
 
Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5Extended JOIN in Couchbase Server 4.5
Extended JOIN in Couchbase Server 4.5
 
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQLBringing SQL to NoSQL: Rich, Declarative Query for NoSQL
Bringing SQL to NoSQL: Rich, Declarative Query for NoSQL
 
Query in Couchbase. N1QL: SQL for JSON
Query in Couchbase.  N1QL: SQL for JSONQuery in Couchbase.  N1QL: SQL for JSON
Query in Couchbase. N1QL: SQL for JSON
 
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications 
 
Introducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSONIntroducing N1QL: New SQL Based Query Language for JSON
Introducing N1QL: New SQL Based Query Language for JSON
 

Kürzlich hochgeladen

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Advance Features In Procedues And Triggers

  • 1. Advance features in stored procedures and triggers. Keshava Murthy, Architect, Informix Software Session Number TIX-2258
  • 2.
  • 3. Trigger Enhancements employee_tab Insert trigger Delete trigger Select triggers employee_tab Pre 11 server 11 server Single insert and delete triggers, and multiple update and select triggers on mutually exclusive columns Multiple insert, update, delete and select triggers without exclusivity rule. The multiple insert and delete triggers feature is new in Cheetah. Update triggers Insert triggers Delete triggers Update triggers Select triggers New Feature: Multiple Triggers New feature: No Exclusivity rule
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. New Functions and Expressions ASCII(character_expression) The ASCII function returns the decimal representation of the first character in a character string. ASCII(‘a’) returns: 97 ASCII(‘Hello World!’) returns: 72 ASCII ADD_MONTHS(date/datetime expression , integer ) Adds months to a date or datetime value or expression. The first argument is date or datetime expression and second is an integer. Return type is same as first argument. ADD_MONTHS('4/16/2004', 20) returns: 12/16/2005 ADD_MONTHS(CURRENT, 3) returns: 2007-09-19 10:04:11.00000 ADD_MONTHS()
  • 13. New Functions and Expressions CEIL (numerical_expession) returns the DECIMAL(32) representation of the smallest integer that is greater than or equal to its single argument. FLOOR(numerical_expression) returns the DECIMAL(32) representation of the largest integer that is smaller than or equal to its single argument. CEIL(-54.232) returns -54 FLOOR(-54.232) returns -55 CEIL(54.232) returns 55 FLOOR(54.232) returns 54 CEIL FLOOR BITAND(num1, num2) – returns the bitwise ANDed value. BITOR(num1, num2) – returns the bitwise ORed value. BITXOR(num1, num2) – returns the bitwise XORed value. BITNOT(num1) – returns the bitwise ANDed value. BITANDNOT(num1, num2) – is a short form for BITAND(arg1, BITNOT(arg2)) Bitwise functions
  • 14. New Functions and Expressions LAST_DAY(date or datetime expression) Returns last day of the month in the argument. SELECT TODAY AS today, CURRENT AS current, LAST_DAY(TODAY) AS last_from_today, LAST_DAY(CURRENT) AS last_from_current FROM systables WHERE tabid = 1; today 06/19/2007 current 2007-06-19 10:23:01.000 last_from_today 06/30/2007 last_from_current 2007-06-30 10:23:01.00000 LAST_DAY FORMAT_UNITS(number, precision, units) Helps formatting of numbers in kilobytes to peta bytes. Detailed explanation with examples is in IDS SQL Syntax guide. SELECT FORMAT_UNITS( SUM(chksize), 'P') size, FORMAT_UNITS( SUM(nfree), 'p') free FROM syschunks; size 117 MB free 8.05 MB FORMAT_UNITS
  • 15. New Functions and Expressions MONTHS_BETWEEN(date/datetime expr, date/datetime expr) Returns the difference between two date or datetime expressions in decimal, based on 31day months. SELECT CURRENT, MONTHS_BETWEEN(TODAY, LAST_DAY(CURRENT)) FROM systables WHERE tabid = 1; (expression) (expression) 2007-06-19 10:51:57.000 -0.3694433243728 MONTHS_BETWEEN LTRIM(source_string, pad_string) Returns the source_string after removing specified leading pad characters from a string. LTRIM will remove leading blanks when you simply pass the source string. LTRIM(‘Hello Cheetah!’, ‘Hello ‘) returns: Cheetah! LTRIM
  • 16. New Functions and Expressions TO_NUMBER(character or numeric expression) converts a number or a character expression representing a number value to a DECIMAL. TO_NUMBER NULLIF(arg1, arg2) Returns NULL if arg1 and arg2 are equal, else returns arg1. If both are NULL – they won’t be equal – but still returns NULL because arg1 is NULL. NULLIF Next_day(date or datetime expr, abbreviated day of the week) Returns the date or datetime for next day matching the second argument. EXECUTE FUNCTION NEXT_DAY(TODAY, 'Mon') returns: 06/25/2007 EXECUTE FUNCTION NEXT_DAY(CURRENT, 'Mon') returns: 2007-06-25 6:57:52.00000 NEXT_DAY
  • 17. Enhancements to Functions Works same as POW() function. POWER Returns the same value as CURRENT DATETIME year to fraction(5) SYSDATE These two functions can now take date and datetime expressions. IDS Syntax guide explains this in detail. TRUNC ROUND TO_CHAR(numeric expression) In addition to exisiting functionality, in IDS v11.10, this function will convert a number into a charater string. TO_CHAR
  • 18.
  • 19.
  • 20. Named Parameters Support for JDBC Here is the same code rewritten using named parameter notation: // Set parameters (named notation) cstmt.setInt(" cust_id ", 5739 ); Chapter 9. SQL Language 275 cstmt.setInt(" item_id ", 8294); cstmt.setString(" shipping_addr ", "345, University ave."); cstmt.setInt(" shipping_zip ", 94303); cstmt.setString(" billing_addr ","4100 Bohannon Dr."); cstmt.setInt(" billing_zip ", 94025); cstmt.setInt(" count ", 5); // Execute cstmt.execute();
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26. Stored Procedure language(SPL) routines IDS Client IDS Client Informix routine manager Informix Dynamic Server Query processing and Optimizer C Language routines Java language routines
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. SQL Injection http://xkcd.com/327/ http://imgs.xkcd.com/comics/exploits_of_a_mom.png This work is licensed under a Creative Commons Attribution- NonCommercial 2.5 License . This means you're free to copy and share these comics (but not to sell them).
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.  
  • 39.
  • 40.
  • 41.
  • 42.