[lug] php/oracle question (somewhat OT)

D. Stimits stimits at idcomm.com
Mon Jun 17 14:12:03 MDT 2002


Chip Atkinson wrote:
> 
> Same error, quoting or not.  I am starting to wonder if php was built
> improperly somehow or that there are config issues.
> 
> Chip
> On Mon, 17 Jun 2002, D. Stimits wrote:
> 
> > Chip Atkinson wrote:
> > >
> > > Posting the code is a good idea, I'll do that below.  I've used php/mysql
> > > before and really liked it, probably due to the ease of use. :-)
> > > The php code below using oracle have been giving me fits though.
> > >
> > > TIA,
> > >
> > > Chip
> > >
> > > $conn = ora_logon("user", "password"); // Not the real values here of course
> > >
> > > $query = "SELECT
> > >             acct acct, name, docdt, docnm, ROWID
> > >           FROM
> > >             onlstm_cont c
> > >           WHERE
> > >             acct=1111 and cu='abcd'
> > >           ORDER BY
> > >             name, acct,ssn, docdt, docnm";
> > >
> > > /* This one seems to work if there is only one row.
> > >  * If more than one row, we get an oracle error, 1422,
> > >  * exact fetch returns more than requested number of rows.
> > >  */
> > > $query2 = "declare tmp char(40);

Without knowing specifics of both php and oracle, I would still be
suspicious of a single temp variable of 40 characters width being used
to select multiple results into it. So aside from the quoting, perhaps
the temp variable holding only one value. It wouldn't give you all the
answers in a single variable, but if you do a test by selecting into a
temp table instead of a variable, and the error goes away, you can
probably bet the :tmp is the problem. So maybe instead of a char(40) use
a table instead just to see if the error goes away; you can even create
a non-temp table so you can examine it.

D. Stimits, stimits at idcomm.com

> > >            begin
> > >              select ufsnm into :tmp from onlstm_cont
> > >              where acct=1111 and cu='abcd';
> > >           end;";
> > ...
> >
> > Just a guess since I don't know anything about oracle, but does the
> > error change when you also quote the acct value, e.g., account='1111'?
> >
> > D. Stimits, stimits at idcomm.com



More information about the LUG mailing list