DESCRIPTION

I would like to see the underlying code for some of the SQL functions that come with Biotics (there are some syntax issues that I could learn simply by looking at working functions). How can I list the code for these?


RESOLUTION

The easiest way to look at the code for functions, triggers, views, stored procedures, etc. is to use a third party database tool, such as Toad, Tora, dbVisualizer or SQL Developer (which comes with Oracle, so that might be even easier). You can then use the GUI to see the database objects in a browser, and then see the underlying code. You'll find this extremely helpful in learning PL/SQL. You'll also gain an appreciation for those that add comments to their functions!

In addition, if you don't have a 3rd party tool, you can also query the USER_SOURCE view in Oracle. Each line of code in an Oracle trigger, function, or stored procedure has a row in this view. For example, if you wanted to see the code behind the function GET_FIRST_FOUR_DIGITS, you'd do this:
 

SELECT * FROM USER_SOURCE WHERE NAME = 'GET_FIRST_FOUR_DIGITS';


You'll get back a row for each line of code. Not as easy to look at, but It can be helpful.