<br />
<b>Warning</b>:  Undefined array key "global_protection_id" in <b>/home/wikitechy/public_html/interview-questions/wp-content/plugins/content-protector/inc/class-ps-rest-handler.php</b> on line <b>51</b><br />
{"id":1135,"date":"2021-07-20T09:28:09","date_gmt":"2021-07-20T09:28:09","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=1135"},"modified":"2021-09-08T11:51:30","modified_gmt":"2021-09-08T11:51:30","slug":"difference-between-procedure-and-function","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/","title":{"rendered":"Difference between Procedure and Function ?"},"content":{"rendered":"<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"difference-between-procedure-and-function\" class=\"color-pink\">Difference between Procedure and Function ?<\/h2>\n<\/div>\n<\/div>\n<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"procedure\" class=\"color-purple\">Procedure<\/h2>\n<\/div>\n<\/div>\n<div class=\"Content\">\n<div class=\"hddn\">\n<ul>\n<li>A procedure is a named PL\/SQL block which performs one or more specific task.This is similar to a procedure in other programming languages.<\/li>\n<li>A procedure has a header and a body.<\/li>\n<li>The\u00a0<b>header<\/b>\u00a0consists of the name of the procedure and the parameters or variables passed to the procedure.<\/li>\n<li>The\u00a0<b>body<\/b>\u00a0consists declaration section, execution section and exception section similar to a general PL\/SQL Block. A procedure is similar to an anonymous PL\/SQL Block but it is named for repeated usage.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"we-can-pass-parameters-to-procedures-in-three-ways\" class=\"color-purple\">We can pass parameters to procedures in three ways<\/h2>\n<\/div>\n<\/div>\n<div class=\"table-responsive\">\n<table class=\"table-bordered table-striped table table-responsive\">\n<tbody>\n<tr>\n<th>Parameters<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>IN type<\/td>\n<td>These types of parameters are used to send values to stored procedures<\/td>\n<\/tr>\n<tr>\n<td>OUT type<\/td>\n<td>These types of parameters are used to get values from stored procedures. This is similar to a return type in functions.<\/td>\n<\/tr>\n<tr>\n<td>IN OUT type<\/td>\n<td>These types of parameters are used to send values and get values from stored procedures.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"syntax\" class=\"color-purple\">Syntax<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-markdown code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markdown code-embed-code\">CREATE [OR REPLACE] PROCEDURE procedure_name (&lt;Argument&gt; {IN, OUT, IN OUT}    &lt;Datatype&gt;,\u2026)  <br\/>IS <br\/>  Declaration section&lt;variable, constant&gt; ; <br\/>BEGIN <br\/>  Execution section <br\/>EXCEPTION <br\/>  Exception section  <br\/>END<\/code><\/pre> <\/div>\n<\/div>\n<\/div>\n<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"functions\" class=\"color-purple\">Functions<\/h2>\n<\/div>\n<\/div>\n<div class=\"Content\">\n<div class=\"hddn\">\n<ul>\n<li>A function is a named PL\/SQL Block which is similar to a procedure.<\/li>\n<li>The major difference between a procedure and a function is, a function must always return a value, but a procedure may or may not return a value.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"syntax-2\" class=\"color-purple\">Syntax<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-markdown code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markdown code-embed-code\">CREATE [OR REPLACE] FUNCTION function_name [parameters]  <br\/> RETURN return_datatype;  {IS, AS} <br\/> Declaration_section &lt;variable,constant&gt; ;<br\/> BEGIN   <br\/>    Execution_section <br\/>    Return return_variable;   <br\/> EXCEPTION <br\/>   exception section   <br\/>    Return return_variable;  <br\/> END;<\/code><\/pre> <\/div>\n<\/div>\n<\/div>\n<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"procedure-vs-function\" class=\"color-purple\">Procedure vs function<\/h2>\n<\/div>\n<\/div>\n<div class=\"table-responsive\">\n<table class=\"table-bordered table-striped table table-responsive\">\n<tbody>\n<tr>\n<th>Procedure<\/th>\n<th>Function<\/th>\n<\/tr>\n<tr>\n<td>Used mainly to a execute certain process.<\/td>\n<td>Used mainly to perform some calculation.<\/td>\n<\/tr>\n<tr>\n<td>Cannot call in SELECT statement.<\/td>\n<td>A Function that contains no DML statements can be called in SELECT statement.<\/td>\n<\/tr>\n<tr>\n<td>Use OUT parameter to return the value.<\/td>\n<td>Use RETURN to return the value.<\/td>\n<\/tr>\n<tr>\n<td>It is not mandatory to return the value.<\/td>\n<td>It is mandatory to return the value.<\/td>\n<\/tr>\n<tr>\n<td>RETURN will simply exit the control from subprogram.<\/td>\n<td>RETURN will exit the control from subprogram and also returns the value.<\/td>\n<\/tr>\n<tr>\n<td>Return datatype will not be specified at the time of creation.<\/td>\n<td>Return datatype is mandatory at the time of creation.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Answer : A procedure is a named PL\/SQL block&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"passster_activate_protection":false,"passster_protect_child_pages":"","passster_protection_type":"password","passster_password":"","passster_activate_overwrite_defaults":"","passster_headline":"","passster_instruction":"","passster_placeholder":"","passster_button":"","passster_id":"","passster_activate_misc_settings":"","passster_redirect_url":"","passster_hide":"no","passster_area_shortcode":"","gtb_hide_title":false,"gtb_wrap_title":false,"gtb_class_title":"","gtb_remove_headerfooter":false,"footnotes":""},"categories":[8028],"tags":[195,201,7760,360,203,199,214,209,283,205,8171,8151,8157,8160,8156,8178,8165,8177,8167,8166,8159,8179,8153,8169,8152,8164,8163,8155,8158,2936,8168,484,8175,8173,196,212,5941,286,207,204,15929,8181,208,206,8170,8154,8180,2677,975,200,8174,197,280,364,8162,8172,8161,8176,968,285,8150],"class_list":["post-1135","post","type-post","status-publish","format-standard","hentry","category-oracle","tag-accenture-interview-questions-and-answers","tag-allstate-solutions-pvt-ltd-interview-questions-and-answers","tag-amdocs-interview-questions-and-answers","tag-atos-interview-questions-and-answers","tag-capgemini-interview-questions-and-answers","tag-casting-networks-india-pvt-limited-interview-questions-and-answers","tag-cgi-group-inc-interview-questions-and-answers","tag-collabera-technologies-interview-questions-and-answers","tag-conduent-interview-questions-and-answers","tag-dell-international-services-india-pvt-ltd-interview-questions-and-answers","tag-difference-between-function-and-cursor","tag-difference-between-function-and-procedure","tag-difference-between-function-and-procedure-in-sql","tag-difference-between-function-and-procedure-in-sql-server","tag-difference-between-function-and-procedure-in-vb","tag-difference-between-function-and-procedure-in-vhdl","tag-difference-between-procedure-and-function-and-package-in-oracle","tag-difference-between-procedure-and-function-in-c","tag-difference-between-procedure-and-function-in-mssql","tag-difference-between-procedure-and-function-in-mysql","tag-difference-between-procedure-and-function-in-oracle","tag-difference-between-procedure-and-function-in-oracle-11g","tag-difference-between-procedure-and-function-in-pl-sql","tag-difference-between-procedure-and-function-in-tabular-form","tag-difference-between-stored-procedure-and-function","tag-difference-between-stored-procedure-and-function-in-mysql","tag-difference-between-stored-procedure-and-function-in-oracle","tag-difference-between-stored-procedure-and-function-in-sql","tag-difference-between-stored-procedure-and-function-in-sql-server","tag-fis-global-business-solutions-india-pvt-ltd-interview-questions-and-answers","tag-functions-and-procedures-in-sql","tag-genpact-interview-questions-and-answers","tag-how-to-call-a-procedure-in-oracle","tag-how-to-create-a-procedure-inside-a-package-in-oraclepl-sql-procedures-and-functions-with-examplere","tag-ibm-interview-questions-and-answers","tag-indecomm-global-services-interview-questions-and-answers","tag-infogain-interview-questions-and-answers","tag-lt-infotech-interview-questions-and-answers","tag-mphasis-interview-questions-and-answers","tag-oracle-corporation-interview-questions-and-answers","tag-polaris-financial-technology-interview-questions-and-answers","tag-procedures-and-functions-in-oracle-with-examples","tag-prokarma-softech-pvt-ltd-interview-questions-and-answers","tag-sap-labs-india-pvt-ltd-interview-questions-and-answers","tag-similarities-between-function-and-procedurestored-procedure-vs-function-in-sql-server-performance","tag-stored-procedure-and-function-difference","tag-subroutines-functions-and-procedures","tag-synechron-technologies-pvt-ltd-interview-questions-and-answers","tag-tata-consultancy-service-interview-questions-and-answers","tag-tech-mahindra-interview-questions-and-answers","tag-turn-in-oracle-stored-procedure","tag-unitedhealth-group-interview-questions-and-answers","tag-virtusa-consulting-services-pvt-ltd-interview-questions-and-answers","tag-wells-fargo-interview-questions-and-answers","tag-what-is-difference-between-stored-procedure-and-function","tag-what-is-stored-procedure-in-oracle","tag-what-is-the-difference-between-function-and-procedure","tag-why-we-use-package-in-oracle","tag-wipro-infotech-interview-questions-and-answers","tag-xoriant-solutions-pvt-ltd-interview-questions-and-answers","tag-zensar-technologies-interview-questions-and-answers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Difference between Procedure and Function ? - Oracle<\/title>\n<meta name=\"description\" content=\"Difference between Procedure and Function ? -A procedure is a named PL\/SQL block which performs one or more specific task.This is similar to a procedure in other programming languages.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Difference between Procedure and Function ? - Oracle\" \/>\n<meta property=\"og:description\" content=\"Difference between Procedure and Function ? -A procedure is a named PL\/SQL block which performs one or more specific task.This is similar to a procedure in other programming languages.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-20T09:28:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-08T11:51:30+00:00\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/\",\"name\":\"Difference between Procedure and Function ? - Oracle\",\"isPartOf\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\"},\"datePublished\":\"2021-07-20T09:28:09+00:00\",\"dateModified\":\"2021-09-08T11:51:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"Difference between Procedure and Function ? -A procedure is a named PL\/SQL block which performs one or more specific task.This is similar to a procedure in other programming languages.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Difference between Procedure and Function ? - Oracle","description":"Difference between Procedure and Function ? -A procedure is a named PL\/SQL block which performs one or more specific task.This is similar to a procedure in other programming languages.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/","og_locale":"en_US","og_type":"article","og_title":"Difference between Procedure and Function ? - Oracle","og_description":"Difference between Procedure and Function ? -A procedure is a named PL\/SQL block which performs one or more specific task.This is similar to a procedure in other programming languages.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/","og_site_name":"Wikitechy","article_published_time":"2021-07-20T09:28:09+00:00","article_modified_time":"2021-09-08T11:51:30+00:00","author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/","name":"Difference between Procedure and Function ? - Oracle","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"datePublished":"2021-07-20T09:28:09+00:00","dateModified":"2021-09-08T11:51:30+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"Difference between Procedure and Function ? -A procedure is a named PL\/SQL block which performs one or more specific task.This is similar to a procedure in other programming languages.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/oracle\/difference-between-procedure-and-function\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/1135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=1135"}],"version-history":[{"count":1,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/1135\/revisions"}],"predecessor-version":[{"id":1139,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/1135\/revisions\/1139"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=1135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=1135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=1135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}