Hi Tim,
I manage to obtain the trace log and located the section where the error
begins as follows:
============================================================================
================================
-> execute for DBD::Sybase::st (DBI::st=HASH(0x1d73dc)~0x1e4ddc '2435'
'16' '19971208')
bind :p1 <== '2435' (attribs: )
bind :p1 <== '2435' (size 4/5/0, ptype 4, otype 0)
bind :p2 <== '16' (attribs: )
bind :p2 <== '16' (size 2/3/0, ptype 4, otype 0)
bind :p3 <== '19971208' (attribs: )
bind :p3 <== '19971208' (size 8/9/0, ptype 4, otype 0)
syb_st_execute() -> ct_send() OK
st_next_result() -> ct_results(4040) == 1
ct_res_info() returns 4 columns
describe() -> col 0, type 0, realtype 0
describe() -> col 1, type 0, realtype 16
describe() -> col 2, type 0, realtype 16
describe() -> col 3, type 0, realtype 16
describe() retcode = 1
st_next_result() -> lasterr = 0, lastsev = 0
<- execute= -1 at extractor.pl line 458
-> bind_columns for DBD::Sybase::st (DBI::st=HASH(0x1d73dc)~0x1e4ddc
SCALAR(0x17dc80) SCALAR(0x1d9040) SCALAR(0x1d7364) SCALAR(0x1d9
088))
<- bind_columns= 1 at extractor.pl line 462
-> fetchrow_array for DBD::Sybase::st (DBI::st=HASH(0x1d73dc)~0x1e4ddc)
<- fetchrow_array= '19991213' row1 at extractor.pl line 464
-> fetchrow_array for DBD::Sybase::st (DBI::st=HASH(0x1d73dc)~0x1e4ddc)
<- fetchrow_array= '19980420' row2 at extractor.pl line 464
-> fetchrow_array for DBD::Sybase::st (DBI::st=HASH(0x1d73dc)~0x1e4ddc)
<- fetchrow_array= '19980420' row3 at extractor.pl line 464
-> fetchrow_array for DBD::Sybase::st (DBI::st=HASH(0x1d73dc)~0x1e4ddc)
<- fetchrow_array= '19980420' row4 at extractor.pl line 464
-> fetchrow_array for DBD::Sybase::st (DBI::st=HASH(0x1d73dc)~0x1e4ddc)
<- fetchrow_array= '19980420' row5 at extractor.pl line 464
-> fetchrow_array for DBD::Sybase::st (DBI::st=HASH(0x1d73dc)~0x1e4ddc)
<- fetchrow_array= '0' row6 at extractor.pl line 464
-> err for DBD::Sybase::st (DBI::st=HASH(0x1d73dc)~0x1e4ddc)
<- err= undef at extractor.pl line 471
-> DESTROY for DBD::Sybase::st (DBI::st=HASH(0x1e4ddc)~INNER)
syb_st_finish() -> ct_cancel(CS_CANCEL_ALL)
syb_st_finish() -> resetting ACTIVE, moreResults, dyn_execed
syb_st_destroy: called on 317a18...
syb_st_destroy: ct_dynamic(CS_DEALLOC) for DBDa
syb_st_destroy(): freeing imp_sth->statement
syb_st_destroy(): cmd dropped: 1
syb_st_destroy(): connection closed: 1
============================================================================
================================
Any ideas ?
I would be most grateful
Thanks in advance
Tony
-----Original Message-----
From: Tim Harsch [mailto:[EMAIL PROTECTED]]
Sent: 21 February 2002 18:31
To: Ho, Tony; 'Jeff Urlwin'; [EMAIL PROTECTED]
Subject: RE: DBI SQL Query
Your "DATE" column in the tableABC is a reserved word
and is probably the cause (unless you are on Sybase or
SQL server).
Anyway,
do this at beg of script.
DBI->trace( 2 );
run from cmd line, send the output if you don't get
it.
--- "Ho, Tony" <[EMAIL PROTECTED]> wrote:
> Hi Tim,
> Thanks for the email.
> Unfortunately, I am getting the same results.
> I tried your suggestion and also I tried :
>
> $sth = $dbh->prepare("select
> ITEM_ID,
> START_DATE,
> END_DATE
> from tableABC
> where ACCOUNT = ?
> and SEQ = ?
> and DATE = ?");
> �
> Any ideas ?
> Cheers
> Tony
>
> -----Original Message-----
> From: Tim Harsch [mailto:[EMAIL PROTECTED]]
> Sent: 21 February 2002 18:08
> To: Ho, Tony; 'Jeff Urlwin'; [EMAIL PROTECTED]
> Subject: RE: DBI SQL Query
>
>
> Tony,
> try this:
>
> $sth = $dbh->prepare("select
> ITEM_ID,
> START_DATE,
> END_DATE
> from tableABC
> where ACCOUNT = ?
> and SEQ =
> and DATE = ");
>
> $sth->execute( $account, $seq, $date )
> or die "Unable to execute the SQL Statement
> :
> $DBI::errstr\n";
>
> $sth->bind_columns(\($item, $start_date,
> $end_date));
>
> while($sth->fetchrow_array) {
> some code....
> }
>
>
>
>
> --- "Ho, Tony" <[EMAIL PROTECTED]> wrote:
> > Hi Jeff
> > Thanks for correction.
> > The correct version of the code is as follows :
> >
> > $sth = $dbh->prepare("select
> > ITEM_ID,
> > START_DATE,
> > END_DATE
> > from tableABC
> > where ACCOUNT = $account
> > and SEQ = $seq
> > and DATE = $date");
> >
> > $sth->execute
> > or die "Unable to execute the SQL
> Statement
> > : $DBI::errstr\n";
> >
> > $sth->bind_columns(\($item, $start_date,
> > $end_date));
> >
> > while($sth->fetchrow_array) {
> > some code....
> > }
> >
> > Any ideas to the problem mentioned in the email
> > before despite using the
> > correct version of the code above ?
> >
> > I would be most grateful.
> > Cheers
> > Tony
> >
> > -----Original Message-----
> > From: Jeff Urlwin
> [mailto:[EMAIL PROTECTED]]
> > Sent: 21 February 2002 17:14
> > To: Ho, Tony; [EMAIL PROTECTED]
> > Subject: RE: DBI SQL Query
> >
> >
> > >
> > > Hi guys
> > > I was wondering if you could help me.
> > > I have the following SQL query on command-line
> and
> > I get the
> > > resulting data
> > > :
> > >
> > > 1> select ITEM_ID,START_DATE, END_DATE from
> > tableABC where ACCOUNT = 2435
> > > and
> > > SEQ = 16 and DATE = 19971208
> > > 2> go
> > > ITEM_ID START_DATE
> > END_DATE
> > > ----------------- --------------------
> > ------------------
> > > ABC3M 19940111
>
> > 19991213
> > > ABCBM 19960912
>
> > 19980420
> > > ABCRM 19960912
>
> > 19980420
> > > ABCSM 19960912
>
> > 19980420
> > > ABCUM 19940111
>
> > 19980420
> > > ABCN2 19990930
>
> > 0
> > > ABCEM 19960512
>
> > 0
> > > ABCEP 19990603
>
> > 0
> > > ABCBM 19960912
>
> > 0
> > > UNDIR 19940111
>
> > 0
> > >
> > > (10 rows affected)
> > >
> > > If I put this query into the prepare statement
> of
> > my DBI code as follows :
> > >
> > > $supplementary_services_sth =
> > $dbh->prepare("select
> > >
> > ITEM_ID,
> > >
> > START_DATE,
> > >
> > END_DATE
> > >
> from
> > tableABC
> > >
> where
> > ACCOUNT = $account
> > > and
> > SEQ = $seq
> > > and
> > DATE = $date");
> > >
> > > $sth->execute
> > > or die "Unable to execute the SQL
> > Statement : $DBI::errstr\n";
> > >
> > > $sth->bind_columns(\($item, $start_date,
> > $end_date));
> >
> > This looks like you are binding different data
> than
> > you specify in the query
> > above...
> >
> > >
> > > while($sth->fetchrow_array) {
> > > some code....
> > > }
> > >
> > > After I execute my code, I appear to be
> obtaining
> > only those rows that
> > > END_DATE <> 0
> > > Any ideas why the code is not picking ALL rows ?
> > >
> > > I would be most grateful.
> > > Cheers
> > > Tony
> >
> >
> > Jeff
> >
>
>
> __________________________________________________
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com