Execute SQL query from OSB 11g Xquery file

Hello,

below snap shot of code is just for reference. I recently had a requirement where I had to execute a SQL query in XQuery file and same should be returning some result.

Eventually objective here is to use an existing xquery function fn-bea:execute-sql().

Here with below code, I would be getting a shipment id from request and using that, I need to call a DB query and evaluate the result

xquery version "1.0" encoding "Cp1252";

declare namespace xf = "http://tempuri.org/testprocess/PUB/trans/ClientRef/";

declare function xf:EmpRef($dummydata as xs:string,
$shipmentId as xs:string)
as xs:string {
let $sql-string := "SELECT client_info FROM client_table WHERE SHIPMENT_ID=? and ROWNUM 0) then
fn:data($empRef)
else
fn:data('no data')

};

declare variable $dummydata as xs:string external;
declare variable $ShipmentId as xs:string external;

xf:ClientRef($dummydata ,
$ShipmentId)

Advertisements
This entry was posted in OSB and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s