Browse mode lets you search through a table and update its values one row at a time. It is used in front-end applications that use DB-Library and a host programming language.
Browse mode provides compatibility with Open Server applications and older Open Client libraries. However, because cursors provide the same functionality in a more portable and flexible manner, SAP discourages browse mode use in more recent Client-Library applications (versions 10.0.x and later). Additionally, browse mode is SAP-specific, and therefore not suited to heterogeneous environments.
Normally, use cursors to update data when you want to change table values row by row. Client-Library applications can use Client-Library cursors to implement some browse-mode features, such as updating a table while fetching rows from it. However, cursors may cause locking contention in the tables being selected.
For more information on browse mode, see the dbqual function in the Open Client/Server documentation.
You cannot use the for browse clause in statements that use the union operator, or in cursor declarations.
You cannot use the keyword holdlock in a select statement that includes the for browse option.
The keyword distinct in the select statement is ignored in browse mode.
To browse a table in a front-end application, append the for browse keywords to the end of the select statement.
Start of select statement in an Open Client application . . for browse Completion of the Open Client application routine
You can browse a table in a front-end application if its rows have been timestamped.
When you create a new table for browsing, include a column named timestamp in the table definition. This column is automatically assigned the timestamp datatype.
create table newtable(col1 int, timestamp, col3 char(7))
When you insert or update a row, SAP ASE identifies the event by automatically assigning a unique varbinary value to the timestamp column.
To prepare an existing table for browsing, use alter table to add a column named timestamp.
alter table oldtable add timestamp
A timestamp column with a null value is added to each existing row. To generate a timestamp, update each row without specifying new column values.
For example:
update oldtable set col1 = col1
Use the tsequal system function to compare timestamps when you are using browse mode in a front-end application.
For example, the following statement updates a row in publishers that has been browsed. It compares the timestamp column in the browsed version of the row with the hexadecimal timestamp in the stored version. If the two timestamps are not equal, you receive an error message, and the row is not updated.
update publishers set city = "Springfield" where pub_id = "0736" and tsequal(timestamp,0x0001000000002ea8)
Do not use the tsequal function in the where clause as a search argument. When you use tsequal, the rest of the where clause should uniquely match a single row. Use the tsequal function only in insert and update statements. If you use a timestamp column as a search clause, compare it like a regular varbinary column, that is, timestamp1 = timestamp2.