Select the source code from USER_SOURCE : user_source « System Tables Data Dictionary « Oracle PL/SQL Tutorial






SQL>
SQL> SET SERVEROUTPUT ON PAGES 9999
SQL>
SQL> CREATE OR REPLACE PROCEDURE compile_by_version
  2  IS
  3
  4  BEGIN
  5     $IF DBMS_DB_VERSION.VER_LE_10_2
  6     $THEN
  7        DBMS_OUTPUT.PUT_LINE('10.2 and under');
  8     $ELSIF DBMS_DB_VERSION.VER_LE_10_1
  9     $THEN
 10        DBMS_OUTPUT.PUT_LINE('10.1 and under');
 11     $ELSE
 12        DBMS_OUTPUT.PUT_LINE('Not 10g');
 13     $END
 14
 15  END;
 16  /

Procedure created.

SQL>
SQL> SELECT TEXT
  2  FROM USER_SOURCE
  3  WHERE NAME = 'COMPILE_BY_VERSION';

TEXT
------------------------------------------------------------------------------------------------------------------------
PROCEDURE compile_by_version
IS

BEGIN
   $IF DBMS_DB_VERSION.VER_LE_10_2
   $THEN
      DBMS_OUTPUT.PUT_LINE('10.2 and under');
   $ELSIF DBMS_DB_VERSION.VER_LE_10_1
   $THEN
      DBMS_OUTPUT.PUT_LINE('10.1 and under');
   $ELSE
      DBMS_OUTPUT.PUT_LINE('Not 10g');
   $END

END;

15 rows selected.








30.97.user_source
30.97.1.Select the source code from USER_SOURCE
30.97.2.Get source code of procedure and function
30.97.3.Query the Oracle data dictionary view USER_SOURCE
30.97.4.When you do a search in the Oracle data dictionary, all object names are in uppercase
30.97.5.Query user_source for procedure declaration