Re: Stupid question
Posted in 1997
Be VERY careful about using this technique, because of a side effect in the
way dbaccess works. Here's an example of a history dump script:
---begin example---
dbaccess inventory << !
BEGIN WORK;
INSERT INTO history
SELECT *
FROM current
WHERE pdate BETWEEN "11/01/97" AND "11/30/97";
DELETE FROM current
WHERE pdate BETWEEN "11/01/97" AND "11/30/97";
COMMIT WORK;
!
---end example---
If (for example) the INSERT statement fails, the script does not abort; it
keeps right on going. So the "begin work" succeeds, the "insert" fails, the
"delete" succeeds, and the "commit work" succeeds. Your "history dump" has
just deleted the current records WITHOUT first successfully inserting into
history. In other words, scripts like this don't stop on an error. They
happily keep right on going.
There is a way to work around this: set DBACCESSNOIGN to a nonzero value,
as in:
DBACCESSNOIGN=1
export DBACCESSNOIGN
Hope this helps,
- Thomas J. Girsch
Database Systems Manager
Arch Communications Group, Inc.
"Mr. Himnesh Kapoor" wrote in message <67ac96$5o7@cssun.mathcs.emory.edu>...
>Write your script like this.
>
>dbaccess <database name> <<!
>sql statement
>!
>