This discussion is archived
1 Reply Latest reply: Apr 26, 2013 4:56 PM by cj RSS

In order to pass pl/sql statements using Oracle Semantic functions in PHP

1005641 Newbie
Currently Being Moderated
Hello~

I am developing android application connected to Oracle database using PHP,

and I use PL/SQL statements with semantic technologies provided in Oracle(specifically, SEM_MATCH, SEM_MODELS, SEM_RULEBASES or something like this).

However, it doesn't work properly...the connection between android and Oracle works well, though. Also, the query statement is implemented well in the sql developer.

The whole php code is shown below :

*<?php*

function db_connect()
*{*
*$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 203.249.105.20)(PORT = 1521)))(CONNECT_DATA=(SID=orcl)))";*

*if ($conn=oci_connect("rdfusr", "rdfusr", $db)){*
echo "Successfully connected to Oracle.<br />\n";

return $conn;
*} else {*
*$err = OCIError();*
*echo "Oracle Connect Error " . $err[text];*
*}*
*}*

*$conn = db_connect();*

*$stid = oci_parse($conn, "SELECT nm.NAME, nm.FLOOR, nm.ROOM_NUM, nm.PHONENUM, nm.FID FROM*
*(SELECT z FROM TABLE(SEM_MATCH('{?y :soldIn ?z}',*
*SEM_Models('shopping_model'),*
*SEM_Rulebases('owlprime','activity_rb'),*
*SEM_ALIASES(SEM_ALIAS('','http://www.example.org/space/')),null))*

*WHERE y = 'http://www.example.org/activity/Carbonara') ont,BUSINESSINFO nm*
*WHERE ont.z = nm.NAME;");*

oci_execute($stid);
*while (($row = oci_fetch_array($stid, OCI_BOTH))) {*
*$output[]=$row;*
*}*

print(json_encode($output));

oci_free_statement($stid);
oci_close($conn);

*?>*

Please, give me any kinds of methods working well...thanks in advance

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points