Forum Stats

  • 3,826,044 Users
  • 2,260,590 Discussions
  • 7,896,776 Comments

Discussions

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

1005641
1005641 Member Posts: 3
edited Apr 26, 2013 7:56PM in PHP
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
Tagged:

Answers

This discussion has been closed.