EnterpriseDB/PostgresPlus

EnterpriseDB/PostgresPlus supports PL/SQL: the JDBC drivers may be installed from the PostgresPlus installation. Alternatively, the standard Postgres JDBC drivers may be used.

Source code loaded via edbplus has comments stripped and thus has no PLDoc comments; the DBA_SOURCE table is similar to Oracle's view of the same name.

In order to retrieve the source code as a single Java object, each line in the tables must be concatenated. Try something like the code below:

 CREATE OR REPLACE FUNCTION get_source 
  /** 
   *Return PostgresPlus PLSQL source code as a VARCHAR2. 
   *
   *<p>This function apes DBMS_METADATA.GET_DDL, so must take 6 parameters; currently only the 
   *P_OBJECT_TYPE, `P_OBJECT_NAME, `P_OWNER parameters are used.
   *</p>
   *<p><b><u>Because this function returns a VARCHAR2, this function will return a maximum of 4MB.</u></b></p>
   *
   *@param p_object_type Object Type
   *@param p_object_name Object Name 
   *@param p_owner Object Owner 
   *@param p_version Object Version 
   *@param p_model  Object Model 
   *@param p_transform Required Return format 
   *@return Object Source as a VARCHAR2(up to 4MB in TimesTen) 
   */
 (p_object_type VARCHAR2
 ,p_object_name VARCHAR2
 ,p_owner VARCHAR2
 ,p_version     IN VARCHAR2 DEFAULT 'COMPATIBLE'
 ,p_model       IN VARCHAR2 DEFAULT 'ORACLE'
 ,p_transform   IN VARCHAR2 DEFAULT 'DDL'
 )
 RETURN VARCHAR2 
 AS
  l_object_type  VARCHAR2(30) ;
  l_source  VARCHAR2(32767) := '';
  CURSOR c_source IS
  SELECT text 
  FROM dba_source 
  WHERE type =  p_object_type 
  AND name = p_object_name 
  AND owner = p_owner 
  ;
 BEGIN
         --As the passed parameters are designed for DBMS_METADATA.GET_DDL, 
         --this function must convert Object Types such as 'PACKAGE_BODY' back to 'PACKAGE BODY') 
         l_object_type := CASE p_object_type
                         WHEN 'PACKAGE_BODY' THEN 'PACKAGE BODY'
                         WHEN 'PACKAGE_SPEC' THEN 'PACKAGE'
                         WHEN 'TYPE_BODY' THEN 'TYPE BODY'
                         WHEN 'TYPE_SPEC' THEN 'TYPE'
                         ELSE p_object_type
                         END;
        FOR rec_source IN c_source 
        LOOP
                l_source := 
                        CASE l
                        WHEN 1 THEN  rec_source.text
                        ELSE l_source || rec_source.text
                        END;
                END LOOP;
        RETURN l_source ;
 END get_source;
 /

 SHOW ERRORS