Edit D:\app\Administrator\product\11.2.0\dbhome_1\oc4j\j2ee\oc4j_applications\applications\em\em\online_help\tdddg\tdddg_subprograms007.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <script src="./callback.js" type="text/javascript"></script> <noscript>Your browser does not support JavaScript. This help page requires JavaScript to render correctly.</noscript> </head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1.1 Build 005" /> <meta name="date" content="2009-04-21T9:46:24Z" /> <meta name="robots" content="noarchive" /> <meta name="doctitle" content="Tutorial: Creating a Standalone Stored Procedure" /> <meta name="relnum" content="11g Release 2 (11.2)" /> <meta name="partnum" content="E10766-01" /> <link rel="copyright" href="./dcommon/html/cpyr.htm" title="Copyright" type="text/html" /> <link rel="stylesheet" href="./dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" /> <link rel="contents" href="toc.htm" title="Contents" type="text/html" /> <link rel="prev" href="tdddg_subprograms006.htm" title="Previous" type="text/html" /> <link rel="next" href="tdddg_subprograms008.htm" title="Next" type="text/html" /> <title>Tutorial: Creating a Standalone Stored Procedure</title> </head> <body> <div class="zz-skip-header"><a href="#BEGIN">Skip Headers</a></div> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr valign="bottom"> <td align="left"></td> <td align="center"><a href="tdddg_subprograms006.htm"><img width="24" height="24" src="./dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="tdddg_subprograms008.htm"><img width="24" height="24" src="./dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> <p><a id="BABDHFAC" name="BABDHFAC"></a><a id="TDDDG99975" name="TDDDG99975"></a></p> <div class="sect2"> <h1>Tutorial: Creating a Standalone Stored Procedure</h1> <a name="BEGIN" id="BEGIN"></a> <p>To create a <a id="sthref354" name="sthref354"></a>standalone stored procedure, use either the SQL Developer tool <a id="sthref355" name="sthref355"></a>Create PL/SQL Procedure or the DDL statement <a id="sthref356" name="sthref356"></a><code>CREATE</code> <code>PROCEDURE</code>.</p> <p>This tutorial shows how to use the Create PL/SQL Procedure tool to create a standalone stored procedure named <a id="sthref357" name="sthref357"></a><code>ADD_EVALUATION</code> that adds a row to the <code>EVALUATIONS</code> table (created in <a href="tdddg_objects007.htm#BABEECGC">"Creating Tables with the CREATE TABLE Statement"</a>).</p> <a id="TDDDG215" name="TDDDG215"></a> <p class="subhead2">To create a standalone stored procedure using Create PL/SQL Procedure tool:</p> <ol> <li> <p>On the Connections tab, expand <span class="bold">hr_conn</span>.</p> <p>Under the <code>hr_conn</code> icon, a list of schema object types appears.</p> </li> <li> <p>Right-click <span class="bold">Procedures</span>.</p> <p>A list of choices appears.</p> </li> <li> <p>Click <span class="bold">New Procedure</span>.</p> <p>The Create PL/SQL Procedure window opens.</p> </li> <li> <p>For Schema, accept the default value, <code>HR</code>.</p> </li> <li> <p>For Name, change <code>PROCEDURE1</code> to <code>ADD_EVALUATION</code>.</p> </li> <li><a id="BABJCIIF" name="BABJCIIF"></a> <p>Click the icon <span class="bold">Add Column</span>.</p> <p>A row appears under the column headings. Its fields have these default values: Name, <code>param1</code>; Type, <code>VARCHAR2</code>; Mode, <code>IN</code>; Default Value, empty.</p> </li> <li> <p>For Name, change <code>param1</code> to <code>evaluation_id</code>.</p> </li> <li> <p>For Type, select <code>NUMBER</code> from the drop-down list.</p> </li> <li> <p>For Mode, accept the default value, <code>IN</code>.</p> </li> <li><a id="BABFCHHF" name="BABFCHHF"></a> <p>Leave Default Value empty.</p> </li> <li> <p>Add a second parameter by repeating steps <a href="#BABJCIIF">6</a> through <a href="#BABFCHHF">10</a> with the Name <code>employee_id</code> and the Type <code>NUMBER</code>.</p> </li> <li> <p>Add a third parameter by repeating steps <a href="#BABJCIIF">6</a> through <a href="#BABFCHHF">10</a> with the Name <code>evaluation_date</code> and the Type <code>DATE</code>.</p> </li> <li> <p>Add a fourth parameter by repeating steps <a href="#BABJCIIF">6</a> through <a href="#BABFCHHF">10</a> with the Name <code>job_id</code> and the Type <code>VARCHAR2</code>.</p> </li> <li> <p>Add a fifth parameter by repeating steps <a href="#BABJCIIF">6</a> through <a href="#BABFCHHF">10</a> with the Name <code>manager_id</code> and the Type <code>NUMBER</code>.</p> </li> <li> <p>Add a sixth parameter by repeating steps <a href="#BABJCIIF">6</a> through <a href="#BABFCHHF">10</a> with the Name <code>department_id</code> and the Type <code>NUMBER</code>.</p> </li> <li> <p>Add a seventh parameter by repeating steps <a href="#BABJCIIF">6</a> through <a href="#BABFCHHF">10</a> with the Name <code>total_score</code> and the Type <code>NUMBER</code>.</p> </li> <li> <p>Click <span class="bold">OK</span>.</p> <p>The <code>ADD_EVALUATION</code> pane opens, showing the <code>CREATE</code> <code>PROCEDURE</code> statement that created the procedure.</p> <p>Because the only statement in the execution part of the procedure is <code>NULL</code>, the procedure does nothing.</p> </li> <li> <p>Replace <code>NULL</code> with this statement:</p> <pre xml:space="preserve" class="oac_no_warn"> INSERT INTO EVALUATIONS ( evaluation_id, employee_id, evaluation_date, job_id, manager_id, department_id, total_score ) VALUES ( ADD_EVALUATION.evaluation_id, ADD_EVALUATION.employee_id, ADD_EVALUATION.evaluation_date, ADD_EVALUATION.job_id, ADD_EVALUATION.manager_id, ADD_EVALUATION.department_id, ADD_EVALUATION.total_score ); </pre> <p>(Qualifying the parameter names with the procedure name ensures that they are not confused with the columns that have the same names.)</p> <p>The title of the <code>ADD_EVALUATION</code> pane is in italic font, indicating that the procedure is not yet saved in the database.</p> </li> <li> <p>From the File menu, select <span class="bold">Save</span>.</p> <p>Oracle Database compiles the procedure and saves it. The title of the <code>ADD_EVALUATION</code> pane is no longer in italic font.</p> </li> </ol> <div class="helpinfonotealso"> <h2>Related Topics</h2> <p><a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=RPTUG20600','newWindow').focus()"><span class="italic">Oracle Database SQL Developer User's Guide</span></a></p> <p><a href="tdddg_objects001.htm#CIHGAJDJ">About Data Definition Language (DDL) Statements</a></p> <p><a href="javascript:open('http://www.oracle.com/pls/db112/lookup?id=LNPLS01373','newWindow').focus()"><span class="italic">Oracle Database PL/SQL Language Reference</span></a></p> <p><a href="tdddg_subprograms005.htm#CIHCHIDB">Creating and Managing Standalone Stored Subprograms</a></p> </div> </div> <!-- class="sect2" --> <!-- Start Footer --> <div class="footer"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr> <td align="left"><span class="copyrightlogo">Copyright © 1996, 2009, Oracle and/or its affiliates. All rights reserved.</span><br /> <a href="./dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td> <td align="center"><a href="tdddg_subprograms006.htm"><img width="24" height="24" src="./dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="tdddg_subprograms008.htm"><img width="24" height="24" src="./dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> </div> <!-- class="footer" --> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de