Publishing PL/SQL Functions/Procedures

Let’s learn how to publish PL/SQL functions and procedures as Web Services using the Oracle XML DB Web Services.

Creating PL/SQl Packages and Functions

First, we create a PL/SQL package with the check_transactions() function that checks the transaction data (create_trading_pkg.sql):

CREATE OR REPLACE PACKAGE trading_pkg AS

     FUNCTION check_transactions(p_uname IN VARCHAR2,p_pwd IN VARCHAR2) RETURN XMLType;

END trading_pkg;

/

CREATE OR REPLACE PACKAGE body trading_pkg AS

     FUNCTION check_transactions(p_uname IN VARCHAR2,p_pwd IN VARCHAR2) RETURN XMLType

     AS

          v_out xmltype :=xmltype(‘<null/>’);

          v_md5key raw(16);

     BEGIN

          SELECT c.client_pwd INTO v_md5key FROM client_tbl ...

Get Oracle Database 11g Building Oracle XML DB Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.