PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: jrisley at nex-web4 dot corp dot fedex dot com (Jason Risley)
Subject: Inserting Duplicate Records Message
Date: Jun 23 1999 10:50PM

All,

I have the following code where I am trying to insert a record :

$db=Sybase::CTlib->ct_connect($uid, $pwd, $srv);
$db->ct_execute($sql);
if ( $db->ct_results($result) == CS_SUCCEED) {
		$row_count = $db->ct_res_info(CS_ROW_COUNT);
		if ( $row_count eq 0 ) {
			print "No Records where Added with in the information you supplied.\n";
			print "It is possible that you are trying to insert a duplicate
record.\n"; }
		else { print "The PCN was Added to the database.\n"; }
}
if ( $db->ct_results($result) == CS_FAIL) {
		print "An Error occurred Inserting the data in the database.\n";
		print "Please Try again. 
\n"; print "If the problem continues, Please contact the Webmaster.
\n"; } In the instance of trying to insert a duplicated record, I get the following output: index database owner table column -------------- --------- ------ ------- ---------- sos_pcn_id_002 svcops dbo sos_pcn pcn_number No Records where Added with in the information you supplied. It is possible that you are trying to insert a duplicate record. On the table that I am trying to insert the record, there is an index that does not allow duplicates of a certain field. Is there a way to trap the index message so that the first three lines of the above printout do not appear? Thanks for your support! jason