Thanks loads. I was however lost in the generalized version of the "other frequent 
solution".  A pointer to a specific example on how to set this up would be 
helpful.  The problem again:  Get user input from
a form (DBI/CGI or JSP or servelet) which will be 
used as the insert value into a 
PKey ( unique) oracle column.  This means the user
must get feedbback gracefully if he selects a name
which is already in the column for this table. 
The logic would need to let him try again.

This probably means: user types into cgi form
the input which is an arbitrary string ->
string is compared with existing strings in table
column -> if string exists -> report back to user
that string exists  ( dup ) -> if string does not exist
go ahead & insert this unique string into table &
report back success.  Meanwhile,  in the absence
of hard examples to compare against, SteveH has provided an appealing solution which 
includes search 
against the database - once string is collected from form [select count(*) from 
$database where $colm
= $value] -  T or F result of the search then 
invokes one of 2 functions.  

A pointer to examples would still be welcome.  
Thanks all!
-------------------------------------------------
The other frequent solution to this problem is simply to insert the
data, and trap the Duplicate key in index violation.

Actually, this question comes from the idea of "update the record if
it's there, otherwise insert a new one", which can also be expressed
as "insert a new record, otherwise update an existing one." Which
implementation you use depends on the proportion of duplicates to
unique entries.

-- 
Tommy Wareing
Software Engineer
Oxford English Dictionary
Oxford University Press
 >>


Reply via email to