For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2004 > Re: PHP and Oracle - sql problem ????









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: PHP and Oracle - sql problem ????
Andy Hassall

2004-03-19, 12:57 pm

On Fri, 19 Mar 2004 16:32:10 +0100, "Yukiko" <yukiko@idea_dot_net.pl> wrote:

>
>$wer="select cen_detal('021076', 'A', 'CN', 'B', 1, 'PLN') as KOD_P from
>
>Warning: ociexecute(): OCIStmtExecute: ORA-00904: invalid column name in
>/usr/local/apache/htdocs/dual.php on line 36
>
>Warning: ocifetch(): OCIFetch: ORA-24374: define not done before fetch or
>execute and fetch in /usr/local/apache/htdocs/dual.php on line 38


[ Also crossposted to alt.comp.lang.php to join up with the thread there ]

You can get more information out using ocierror. Your code is currently:

$stmt = ociparse($conn, $wer);
ociexecute($stmt);
while (ocifetch($stmt))
{
$a=ociresult($stmt,"KOD_P");
echo "$a<br>";
}

Try the following:

$stmt = ociparse($conn, $wer);
if (!$stmt) {
var_dump(ocierror());
die();
}
if (!ociexecute($stmt)) {
var_dump(ocierror($stmt));
die();
}

One of the things displayed should be 'offset', if you have a recent enough
PHP, from this you can see the position in the SQL that raised the error.

It's probably 'cen_detal' though, since that's the only identifier.

Is this a function?
Are you connected as the same user as when you tried with PL/SQL Developer?

--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Yukiko

2004-03-26, 11:12 pm

>
> Try the following:
>
> $stmt = ociparse($conn, $wer);
> if (!$stmt) {
> var_dump(ocierror());
> die();
> }
> if (!ociexecute($stmt)) {
> var_dump(ocierror($stmt));
> die();
> }
>
> One of the things displayed should be 'offset', if you have a recent

enough
> PHP, from this you can see the position in the SQL that raised the error.
>
> It's probably 'cen_detal' though, since that's the only identifier.
>
> Is this a function?
> Are you connected as the same user as when you tried with PL/SQL

Developer?
>
> --


of course cen_detal is a function
acording Your hint - error is:

Warning: ociexecute(): OCIStmtExecute: ORA-00904: invalid column name in
/usr/local/apache/htdocs/dual.php on line 43
array(4) { ["code"]=> int(904) ["message"]=> string(31) "ORA-00904: invalid
column name " ["offset"]=> int(7) ["sqltext"]=> string(82) "select
cen_detal( '021076' , ' A' , 'CN' , 'B' , '1' , 'PLN' ) as Y from dual" }

BTH

big big big thanks for Your priceless time

Jarek Lotz










Andy Hassall

2004-03-26, 11:13 pm

On Mon, 22 Mar 2004 13:21:20 +0100, "Yukiko" <yukiko@idea_dot_net.pl> wrote:

>enough
>Developer?
>
>of course cen_detal is a function
>acording Your hint - error is:
>
>Warning: ociexecute(): OCIStmtExecute: ORA-00904: invalid column name in
>/usr/local/apache/htdocs/dual.php on line 43
>array(4) { ["code"]=> int(904) ["message"]=> string(31) "ORA-00904: invalid
>column name " ["offset"]=> int(7) ["sqltext"]=> string(82) "select
>cen_detal( '021076' , ' A' , 'CN' , 'B' , '1' , 'PLN' ) as Y from dual" }


OK, how about the other question?
[color=darkred]

--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com