{"id":19,"date":"2020-01-10T12:00:40","date_gmt":"2020-01-10T12:00:40","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=19"},"modified":"2024-02-09T13:39:19","modified_gmt":"2024-02-09T18:39:19","slug":"what-is-an-oracle-package","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/what-is-an-oracle-package\/","title":{"rendered":"What is an Oracle Package"},"content":{"rendered":"\n<p>A package is an encapsulated collection of related PL\/SQL types, objects, procedures, and other program objects. Packages have a package specification and a package body. Package specification declares constants, variables, types, cursors, exceptions and procedures. Package definition defines cursors and procedures.<\/p>\n\n\n\n<p>Packages provide the advantages of modularity, information hiding, and encapsulation.<\/p>\n\n\n\n<p><em>Package commands<\/em>&nbsp;To create a package<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE PACKAGE package_name<\/code><\/pre>\n\n\n\n<p>To create package body<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE PACKAGE_BODY package_body_name<\/code><\/pre>\n\n\n\n<p>To change a package<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER PACKAGE package_name options<\/code><\/pre>\n\n\n\n<p>To delete a package<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Drop PACKAGE package_name<\/code><\/pre>\n\n\n\n<p>To override an existing package<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE OR REPLACE package_name<\/code><\/pre>\n\n\n\n<p>This command would recreate a package if it already exists. It maintains objects and privileges of the older package.<\/p>\n\n\n\n<p><em>Permissions<\/em>&nbsp;You require:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>CREATE PROCEDURE system privilege to create a package in your schema.<\/li><li>you require the CREATE ANY PROCEDURE system privilege to create a package in another user&#8217;s schema<\/li><\/ul>\n\n\n\n<p><em>Examples<\/em><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PACKAGE package_name IS\n  TYPE ...\n  CURSOR ... \n  Procedure ...\nEND package_name;\n\nPACKAGE BODY package_body_name IS\n  CURSOR ...\n  PROCEDURE ...\nEND package_body_name;<\/code><\/pre>\n\n\n\n<p>Packages cannot be nested.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A package is an encapsulated collection of related PL\/SQL types, objects, procedures, and other program objects. Packages have a package specification and a package body. Package specification declares constants, variables, types, cursors, exceptions and procedures. Package definition defines cursors and procedures. Packages provide the advantages of modularity, information hiding, and encapsulation. Package commands&nbsp;To create a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,515],"tags":[14,3],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-database","category-oracle","tag-database","tag-oracle"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":20,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/19\/revisions\/20"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}