.lf 1 tmac.an.nr
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" $Header: /data/01/postgres/src/ref/RCS/tmac.an.nr,v 1.1 1993/01/26 02:43:13 aoki Exp $
.ds II INGRES
.ds PG POSTGRES
.ds UU UNIX
.ds PQ POSTQUEL
.ds LI LIBPQ
.ds PV 4.1
.de (l 			\" fake "-me"-style lists
.nf
.ie '\\$1'M' .in +0n
.el .in +5n
..
.de )l
.fi
.in
..
.de (C			\" constant-width font blocks
.(l \\$1
.sp
..
.de )C
.sp
.)l
..
.de BH			\" reference manual "big header" for sections
.SH NAME
\&\\$1
..
.de SB			\" section/index stuff
..	\" no-op
.de SE
..	\" no-op
.de XA
..	\" no-op
.de XP
..	\" no-op
.de SP
..
.ds lq ""
.ds rq ""
.lf 1 postquel/replace.cmdsrc
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" $Header: /data/01/postgres/src/ref/postquel/RCS/replace.cmdsrc,v 1.6 1993/06/14 03:39:52 aoki Exp $
.TH REPLACE COMMANDS 06/13/93
.XA 2 Replace
.SH NAME
replace \(em replace values of attributes in a class
.SH SYNOPSIS
.(l M
\fBreplace\fR instance_variable \fB(\fR att_name-1 \fB=\fR expression-1
                         {\fB,\fR att_name-i \fB=\fR expression-i } \fB)\fR
    [ \fBfrom\fR from_list ]
    [ \fBwhere\fR qual ]
.)l
.SH DESCRIPTION
.BR Replace
changes the values of the attributes specified in
.IR target_list 
for all instances which satisfy the qualification,
.IR qual .
Only the attributes to be modified need appear in
.IR target_list .
.PP
Array references use the same syntax found in 
.IR retrieve (commands).
That is, either single array elements, a range of array elements or
the entire array may be replaced with a single query.
.PP
You must have write access to the class in order to modify it, as well
as read access to any class whose values are mentioned in the target list
or qualification (see
.IR "change acl" (commands).
.SH EXAMPLES
.(C
/*
 * Give all employees who work for Smith a 10% raise
 */
replace emp(sal = 1.1 * emp.sal)
    where emp.mgr = "Smith"
.)C
.(C
/*
 * Replace the middle element of a 3x3
 * noughts-and-crosses board with an O.
 */
replace tictactoe (board[2][2] = "O")
    where tictactoe.game = 1
.)C
.(C
/*
 * Replace the entire middle row of a 3x3
 * noughts-and-crosses board with Os.
 */
replace tictactoe (board[2:2][1:3] = "{O,O,O}")
    where tictactoe.game = 2
.)C
.(C
/*
 * Replace the entire 3x3 noughts-and-crosses 
 * board from game 2 with that of game 4
 */
replace tictactoe (board = ttt.board)
    frmo ttt in tictactoe
    where tictactoe.game = 2 and
          ttt.game = 4
.)C
.SH "SEE ALSO"
postquel(commands),
create(commands),
replace(commands),
retrieve(commands).
