Re: oraperl, ora_fetch doesn't recognize array context
Date: 1995/06/02
Message-ID: <YOUNG.95Jun2160402_at_clone4.sura.net>#1/1
i'm having trouble with ora_fetch also, although it sounds unrelated. i'm trying to do a fetch on a select statement with a WHERE clause. In the end, I'd like the object of the WHERE clause to be variable.
Here are the &ora_open and &ora_fetch statements with static WHERE clause object (this works):
DB<2> $csr_customer=&ora_open($lda,'select c.cust_id from
customers c where c.cust_name=\'Casper Star Tribune\'');
DB<3> print &ora_fetch($csr_customer);
261
and this is correct.
but if i try to make the object of the WHERE clause variable:
DB<4> $foo="'Casper Star Tribune'";
DB<5> $csr_customer=&ora_open($lda,'select c.cust_id from customers c where c.cust_name=$foo');
DB<6> print &ora_fetch($csr_customer);
or:
DB<7> $foo="Casper Star Tribune";
DB<8> $csr_customer=&ora_open($lda,'select c.cust_id from customers c where c.cust_name=\`$foo\'');
DB<9> print &ora_fetch($csr_customer);
just check $foo to be sure:
DB<10> print $foo
Casper Star Tribune
finally, in despiration:
DB<11> $csr_customer=&ora_open($lda,'select c.cust_id from customers c where c.cust_name=\`"$foo"\'');
DB<12> print &ora_fetch($csr_customer);
and:
$csr_customer=&ora_open($lda,'select c.cust_id from customers c where c.cust_name=:1');
$ret=&ora_bind($csr_customer,$ARGV[0]);
print($ret);
print($ora_errno);
_at_match=&ora_fetch($csr_customer);
print($ora_errno);
print("_at_match");
help....
thanks.
-- Jeff Young young_at_mci.netReceived on Fri Jun 02 1995 - 00:00:00 CEST