Re: Oracle query returning values in sqlplus, but not php.
| From: | Lang Sharpe | Date: | Thu, 03 Jul 2003 23:32:48 +0000 |
| Subject: | Re: Oracle query returning values in sqlplus, but not php. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-29065@lists.php.net to get a copy of this message | ||
Upon further investigation, I've found that this was a permissions problem.
In oracle, a user can see everybody's 'PACKAGE', but only their own
'PACKAGE BODY'.
Lang
Lang Sharpe wrote:
> Hi all
>
> Here is a test version of my script. It queries the data dictionary view
> ALL_SOURCE. In sqlplus it returns all souce code in the database. In php
> it returns no rows.
>
> The only odd thing about it is that ALL_SOURCE.TYPE is VARCHAR2(12), and
> 'PACKAGE BODY' is twelve characters long. When I change 'PACKAGE BODY' to
> 'PACKAGE', it does return rows.
>
> <?php
> error_reporting(E_ALL);
> $oradb = OCILogon('****','****','****');
>
> $packageStmt = OCIParse($oradb,
> "SELECT * FROM ALL_SOURCE WHERE TYPE = 'PACKAGE BODY'");
> OCIExecute($packageStmt);
> if(OCIFetchInto($packageStmt,$aLine,OCI_ASSOC)) {
> echo "Cool Bananas\n";
> var_dump($aLine);
> } else {
> echo "No Bananas\n";
> }
>
> OCILogoff($oradb);
> ?>
>
> Im using PHP 4.3.2 Linked to Oracle 9.2.0.1.0 libraries connecting to
> oracle 9.2.0.1.0 database on another machine. Can someone confirm it is
> only me?
>
> Lang