Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Cursor state not in a valid state

6 posts in General Discussion Last posting was on 2007-12-13 19:14:48.0Z
Tinam Posted on 2007-12-12 16:02:24.0Z
Sender: 2dd5.475ff40e.1804289383@sybase.com
From: Tinam
Newsgroups: ianywhere.public.general
Subject: Cursor state not in a valid state
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <47600610.2fbd.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 12 Dec 2007 08:02:24 -0800
X-Trace: forums-1-dub 1197475344 10.22.241.41 (12 Dec 2007 08:02:24 -0800)
X-Original-Trace: 12 Dec 2007 08:02:24 -0800, 10.22.241.41
Lines: 156
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6637
Article PK: 4885

I am receiving the -853 error with the following sql:

Any suggestions??

SELECT
se.record_alt_id record_alt_id,
dateformat( sr.schedule_date, 'YYYYMMDD' ) broadcast_date,
wsa.basis_number basis_no,
wsa.segment_no segment_no,
sr.avail_type_code avail_type,
If length( se.event_id ) = 1 and se.event_id <> 'L' Then
cast( ('0' + se.event_id) as integer ) else
If se.event_id = 'L' Then 999 else cast( se.event_id as
integer ) endif endif event_id,
Coalesce( ( mi.duration ), se.duration ) duration,
Coalesce( mi.isci, isci( ed.description_id ) ) isci,
adv.business_name + '/' +
string( LDO.contract_id ) + '/' + string( LDO.line_id)
client_name,
spot_brand( LDO.spot_id ) product_title,
Cast( Case when edm.event_media_number = 1 or
edm.event_media_number is null Then LDO.spot_id else
-1*LDO.spot_id end as Integer) spot_id,
wsa.time_last_sent time_last_sent,
wsa.position_in_segment position_in_segment,
edm.event_house_number house_number,
edm.event_media_number media_number,
wsa.sequence

FROM
dba.schedule_records sr,
dba.schedule_events se Left Outer Join dba.event_details ed
on
se.record_alt_id = ed.record_alt_id and
se.event_id = ed.event_id
Left Outer Join dba.event_detail_media edm on
ed.record_alt_id = edm.record_alt_id and
ed.event_id = edm.event_id and
ed.market_id = edm.market_id
Left Outer Join dba.media_house mh on
edm.event_house_number = mh.media_house_number
Left Outer Join dba.media_items mi on
mh.media_item_id = mi.media_item_id,
dba.Line_distribution_occurences LDO,
dba.order_contract OC,
dba.name_address adv,
dba.web_scheduler_avails wsa
WHERE
oc.advertiser_id = adv.name_id and
ldo.contract_id = oc.contract_id and
se.spot_id = ldo.spot_id and
sr.schedule_record_alt_id = se.record_alt_id and
sr.schedule_date <= dateadd( dd, 5, Today() ) and
((se.record_alt_id = wsa.record_alt_id and
wsa.time_last_sent is null ),0)
UNION ALL
SELECT
se.record_alt_id record_alt_id,
dateformat( sr.schedule_date, 'YYYYMMDD' ) broadcast_date,
wsa.basis_number basis_no,
wsa.segment_no segment_no,
sr.avail_type_code avail_type,
If length( se.event_id ) = 1 and se.event_id <> 'L' Then
cast( ('0' + se.event_id) as integer ) else
If se.event_id = 'L' Then 999 else cast( se.event_id as
integer ) endif endif event_id,
Coalesce( ( mi.duration ), se.duration ) duration,
Coalesce( mi.isci, isci( ed.description_id ) ) isci,
adf.business_name + '/' + string( FL.filler_id )
client_name,
'' product_title,
null spot_id,
wsa.time_last_sent time_last_sent,
wsa.position_in_segment position_in_segment,
edm.event_house_number house_number,
edm.event_media_number media_number,
wsa.sequence
FROM
dba.schedule_records sr,
dba.schedule_events se Left Outer Join dba.event_details ed
on
se.record_alt_id = ed.record_alt_id and
se.event_id = ed.event_id
Left Outer Join dba.event_detail_media edm on
ed.record_alt_id = edm.record_alt_id and
ed.event_id = edm.event_id and
ed.market_id = edm.market_id
Left Outer Join dba.media_house mh on
edm.event_house_number = mh.media_house_number
Left Outer Join dba.media_items mi on
mh.media_item_id = mi.media_item_id,
dba.fillers FL,
dba.name_address adf,
dba.web_scheduler_avails wsa
WHERE

se.filler_id = fl.filler_id and
fl.name_id = adf.name_id and
sr.schedule_record_alt_id = se.record_alt_id and
sr.schedule_date <= dateadd( dd, 5, Today() ) and
((se.record_alt_id = wsa.record_alt_id and
wsa.time_last_sent is null ),0)
UNION ALL
SELECT
wsa.record_alt_id record_alt_id,
dateformat( sr.schedule_date, 'YYYYMMDD' ) broadcast_date,
wsa.basis_number basis_no,
wsa.segment_no segment_no,
'DEL' avail_type,
1 event_id,
0 duration,
null isci,
null client_name,
null product_title,
null spot_id,
wsa.time_last_sent time_last_sent,
wsa.position_in_segment position_in_segment,
null house_number,
0 event_media_number,
wsa.sequence
FROM
dba.schedule_records sr,
dba.web_scheduler_avails wsa
WHERE
((sr.schedule_record_alt_id = wsa.record_alt_id and
wsa.time_last_sent is null ),0) and
sr.schedule_date <= dateadd( dd, 5, Today() ) and
not exists( select 1 from dba.schedule_events se
where se.record_alt_id = wsa.record_alt_id )
UNION ALL
SELECT
wsa.record_alt_id record_alt_id,
dateformat( wsa.schedule_date, 'YYYYMMDD' ) broadcast_date,
wsa.basis_number basis_no,
wsa.segment_no segment_no,
'DEL' avail_type,
1 event_id,
0 duration,
null isci,
null client_name,
null product_title,
null spot_id,
wsa.time_last_sent time_last_sent,
wsa.position_in_segment position_in_segment,
null house_number,
0 event_media_number,
wsa.sequence
FROM
dba.web_scheduler_avails wsa
WHERE
((wsa.time_last_sent is null ),0) and
wsa.schedule_date is not null and
wsa.schedule_date <= dateadd( dd, 5, Today() ) and
not exists( select 1 from dba.schedule_records sr
where sr.schedule_record_alt_id = wsa.record_alt_id
)


"Stephen Rice" Posted on 2007-12-12 17:18:53.0Z
From: "Stephen Rice" <srice[at]sybase[dot]com>
Newsgroups: ianywhere.public.general
References: <47600610.2fbd.1681692777@sybase.com>
Subject: Re: Cursor state not in a valid state
Lines: 172
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: srice-pciii.sybase.com
X-Original-NNTP-Posting-Host: srice-pciii.sybase.com
Message-ID: <476017fd$1@forums-1-dub>
Date: 12 Dec 2007 09:18:53 -0800
X-Trace: forums-1-dub 1197479933 10.25.98.116 (12 Dec 2007 09:18:53 -0800)
X-Original-Trace: 12 Dec 2007 09:18:53 -0800, srice-pciii.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6639
Article PK: 4888

How are you executing this SQL? dbisql? ODBC? .NET? ESQL?...

Assuming it is dbisql then do each of the selects work independent of the
UNION, If not which one fails? What happens as you remove portions of the
query which fails

If it is failing in your code then how are you opening the cursor?

--
/steve
Stephen Rice
Sybase iAnywhere

<Tinam> wrote in message news:47600610.2fbd.1681692777@sybase.com...
>I am receiving the -853 error with the following sql:
>
> Any suggestions??
>
> SELECT
> se.record_alt_id record_alt_id,
> dateformat( sr.schedule_date, 'YYYYMMDD' ) broadcast_date,
> wsa.basis_number basis_no,
> wsa.segment_no segment_no,
> sr.avail_type_code avail_type,
> If length( se.event_id ) = 1 and se.event_id <> 'L' Then
> cast( ('0' + se.event_id) as integer ) else
> If se.event_id = 'L' Then 999 else cast( se.event_id as
> integer ) endif endif event_id,
> Coalesce( ( mi.duration ), se.duration ) duration,
> Coalesce( mi.isci, isci( ed.description_id ) ) isci,
> adv.business_name + '/' +
> string( LDO.contract_id ) + '/' + string( LDO.line_id)
> client_name,
> spot_brand( LDO.spot_id ) product_title,
> Cast( Case when edm.event_media_number = 1 or
> edm.event_media_number is null Then LDO.spot_id else
> -1*LDO.spot_id end as Integer) spot_id,
> wsa.time_last_sent time_last_sent,
> wsa.position_in_segment position_in_segment,
> edm.event_house_number house_number,
> edm.event_media_number media_number,
> wsa.sequence
>
> FROM
> dba.schedule_records sr,
> dba.schedule_events se Left Outer Join dba.event_details ed
> on
> se.record_alt_id = ed.record_alt_id and
> se.event_id = ed.event_id
> Left Outer Join dba.event_detail_media edm on
> ed.record_alt_id = edm.record_alt_id and
> ed.event_id = edm.event_id and
> ed.market_id = edm.market_id
> Left Outer Join dba.media_house mh on
> edm.event_house_number = mh.media_house_number
> Left Outer Join dba.media_items mi on
> mh.media_item_id = mi.media_item_id,
> dba.Line_distribution_occurences LDO,
> dba.order_contract OC,
> dba.name_address adv,
> dba.web_scheduler_avails wsa
> WHERE
> oc.advertiser_id = adv.name_id and
> ldo.contract_id = oc.contract_id and
> se.spot_id = ldo.spot_id and
> sr.schedule_record_alt_id = se.record_alt_id and
> sr.schedule_date <= dateadd( dd, 5, Today() ) and
> ((se.record_alt_id = wsa.record_alt_id and
> wsa.time_last_sent is null ),0)
> UNION ALL
> SELECT
> se.record_alt_id record_alt_id,
> dateformat( sr.schedule_date, 'YYYYMMDD' ) broadcast_date,
> wsa.basis_number basis_no,
> wsa.segment_no segment_no,
> sr.avail_type_code avail_type,
> If length( se.event_id ) = 1 and se.event_id <> 'L' Then
> cast( ('0' + se.event_id) as integer ) else
> If se.event_id = 'L' Then 999 else cast( se.event_id as
> integer ) endif endif event_id,
> Coalesce( ( mi.duration ), se.duration ) duration,
> Coalesce( mi.isci, isci( ed.description_id ) ) isci,
> adf.business_name + '/' + string( FL.filler_id )
> client_name,
> '' product_title,
> null spot_id,
> wsa.time_last_sent time_last_sent,
> wsa.position_in_segment position_in_segment,
> edm.event_house_number house_number,
> edm.event_media_number media_number,
> wsa.sequence
> FROM
> dba.schedule_records sr,
> dba.schedule_events se Left Outer Join dba.event_details ed
> on
> se.record_alt_id = ed.record_alt_id and
> se.event_id = ed.event_id
> Left Outer Join dba.event_detail_media edm on
> ed.record_alt_id = edm.record_alt_id and
> ed.event_id = edm.event_id and
> ed.market_id = edm.market_id
> Left Outer Join dba.media_house mh on
> edm.event_house_number = mh.media_house_number
> Left Outer Join dba.media_items mi on
> mh.media_item_id = mi.media_item_id,
> dba.fillers FL,
> dba.name_address adf,
> dba.web_scheduler_avails wsa
> WHERE
>
> se.filler_id = fl.filler_id and
> fl.name_id = adf.name_id and
> sr.schedule_record_alt_id = se.record_alt_id and
> sr.schedule_date <= dateadd( dd, 5, Today() ) and
> ((se.record_alt_id = wsa.record_alt_id and
> wsa.time_last_sent is null ),0)
> UNION ALL
> SELECT
> wsa.record_alt_id record_alt_id,
> dateformat( sr.schedule_date, 'YYYYMMDD' ) broadcast_date,
> wsa.basis_number basis_no,
> wsa.segment_no segment_no,
> 'DEL' avail_type,
> 1 event_id,
> 0 duration,
> null isci,
> null client_name,
> null product_title,
> null spot_id,
> wsa.time_last_sent time_last_sent,
> wsa.position_in_segment position_in_segment,
> null house_number,
> 0 event_media_number,
> wsa.sequence
> FROM
> dba.schedule_records sr,
> dba.web_scheduler_avails wsa
> WHERE
> ((sr.schedule_record_alt_id = wsa.record_alt_id and
> wsa.time_last_sent is null ),0) and
> sr.schedule_date <= dateadd( dd, 5, Today() ) and
> not exists( select 1 from dba.schedule_events se
> where se.record_alt_id = wsa.record_alt_id )
> UNION ALL
> SELECT
> wsa.record_alt_id record_alt_id,
> dateformat( wsa.schedule_date, 'YYYYMMDD' ) broadcast_date,
> wsa.basis_number basis_no,
> wsa.segment_no segment_no,
> 'DEL' avail_type,
> 1 event_id,
> 0 duration,
> null isci,
> null client_name,
> null product_title,
> null spot_id,
> wsa.time_last_sent time_last_sent,
> wsa.position_in_segment position_in_segment,
> null house_number,
> 0 event_media_number,
> wsa.sequence
> FROM
> dba.web_scheduler_avails wsa
> WHERE
> ((wsa.time_last_sent is null ),0) and
> wsa.schedule_date is not null and
> wsa.schedule_date <= dateadd( dd, 5, Today() ) and
> not exists( select 1 from dba.schedule_records sr
> where sr.schedule_record_alt_id = wsa.record_alt_id
> )


Tinam Posted on 2007-12-12 20:20:42.0Z
Sender: 3606.47603bf9.1804289383@sybase.com
From: TinaM
Newsgroups: ianywhere.public.general
Subject: Re: Cursor state not in a valid state
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4760429a.36cc.1681692777@sybase.com>
References: <476017fd$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 12 Dec 2007 12:20:42 -0800
X-Trace: forums-1-dub 1197490842 10.22.241.41 (12 Dec 2007 12:20:42 -0800)
X-Original-Trace: 12 Dec 2007 12:20:42 -0800, 10.22.241.41
Lines: 179
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6640
Article PK: 4889

It was narrowed down this this sql...and I hav enot done
each select independently.
It is run for a powerbuilder datawindow.

> How are you executing this SQL? dbisql? ODBC? .NET?
> ESQL?...
>
> Assuming it is dbisql then do each of the selects work
> independent of the UNION, If not which one fails? What
> happens as you remove portions of the query which fails
>
> If it is failing in your code then how are you opening the
> cursor?
>
> --
> /steve
> Stephen Rice
> Sybase iAnywhere
>
> <Tinam> wrote in message
> news:47600610.2fbd.1681692777@sybase.com... >I am
> receiving the -853 error with the following sql: >
> > Any suggestions??
> >
> > SELECT
> > se.record_alt_id record_alt_id,
> > dateformat( sr.schedule_date, 'YYYYMMDD' )
> > broadcast_date, wsa.basis_number basis_no,
> > wsa.segment_no segment_no,
> > sr.avail_type_code avail_type,
> > If length( se.event_id ) = 1 and se.event_id <> 'L' Then
> > cast( ('0' + se.event_id) as integer ) else
> > If se.event_id = 'L' Then 999 else cast( se.event_id as
> > integer ) endif endif event_id,
> > Coalesce( ( mi.duration ), se.duration ) duration,
> > Coalesce( mi.isci, isci( ed.description_id ) ) isci,
> > adv.business_name + '/' +
> > string( LDO.contract_id ) + '/' + string( LDO.line_id)
> > client_name,
> > spot_brand( LDO.spot_id ) product_title,
> > Cast( Case when edm.event_media_number = 1 or
> > edm.event_media_number is null Then LDO.spot_id else
> > -1*LDO.spot_id end as Integer) spot_id,
> > wsa.time_last_sent time_last_sent,
> > wsa.position_in_segment position_in_segment,
> > edm.event_house_number house_number,
> > edm.event_media_number media_number,
> > wsa.sequence
> >
> > FROM
> > dba.schedule_records sr,
> > dba.schedule_events se Left Outer Join dba.event_details
> > ed on
> > se.record_alt_id = ed.record_alt_id and
> > se.event_id = ed.event_id
> > Left Outer Join dba.event_detail_media edm on
> > ed.record_alt_id = edm.record_alt_id and
> > ed.event_id = edm.event_id and
> > ed.market_id = edm.market_id
> > Left Outer Join dba.media_house mh on
> > edm.event_house_number = mh.media_house_number
> > Left Outer Join dba.media_items mi on
> > mh.media_item_id = mi.media_item_id,
> > dba.Line_distribution_occurences LDO,
> > dba.order_contract OC,
> > dba.name_address adv,
> > dba.web_scheduler_avails wsa
> > WHERE
> > oc.advertiser_id = adv.name_id and
> > ldo.contract_id = oc.contract_id and
> > se.spot_id = ldo.spot_id and
> > sr.schedule_record_alt_id = se.record_alt_id and
> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
> > ((se.record_alt_id = wsa.record_alt_id and
> > wsa.time_last_sent is null ),0)
> > UNION ALL
> > SELECT
> > se.record_alt_id record_alt_id,
> > dateformat( sr.schedule_date, 'YYYYMMDD' )
> > broadcast_date, wsa.basis_number basis_no,
> > wsa.segment_no segment_no,
> > sr.avail_type_code avail_type,
> > If length( se.event_id ) = 1 and se.event_id <> 'L' Then
> > cast( ('0' + se.event_id) as integer ) else
> > If se.event_id = 'L' Then 999 else cast( se.event_id as
> > integer ) endif endif event_id,
> > Coalesce( ( mi.duration ), se.duration ) duration,
> > Coalesce( mi.isci, isci( ed.description_id ) ) isci,
> > adf.business_name + '/' + string( FL.filler_id )
> > client_name,
> > '' product_title,
> > null spot_id,
> > wsa.time_last_sent time_last_sent,
> > wsa.position_in_segment position_in_segment,
> > edm.event_house_number house_number,
> > edm.event_media_number media_number,
> > wsa.sequence
> > FROM
> > dba.schedule_records sr,
> > dba.schedule_events se Left Outer Join dba.event_details
> > ed on
> > se.record_alt_id = ed.record_alt_id and
> > se.event_id = ed.event_id
> > Left Outer Join dba.event_detail_media edm on
> > ed.record_alt_id = edm.record_alt_id and
> > ed.event_id = edm.event_id and
> > ed.market_id = edm.market_id
> > Left Outer Join dba.media_house mh on
> > edm.event_house_number = mh.media_house_number
> > Left Outer Join dba.media_items mi on
> > mh.media_item_id = mi.media_item_id,
> > dba.fillers FL,
> > dba.name_address adf,
> > dba.web_scheduler_avails wsa
> > WHERE
> >
> > se.filler_id = fl.filler_id and
> > fl.name_id = adf.name_id and
> > sr.schedule_record_alt_id = se.record_alt_id and
> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
> > ((se.record_alt_id = wsa.record_alt_id and
> > wsa.time_last_sent is null ),0)
> > UNION ALL
> > SELECT
> > wsa.record_alt_id record_alt_id,
> > dateformat( sr.schedule_date, 'YYYYMMDD' )
> > broadcast_date, wsa.basis_number basis_no,
> > wsa.segment_no segment_no,
> > 'DEL' avail_type,
> > 1 event_id,
> > 0 duration,
> > null isci,
> > null client_name,
> > null product_title,
> > null spot_id,
> > wsa.time_last_sent time_last_sent,
> > wsa.position_in_segment position_in_segment,
> > null house_number,
> > 0 event_media_number,
> > wsa.sequence
> > FROM
> > dba.schedule_records sr,
> > dba.web_scheduler_avails wsa
> > WHERE
> > ((sr.schedule_record_alt_id = wsa.record_alt_id and
> > wsa.time_last_sent is null ),0) and
> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
> > not exists( select 1 from dba.schedule_events se
> > where se.record_alt_id = wsa.record_alt_id )
> > UNION ALL
> > SELECT
> > wsa.record_alt_id record_alt_id,
> > dateformat( wsa.schedule_date, 'YYYYMMDD' )
> > broadcast_date, wsa.basis_number basis_no,
> > wsa.segment_no segment_no,
> > 'DEL' avail_type,
> > 1 event_id,
> > 0 duration,
> > null isci,
> > null client_name,
> > null product_title,
> > null spot_id,
> > wsa.time_last_sent time_last_sent,
> > wsa.position_in_segment position_in_segment,
> > null house_number,
> > 0 event_media_number,
> > wsa.sequence
> > FROM
> > dba.web_scheduler_avails wsa
> > WHERE
> > ((wsa.time_last_sent is null ),0) and
> > wsa.schedule_date is not null and
> > wsa.schedule_date <= dateadd( dd, 5, Today() ) and
> > not exists( select 1 from dba.schedule_records sr
> > where sr.schedule_record_alt_id =
> > wsa.record_alt_id )
>
>


"Frank Ploessel" <fpl... Posted on 2007-12-13 09:50:09.0Z
Subject: Re: Cursor state not in a valid state
From: "Frank Ploessel" <fpl...@d_e.i_m_s_h_e_a_l_t_h.c_o_m>
Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
References: <476017fd$1@forums-1-dub> <4760429a.36cc.1681692777@sybase.com>
Content-Transfer-Encoding: Quoted-Printable
Message-ID: <op.t29pluekj0bybf@bonw00164.internal.imsglobal.com>
User-Agent: Opera Mail/9.21 (Win32)
NNTP-Posting-Host: mail.taskarena-software-engineering.net
X-Original-NNTP-Posting-Host: mail.taskarena-software-engineering.net
Date: 13 Dec 2007 01:50:09 -0800
X-Trace: forums-1-dub 1197539409 217.76.101.130 (13 Dec 2007 01:50:09 -0800)
X-Original-Trace: 13 Dec 2007 01:50:09 -0800, mail.taskarena-software-engineering.net
Lines: 193
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6641
Article PK: 4890

Tina,

Maybe it is not the statement itself which causes this issue, but the
sequence of statemants executed. I would try an ODBC trace to see which
ODBC calls precede the fetch issued by the datawindow.

Frank

On Wed, 12 Dec 2007 21:20:42 +0100, <TinaM> wrote:

> It was narrowed down this this sql...and I hav enot done
> each select independently.
> It is run for a powerbuilder datawindow.
>
>
>> How are you executing this SQL? dbisql? ODBC? .NET?
>> ESQL?...
>>
>> Assuming it is dbisql then do each of the selects work
>> independent of the UNION, If not which one fails? What
>> happens as you remove portions of the query which fails
>>
>> If it is failing in your code then how are you opening the
>> cursor?
>>
>> --
>> /steve
>> Stephen Rice
>> Sybase iAnywhere
>>
>> <Tinam> wrote in message
>> news:47600610.2fbd.1681692777@sybase.com... >I am
>> receiving the -853 error with the following sql: >
>> > Any suggestions??
>> >
>> > SELECT
>> > se.record_alt_id record_alt_id,
>> > dateformat( sr.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > sr.avail_type_code avail_type,
>> > If length( se.event_id ) = 1 and se.event_id <> 'L' Then
>> > cast( ('0' + se.event_id) as integer ) else
>> > If se.event_id = 'L' Then 999 else cast( se.event_id as
>> > integer ) endif endif event_id,
>> > Coalesce( ( mi.duration ), se.duration ) duration,
>> > Coalesce( mi.isci, isci( ed.description_id ) ) isci,
>> > adv.business_name + '/' +
>> > string( LDO.contract_id ) + '/' + string( LDO.line_id)
>> > client_name,
>> > spot_brand( LDO.spot_id ) product_title,
>> > Cast( Case when edm.event_media_number = 1 or
>> > edm.event_media_number is null Then LDO.spot_id else
>> > -1*LDO.spot_id end as Integer) spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > edm.event_house_number house_number,
>> > edm.event_media_number media_number,
>> > wsa.sequence
>> >
>> > FROM
>> > dba.schedule_records sr,
>> > dba.schedule_events se Left Outer Join dba.event_details
>> > ed on
>> > se.record_alt_id = ed.record_alt_id and
>> > se.event_id = ed.event_id
>> > Left Outer Join dba.event_detail_media edm on
>> > ed.record_alt_id = edm.record_alt_id and
>> > ed.event_id = edm.event_id and
>> > ed.market_id = edm.market_id
>> > Left Outer Join dba.media_house mh on
>> > edm.event_house_number = mh.media_house_number
>> > Left Outer Join dba.media_items mi on
>> > mh.media_item_id = mi.media_item_id,
>> > dba.Line_distribution_occurences LDO,
>> > dba.order_contract OC,
>> > dba.name_address adv,
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> > oc.advertiser_id = adv.name_id and
>> > ldo.contract_id = oc.contract_id and
>> > se.spot_id = ldo.spot_id and
>> > sr.schedule_record_alt_id = se.record_alt_id and
>> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
>> > ((se.record_alt_id = wsa.record_alt_id and
>> > wsa.time_last_sent is null ),0)
>> > UNION ALL
>> > SELECT
>> > se.record_alt_id record_alt_id,
>> > dateformat( sr.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > sr.avail_type_code avail_type,
>> > If length( se.event_id ) = 1 and se.event_id <> 'L' Then
>> > cast( ('0' + se.event_id) as integer ) else
>> > If se.event_id = 'L' Then 999 else cast( se.event_id as
>> > integer ) endif endif event_id,
>> > Coalesce( ( mi.duration ), se.duration ) duration,
>> > Coalesce( mi.isci, isci( ed.description_id ) ) isci,
>> > adf.business_name + '/' + string( FL.filler_id )
>> > client_name,
>> > '' product_title,
>> > null spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > edm.event_house_number house_number,
>> > edm.event_media_number media_number,
>> > wsa.sequence
>> > FROM
>> > dba.schedule_records sr,
>> > dba.schedule_events se Left Outer Join dba.event_details
>> > ed on
>> > se.record_alt_id = ed.record_alt_id and
>> > se.event_id = ed.event_id
>> > Left Outer Join dba.event_detail_media edm on
>> > ed.record_alt_id = edm.record_alt_id and
>> > ed.event_id = edm.event_id and
>> > ed.market_id = edm.market_id
>> > Left Outer Join dba.media_house mh on
>> > edm.event_house_number = mh.media_house_number
>> > Left Outer Join dba.media_items mi on
>> > mh.media_item_id = mi.media_item_id,
>> > dba.fillers FL,
>> > dba.name_address adf,
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> >
>> > se.filler_id = fl.filler_id and
>> > fl.name_id = adf.name_id and
>> > sr.schedule_record_alt_id = se.record_alt_id and
>> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
>> > ((se.record_alt_id = wsa.record_alt_id and
>> > wsa.time_last_sent is null ),0)
>> > UNION ALL
>> > SELECT
>> > wsa.record_alt_id record_alt_id,
>> > dateformat( sr.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > 'DEL' avail_type,
>> > 1 event_id,
>> > 0 duration,
>> > null isci,
>> > null client_name,
>> > null product_title,
>> > null spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > null house_number,
>> > 0 event_media_number,
>> > wsa.sequence
>> > FROM
>> > dba.schedule_records sr,
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> > ((sr.schedule_record_alt_id = wsa.record_alt_id and
>> > wsa.time_last_sent is null ),0) and
>> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
>> > not exists( select 1 from dba.schedule_events se
>> > where se.record_alt_id = wsa.record_alt_id )
>> > UNION ALL
>> > SELECT
>> > wsa.record_alt_id record_alt_id,
>> > dateformat( wsa.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > 'DEL' avail_type,
>> > 1 event_id,
>> > 0 duration,
>> > null isci,
>> > null client_name,
>> > null product_title,
>> > null spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > null house_number,
>> > 0 event_media_number,
>> > wsa.sequence
>> > FROM
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> > ((wsa.time_last_sent is null ),0) and
>> > wsa.schedule_date is not null and
>> > wsa.schedule_date <= dateadd( dd, 5, Today() ) and
>> > not exists( select 1 from dba.schedule_records sr
>> > where sr.schedule_record_alt_id =
>> > wsa.record_alt_id )
>>
>>


Dean Jones Posted on 2007-12-13 14:36:13.0Z
From: "Dean Jones" <dean_dot_jones_at_powerobjects_dot_com>
Newsgroups: ianywhere.public.general
References: <476017fd$1@forums-1-dub> <4760429a.36cc.1681692777@sybase.com> <op.t29pluekj0bybf@bonw00164.internal.imsglobal.com>
Subject: Re: Cursor state not in a valid state
Lines: 211
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: officenat.outtech.com
X-Original-NNTP-Posting-Host: officenat.outtech.com
Message-ID: <4761435d$1@forums-1-dub>
Date: 13 Dec 2007 06:36:13 -0800
X-Trace: forums-1-dub 1197556573 216.207.144.172 (13 Dec 2007 06:36:13 -0800)
X-Original-Trace: 13 Dec 2007 06:36:13 -0800, officenat.outtech.com
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6642
Article PK: 4891

I would rewrite the logic so someone can easily support it.

Just because you can do everything in one sql call does not mean you should
or you have to.

Just my opinion.

--
Dean Jones
CEO
PowerObjects
http://www.powerobjects.com
(612) 339-3355 Ext. 112

TeamSybase
* * Think Sybase * *


"Frank Ploessel" <fpl...@d_e.i_m_s_h_e_a_l_t_h.c_o_m> wrote in message
news:op.t29pluekj0bybf@bonw00164.internal.imsglobal.com...
Tina,

Maybe it is not the statement itself which causes this issue, but the
sequence of statemants executed. I would try an ODBC trace to see which
ODBC calls precede the fetch issued by the datawindow.

Frank

On Wed, 12 Dec 2007 21:20:42 +0100, <TinaM> wrote:

> It was narrowed down this this sql...and I hav enot done
> each select independently.
> It is run for a powerbuilder datawindow.
>
>
>> How are you executing this SQL? dbisql? ODBC? .NET?
>> ESQL?...
>>
>> Assuming it is dbisql then do each of the selects work
>> independent of the UNION, If not which one fails? What
>> happens as you remove portions of the query which fails
>>
>> If it is failing in your code then how are you opening the
>> cursor?
>>
>> --
>> /steve
>> Stephen Rice
>> Sybase iAnywhere
>>
>> <Tinam> wrote in message
>> news:47600610.2fbd.1681692777@sybase.com... >I am
>> receiving the -853 error with the following sql: >
>> > Any suggestions??
>> >
>> > SELECT
>> > se.record_alt_id record_alt_id,
>> > dateformat( sr.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > sr.avail_type_code avail_type,
>> > If length( se.event_id ) = 1 and se.event_id <> 'L' Then
>> > cast( ('0' + se.event_id) as integer ) else
>> > If se.event_id = 'L' Then 999 else cast( se.event_id as
>> > integer ) endif endif event_id,
>> > Coalesce( ( mi.duration ), se.duration ) duration,
>> > Coalesce( mi.isci, isci( ed.description_id ) ) isci,
>> > adv.business_name + '/' +
>> > string( LDO.contract_id ) + '/' + string( LDO.line_id)
>> > client_name,
>> > spot_brand( LDO.spot_id ) product_title,
>> > Cast( Case when edm.event_media_number = 1 or
>> > edm.event_media_number is null Then LDO.spot_id else
>> > -1*LDO.spot_id end as Integer) spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > edm.event_house_number house_number,
>> > edm.event_media_number media_number,
>> > wsa.sequence
>> >
>> > FROM
>> > dba.schedule_records sr,
>> > dba.schedule_events se Left Outer Join dba.event_details
>> > ed on
>> > se.record_alt_id = ed.record_alt_id and
>> > se.event_id = ed.event_id
>> > Left Outer Join dba.event_detail_media edm on
>> > ed.record_alt_id = edm.record_alt_id and
>> > ed.event_id = edm.event_id and
>> > ed.market_id = edm.market_id
>> > Left Outer Join dba.media_house mh on
>> > edm.event_house_number = mh.media_house_number
>> > Left Outer Join dba.media_items mi on
>> > mh.media_item_id = mi.media_item_id,
>> > dba.Line_distribution_occurences LDO,
>> > dba.order_contract OC,
>> > dba.name_address adv,
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> > oc.advertiser_id = adv.name_id and
>> > ldo.contract_id = oc.contract_id and
>> > se.spot_id = ldo.spot_id and
>> > sr.schedule_record_alt_id = se.record_alt_id and
>> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
>> > ((se.record_alt_id = wsa.record_alt_id and
>> > wsa.time_last_sent is null ),0)
>> > UNION ALL
>> > SELECT
>> > se.record_alt_id record_alt_id,
>> > dateformat( sr.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > sr.avail_type_code avail_type,
>> > If length( se.event_id ) = 1 and se.event_id <> 'L' Then
>> > cast( ('0' + se.event_id) as integer ) else
>> > If se.event_id = 'L' Then 999 else cast( se.event_id as
>> > integer ) endif endif event_id,
>> > Coalesce( ( mi.duration ), se.duration ) duration,
>> > Coalesce( mi.isci, isci( ed.description_id ) ) isci,
>> > adf.business_name + '/' + string( FL.filler_id )
>> > client_name,
>> > '' product_title,
>> > null spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > edm.event_house_number house_number,
>> > edm.event_media_number media_number,
>> > wsa.sequence
>> > FROM
>> > dba.schedule_records sr,
>> > dba.schedule_events se Left Outer Join dba.event_details
>> > ed on
>> > se.record_alt_id = ed.record_alt_id and
>> > se.event_id = ed.event_id
>> > Left Outer Join dba.event_detail_media edm on
>> > ed.record_alt_id = edm.record_alt_id and
>> > ed.event_id = edm.event_id and
>> > ed.market_id = edm.market_id
>> > Left Outer Join dba.media_house mh on
>> > edm.event_house_number = mh.media_house_number
>> > Left Outer Join dba.media_items mi on
>> > mh.media_item_id = mi.media_item_id,
>> > dba.fillers FL,
>> > dba.name_address adf,
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> >
>> > se.filler_id = fl.filler_id and
>> > fl.name_id = adf.name_id and
>> > sr.schedule_record_alt_id = se.record_alt_id and
>> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
>> > ((se.record_alt_id = wsa.record_alt_id and
>> > wsa.time_last_sent is null ),0)
>> > UNION ALL
>> > SELECT
>> > wsa.record_alt_id record_alt_id,
>> > dateformat( sr.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > 'DEL' avail_type,
>> > 1 event_id,
>> > 0 duration,
>> > null isci,
>> > null client_name,
>> > null product_title,
>> > null spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > null house_number,
>> > 0 event_media_number,
>> > wsa.sequence
>> > FROM
>> > dba.schedule_records sr,
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> > ((sr.schedule_record_alt_id = wsa.record_alt_id and
>> > wsa.time_last_sent is null ),0) and
>> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
>> > not exists( select 1 from dba.schedule_events se
>> > where se.record_alt_id = wsa.record_alt_id )
>> > UNION ALL
>> > SELECT
>> > wsa.record_alt_id record_alt_id,
>> > dateformat( wsa.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > 'DEL' avail_type,
>> > 1 event_id,
>> > 0 duration,
>> > null isci,
>> > null client_name,
>> > null product_title,
>> > null spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > null house_number,
>> > 0 event_media_number,
>> > wsa.sequence
>> > FROM
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> > ((wsa.time_last_sent is null ),0) and
>> > wsa.schedule_date is not null and
>> > wsa.schedule_date <= dateadd( dd, 5, Today() ) and
>> > not exists( select 1 from dba.schedule_records sr
>> > where sr.schedule_record_alt_id =
>> > wsa.record_alt_id )
>>
>>


"Stephen Rice" Posted on 2007-12-13 19:14:48.0Z
From: "Stephen Rice" <srice[at]sybase[dot]com>
Newsgroups: ianywhere.public.general
References: <476017fd$1@forums-1-dub> <4760429a.36cc.1681692777@sybase.com>
Subject: Re: Cursor state not in a valid state
Lines: 190
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: srice-pciii.sybase.com
X-Original-NNTP-Posting-Host: srice-pciii.sybase.com
Message-ID: <476184a8$1@forums-1-dub>
Date: 13 Dec 2007 11:14:48 -0800
X-Trace: forums-1-dub 1197573288 10.25.98.116 (13 Dec 2007 11:14:48 -0800)
X-Original-Trace: 13 Dec 2007 11:14:48 -0800, srice-pciii.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6643
Article PK: 4893

definitely run it outside of powerbuilder. If it works there then it is
either PB or the ODBC driver. If it doesn't work then it's the server.

--
/steve
Stephen Rice
Sybase iAnywhere

<TinaM> wrote in message news:4760429a.36cc.1681692777@sybase.com...
> It was narrowed down this this sql...and I hav enot done
> each select independently.
> It is run for a powerbuilder datawindow.
>
>
>> How are you executing this SQL? dbisql? ODBC? .NET?
>> ESQL?...
>>
>> Assuming it is dbisql then do each of the selects work
>> independent of the UNION, If not which one fails? What
>> happens as you remove portions of the query which fails
>>
>> If it is failing in your code then how are you opening the
>> cursor?
>>
>> --
>> /steve
>> Stephen Rice
>> Sybase iAnywhere
>>
>> <Tinam> wrote in message
>> news:47600610.2fbd.1681692777@sybase.com... >I am
>> receiving the -853 error with the following sql: >
>> > Any suggestions??
>> >
>> > SELECT
>> > se.record_alt_id record_alt_id,
>> > dateformat( sr.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > sr.avail_type_code avail_type,
>> > If length( se.event_id ) = 1 and se.event_id <> 'L' Then
>> > cast( ('0' + se.event_id) as integer ) else
>> > If se.event_id = 'L' Then 999 else cast( se.event_id as
>> > integer ) endif endif event_id,
>> > Coalesce( ( mi.duration ), se.duration ) duration,
>> > Coalesce( mi.isci, isci( ed.description_id ) ) isci,
>> > adv.business_name + '/' +
>> > string( LDO.contract_id ) + '/' + string( LDO.line_id)
>> > client_name,
>> > spot_brand( LDO.spot_id ) product_title,
>> > Cast( Case when edm.event_media_number = 1 or
>> > edm.event_media_number is null Then LDO.spot_id else
>> > -1*LDO.spot_id end as Integer) spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > edm.event_house_number house_number,
>> > edm.event_media_number media_number,
>> > wsa.sequence
>> >
>> > FROM
>> > dba.schedule_records sr,
>> > dba.schedule_events se Left Outer Join dba.event_details
>> > ed on
>> > se.record_alt_id = ed.record_alt_id and
>> > se.event_id = ed.event_id
>> > Left Outer Join dba.event_detail_media edm on
>> > ed.record_alt_id = edm.record_alt_id and
>> > ed.event_id = edm.event_id and
>> > ed.market_id = edm.market_id
>> > Left Outer Join dba.media_house mh on
>> > edm.event_house_number = mh.media_house_number
>> > Left Outer Join dba.media_items mi on
>> > mh.media_item_id = mi.media_item_id,
>> > dba.Line_distribution_occurences LDO,
>> > dba.order_contract OC,
>> > dba.name_address adv,
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> > oc.advertiser_id = adv.name_id and
>> > ldo.contract_id = oc.contract_id and
>> > se.spot_id = ldo.spot_id and
>> > sr.schedule_record_alt_id = se.record_alt_id and
>> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
>> > ((se.record_alt_id = wsa.record_alt_id and
>> > wsa.time_last_sent is null ),0)
>> > UNION ALL
>> > SELECT
>> > se.record_alt_id record_alt_id,
>> > dateformat( sr.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > sr.avail_type_code avail_type,
>> > If length( se.event_id ) = 1 and se.event_id <> 'L' Then
>> > cast( ('0' + se.event_id) as integer ) else
>> > If se.event_id = 'L' Then 999 else cast( se.event_id as
>> > integer ) endif endif event_id,
>> > Coalesce( ( mi.duration ), se.duration ) duration,
>> > Coalesce( mi.isci, isci( ed.description_id ) ) isci,
>> > adf.business_name + '/' + string( FL.filler_id )
>> > client_name,
>> > '' product_title,
>> > null spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > edm.event_house_number house_number,
>> > edm.event_media_number media_number,
>> > wsa.sequence
>> > FROM
>> > dba.schedule_records sr,
>> > dba.schedule_events se Left Outer Join dba.event_details
>> > ed on
>> > se.record_alt_id = ed.record_alt_id and
>> > se.event_id = ed.event_id
>> > Left Outer Join dba.event_detail_media edm on
>> > ed.record_alt_id = edm.record_alt_id and
>> > ed.event_id = edm.event_id and
>> > ed.market_id = edm.market_id
>> > Left Outer Join dba.media_house mh on
>> > edm.event_house_number = mh.media_house_number
>> > Left Outer Join dba.media_items mi on
>> > mh.media_item_id = mi.media_item_id,
>> > dba.fillers FL,
>> > dba.name_address adf,
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> >
>> > se.filler_id = fl.filler_id and
>> > fl.name_id = adf.name_id and
>> > sr.schedule_record_alt_id = se.record_alt_id and
>> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
>> > ((se.record_alt_id = wsa.record_alt_id and
>> > wsa.time_last_sent is null ),0)
>> > UNION ALL
>> > SELECT
>> > wsa.record_alt_id record_alt_id,
>> > dateformat( sr.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > 'DEL' avail_type,
>> > 1 event_id,
>> > 0 duration,
>> > null isci,
>> > null client_name,
>> > null product_title,
>> > null spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > null house_number,
>> > 0 event_media_number,
>> > wsa.sequence
>> > FROM
>> > dba.schedule_records sr,
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> > ((sr.schedule_record_alt_id = wsa.record_alt_id and
>> > wsa.time_last_sent is null ),0) and
>> > sr.schedule_date <= dateadd( dd, 5, Today() ) and
>> > not exists( select 1 from dba.schedule_events se
>> > where se.record_alt_id = wsa.record_alt_id )
>> > UNION ALL
>> > SELECT
>> > wsa.record_alt_id record_alt_id,
>> > dateformat( wsa.schedule_date, 'YYYYMMDD' )
>> > broadcast_date, wsa.basis_number basis_no,
>> > wsa.segment_no segment_no,
>> > 'DEL' avail_type,
>> > 1 event_id,
>> > 0 duration,
>> > null isci,
>> > null client_name,
>> > null product_title,
>> > null spot_id,
>> > wsa.time_last_sent time_last_sent,
>> > wsa.position_in_segment position_in_segment,
>> > null house_number,
>> > 0 event_media_number,
>> > wsa.sequence
>> > FROM
>> > dba.web_scheduler_avails wsa
>> > WHERE
>> > ((wsa.time_last_sent is null ),0) and
>> > wsa.schedule_date is not null and
>> > wsa.schedule_date <= dateadd( dd, 5, Today() ) and
>> > not exists( select 1 from dba.schedule_records sr
>> > where sr.schedule_record_alt_id =
>> > wsa.record_alt_id )
>>
>>