Consultor Eletrônico



Kbase 15789: Error 6077 When Using Reposition with a Joined Query
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Error 6077 When Using Reposition with a Joined Query

INTRODUCTION
============
This knowledgebase entry discusses repositioning with rowid
in a browse with a joined query and error 6077.

WHY YOU NEED TO KNOW THIS
=========================
When using reposition with a rowid in a joined query it is
possible to get the following error if you attempt to
reposition to a record that does not have a matching record
in the secondary table of the join:

Cannot reposition query br_table to recid 6123. (6077)

Consider the following example for the sports database. A
browser contains the following query:

open query br_table for each customer no-lock,
each order of customer no-lock.

The customer record with customer number 5 has no orders so
that record will not be in the results list for the query.
If the following is done error 6077 will occur:

find customer where customer.cust-num = 5 no-lock no-error.
if avail customer then
reposition br_table to rowid rowid(customer).

PROCEDURAL APPROACH
===================
To avoid the error you should check to see if there is a
matching record in the secondary table before actually
doing the reposition.

For example:

find customer where customer.cust-num = 5 no-lock no-error.
if avail customer then do:
find first order of customer no-lock no-error.
if avail order then
reposition br_table to rowid rowid(customer).
else message "The customer does not have any related orders".

This would be especially useful if you are repositioning to
a record that the user has determined at runtime and it is
not hard-coded as in the above example.

One additional note when repositioning to a record in a
joined query:

If you are using customers and orders as above and want to
reposition to a customer record that has more than one order,
it will not necessarily reposition to the first order for
that customer record, it will only reposition to one of
them.

REFERENCES TO WRITTEN DOCUMENTATION
===================================
PROGRESS Language Reference: Syntax G to Z


Progress Software Technical Support Note # 15789