The following is the code which simply deletes a row from the table based on the employee number sent to it: create or replace procedure p_emp_delete (p_empno emp.empno%type) as You can understand that the above code is very similar to the “p_emp_update” code given in previous section. Now we shall proceed with retrieving information. There exist several methods for retrieving information available within an Oracle database. If you would like to retrieve one or very few definite values, then it is advisable to proceed with OUT parameters. If you would like to retrieve an entire row (or set of rows), it is preferable to work with REF CURSORS. If you require more information about REF CURSORS, I have already contributed a separate article on REF CURSORS, which you can easily find on this web site. Now, in this scenario, I shall simply proceed with retrieving a set of values using OUTPUT parameters. create or replace procedure p_emp_details(p_empno emp.empno%type, In the above stored procedure, you can observe that all the parameters (except p_empno) are OUTPUT parameters. They are mainly used to push the data OUT of the stored procedure to the calling program. To execute the above stored procedure, you may have to use a separate script (or PL/SQL block) as follows: declare The above script simply declares a few variables to hold the values returned by the stored procedure. My next article will look into the aspects of retrieving multiple rows using REF CURSOR, packages, helper routines etc. My further upcoming articles will deal with DAL (Data Access Layer) using ODP.NET together with ASP.NET to access these stored procedures (for www.aspfree.com). I hope you enjoyed this article and any comments, suggestions, feedback, bugs, errors, enhancements etc. are highly appreciated at http://jagchat.spaces.live.com
blog comments powered by Disqus |