Till now you worked with sub-programs, which are already very good. Let us consider the following situations:
And so on. There is no way we can stop them. The problem is with the "file system." Till now, we have always been working with separate files. Let us shift our development to the database server itself! We shall now use the same procedures we developed earlier and create a "package" within the database (so that it never gets removed without proper permissions). This "package" would now be re-usable, secured, portable and well maintainable! If you are new to packages, I request that you read my article at http://www.devshed.com/c/a/Oracle/Database-Interaction-with-PLSQL- The next section gives you the entire source code for working with packages. The final best approach to working professionally and safely with encapsulation: the code The following would be the code for what we discussed in previous section. create or replace package year_profit as procedure add_profit(year number, amount number); end year_profit; procedure add_profit(year number, amount number) as procedure delete_profit(year number) as procedure print_profits as procedure print_total_profit as procedure delete_all as begin dbms_output.put_line('-----------------'); This completes our series on associative arrays in PL/SQL. Any comments, suggestions, feedback, bugs, errors, enhancements are highly appreciated at jag_chat@yahoo.com
blog comments powered by Disqus |
|
|
|
|
|
|
|