Note: I've done the following code to catch the native error... but it is a bit "smell code"

// run the query
Set tSC = ..Adapter.ExecuteUpdateParmArray(.nrows,SQL,.param)

// Check if there is any error
If $$$ISERR(tSC)
{
	Set msgError = $System.Status.GetErrorText(tSC) 
	// Check here if the native error code is 2601 (Cannot insert duplicate key row into object 'MYPATIENTS' with unique index 'UQ_UNIQUE_INDEX')
	if $FIND(msgError, "[2601]") > 0
	{
	    // This is a insert/update that violates the unique code
	    // remove duplicate record
	    quit $$$OK
	}
	else
	{
	    // Generic error... thow excepction
	    quit tSC
	}
}