5 Replies Latest reply: May 30, 2014 1:08 PM by chris227 RSS

    Using DBMS_XDBRESOURCE without DBMS_XDB.GETRESOURCE

    soutou

      With Oracle 12c and following

      Using DBMS_XDBRESOURCE

       

      I would like instanciate a resource object to use GETCONTENTTYPE Function

      without using DBMS_XDB FUNCTION GETRESOURCE because DBMS_XDB is declared deprecated

      and no function GETRESOURCE exist in DBMS_XDB_REPOS.

       

      The following is OK but how avoid DBMS_XDB.GETRESOURCE ?

       

      SQL> DECLARE

        2     v_xml    XMLTYPE;

        3     v_CLOB   CLOB;

        4     v_res    DBMS_XDBRESOURCE.XDBResource;

        5     v_path   resource_view.any_path%type := '/home/OXM/general/compagnie.xml';

        6  BEGIN

        7  -- loading v_res WITHOUT DBMS_XDB.GETRESOURCE

        8     v_res    := DBMS_XDB.GETRESOURCE(v_path);

        9     v_CLOB   := DBMS_XDBRESOURCE.GETCONTENTCLOB(v_res) ;

      10     v_xml    := DBMS_XDBRESOURCE.GETCONTENTXML(v_res);

      11  END;

      12  /

       

      ProcÚdure PL/SQL terminÚe avec succÞs.

        • 1. Re: Using DBMS_XDBRESOURCE without DBMS_XDB.GETRESOURCE
          chris227

          soutou wrote:

           

          and no function GETRESOURCE exist in DBMS_XDB_REPOS.

           

             

          That should have made you think.

          Not only it doesnt exist in dbms_xdb_repos but it didnt exist in DBMS_XDB neither.

           

          DBMS_XDBRESOURCE is a separate package, cant see that it is deprecated

           

          DBMS_XDBRESOURCE

          • 2. Re: Using DBMS_XDBRESOURCE without DBMS_XDB.GETRESOURCE
            soutou

            OK but why in line

            8 v_res:= DBMS_XDB.GETRESOURCE(v_path);

            GETRESOURCE returns a correct value without being defined in the package ?

            • 3. Re: Using DBMS_XDBRESOURCE without DBMS_XDB.GETRESOURCE
              chris227

              Right, it seems to be undocumented.

              May be the recommanded way is to use the RESOURCE_VIEW:

               

              SELECT r.RES.getCLOBVal()  FROM RESOURCE_VIEW where

              • 4. Re: Using DBMS_XDBRESOURCE without DBMS_XDB.GETRESOURCE
                Marco Gralike

                Eh... a describe in my 12.1.0.1.0 database shows:

                 

                 

                SQL> describe DBMS_XDB_REPOS

                 

                ...

                ...

                PROCEDURE GETLOCKTOKEN

                Argument Name            Type            In/Out Default?

                ------------------------------ ----------------------- ------ --------

                ABSPATH            VARCHAR2        IN

                LOCKTOKEN            VARCHAR2        OUT

                FUNCTION GETLOCKTOKENLIST RETURNS LOCKTOKENLISTTYPE

                FUNCTION GETPRIVILEGES RETURNS XMLTYPE

                Argument Name            Type            In/Out Default?

                ------------------------------ ----------------------- ------ --------

                RES_PATH            VARCHAR2        IN

                FUNCTION GETRESOID RETURNS RAW

                Argument Name            Type            In/Out Default?

                ------------------------------ ----------------------- ------ --------

                ABSPATH            VARCHAR2        IN

                FUNCTION GETRESOURCE RETURNS RECORD

                Argument Name            Type            In/Out Default?

                ------------------------------ ----------------------- ------ --------

                   ID                RAW(13)         OUT

                ABSPATH            VARCHAR2        IN

                FUNCTION GETXDB_TABLESPACE RETURNS VARCHAR2

                FUNCTION HASBLOBCONTENT RETURNS BOOLEAN

                Argument Name            Type            In/Out Default?

                ------------------------------ ----------------------- ------ --------

                ABSPATH            VARCHAR2        IN

                FUNCTION HASCHARCONTENT RETURNS BOOLEAN

                Argument Name            Type            In/Out Default?

                ------------------------------ ----------------------- ------ --------

                ABSPATH            VARCHAR2        IN

                 

                ...

                ...

                 

                And yes, AFAIK/could see, this is undocumented, but I am guessing more a update documentation error/issue than really a "undocumented" feature.

                • 5. Re: Using DBMS_XDBRESOURCE without DBMS_XDB.GETRESOURCE
                  chris227

                  In fact now i found it mysef to:

                   

                  http://docs.oracle.com/cd/E16655_01/appdev.121/e17603/xdb19rpl.htm#ADXDB5441

                   

                  It returns DBMS_XDBRESOURCE.XDBResource as dbms_xbb.getresource does.