Oracle stored procedures
Home > Ask the Oracle Experts > (Archive) Database Performance Tuning Questions & Answers > Difference between function, procedure and trigger
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Difference between function, procedure and trigger

Paul Baumgartel EXPERT RESPONSE FROM: Paul Baumgartel

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Oracle tips, scripts, and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 11 January 2006
What is the difference between a function, a procedure and a trigger? I know the basic differences, but I would like to know the answers based on the performance tuning aspect (especially function and procedure, as in Oracle even procedures can return values using OUT).

>
EXPERT RESPONSE
The major difference to keep in mind is that trigger code is hard-parsed every time the trigger runs. You should therefore code all of your trigger actions in stored procedures (preferably implemented in packages, per good programming practice), and limit the trigger body to a PL/SQL block that just invokes the procedure, e.g.:
BEGIN
  my_procedure();
END;
or use the CALL statement instead of a PL/SQL block:
CALL my_procedure();


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
(Archive) Database Performance Tuning
How tkprof works for tuning
Import of dump file took 20 hours
Optimize SQL query on table with 50 million records
Windows reporting high number of handles for oracle.exe processes
Performance problems in Unix vs. Windows
Insertion speed goes down with context index
Buffer busy waits on primary key index
Do indexes affect performance of updates and inserts?
Creating partitions on fastest area of disk
Application stops working when analyzing schema

Oracle database performance problems and tuning
Oracle 11g data compression
Varchar or number for better performance?
Do statistics on SYS-owned objects hurt performance in 10g?
Inside the Oracle 11g SQL Performance Advisor, part 1
Inside the Oracle 11g SQL Performance Advisor, part 2
Difference between driving table and driver table in Oracle
Best design for E-Business Suite on hard drive
20GB data dictionary causing performance problems
Using the cost-based optimizer to improve Database 10g performance
Online tablespace reorganization in Oracle 9i

Oracle PL/SQL
Oracle's free SQL Developer adds database migration tool
Confused about Oracle certification exams
ORA-01422 error when procedure returns more than one row
Calling procedure inside another procedure in anonymous block
How to import comma-delimited text file to Oracle table
Oracle updates Microsoft developer tools
PLS-00103 errors
PL/SQL do's and don't's: Five questions with Steven Feuerstein
Definition of force view
ORA-04082: NEW or OLD references not allowed in table level triggers

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
PL/SQL  (SearchOracle.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsTipsAsk the ExpertsWebcastsWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2003 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts