Page 1 of 1

cannot use keyset-driven cursor join?

Posted: Tue May 06, 2003 6:32 am
by saleemkhan
hi all,
i am using odbc method to fetch data from oracle.
i am using aggregate(min,max,ceil,nvl) function in my sql query.

if i use aggregate functions i am gettting the follwing error.


Warning: SQL error: [Microsoft][ODBC driver for Oracle]Cannot use Keyset-driven cursor on join, with distinct clause, union, intersect or minus or on read only result set, SQL state S1C00 in SQLExecDirect in c:\apache\htdocs\strk.php on line 21

Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in c:\apache\htdocs\strk.php on line 24

any one have any idea where i am wrong.

Posted: Wed May 07, 2003 2:18 am
by []InTeR[]
Is the ODCB driver in readonly, or read and write?

Posted: Wed May 07, 2003 2:25 am
by saleemkhan
hi,
i dont know that the driver is readonly or not.how to check the driver is ready only?

and for ur information here is the sql query i am using

$query = " select 'Periods', sum(decode(xyz,1,1)) one_day_and_less , sum(decode(xyz,2,1))

two_days, sum(decode(xyz,3,1)) three_days, sum(decode(xyz,4,1)) four_days, sum(decode(xyz,5,1)) five_days ,

sum(decode(xyz,1,0,2,0,3,0,4,0,5,0,1)) six_days_and_more
from
(select
s.ord_id,
min(decode(s.a,1,s.b)) str_dt,
max(decode(s.a,3,s.b)) instl_dt,
nvl(max(decode(s.a,20,decode(s.ab,1,sysdate,s.end_dt))) -

min(decode(s.a,20,decode(s.ab,1,sysdate,s.start_dt))),0) wait,
ceil(max(decode(s.a,3,s.start_dt))- min(decode(s.a,1,s.start_dt))) POS_DUR,
ceil(max(decode(s.a,3,s.start_dt))- min(decode(s.b,1,s.start_dt))-
nvl(max(decode(s.a,20,decode(s.ab,1,sysdate,s.end_dt))) -

min(decode(s.trk_sts,20,decode(s.trk_seq_nr,1,sysdate,s.start_dt))),0)) acb
from table1 s , table2 b
group by s.ord_id
having max(decode(s.a,3,trunc(s.start_dt,'month'))) =trunc(sysdate,'month')
)
";

$result = odbc_exec($connect, $query);

# fetch the data from the database
while(odbc_fetch_row($result) ) {
$x = odbc_result($result, 1);
$surname = odbc_result($result, 2);
print("$x $surname <BR>\n\n");
}


so any idea where i am wrong??

Posted: Wed May 07, 2003 4:01 am
by saleemkhan
hi all,
i solved the problem.
In my odbc_connect i havent used cursor_type parameter.

now go through the help and found that better to use SQL_CUR_USE_ODBC


below one is correct and works fine for all my queries.

odbc_connect ("datasouce","myname", "mypassword", SQL_CUR_USE_ODBC)


thanks.