 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
weizeyin
Joined: 22 Jan 2001 Posts: 9
|
|
DatabaseUpdate |
|
// //database system: Sybase 11.9.2 // //CREATE TABLE dbo.T99_RH_LOG //( // FILENAME varchar(255) NOT NULL, // ID numeric(16,0) IDENTITY, // CZSJ datetime NULL, // FPBZ char(1) NOT NULL, // CONSTRAINT PK_T99_RH_LOG // PRIMARY KEY NONCLUSTERED (ID) //) //LOCK ALLPAGES //go // //insert into T99_RH_LOG (FILENAME,FPBZ) values ('fname','0') //go Dim update_rows, number Dim rows, number DatabaseConnect( "sd_inq" ) //success DatabaseRetrieve( "SELECT FILENAME,ID,CZSJ,FPBZ FROM T99_RH_LOG WHERE FPBZ='0'", rows ) //rows return 1 DatabaseSet( 1, 4, "1" ) DatabaseUpdate( "UPDATE", update_rows) //return error message //Job job execution error. Exit code: -1. //An error occured while executing JAL script: Line 6: Result set is not updatable, //must be singleton select and the affected table must have a primary key. // DatabaseDisconnect
|
|
Mon Jan 22, 2001 11:06 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
Re: DatabaseUpdate |
|
What was your question? : // : //database system: Sybase 11.9.2 : // : //CREATE TABLE dbo.T99_RH_LOG : //( : // FILENAME varchar(255) NOT NULL, : // ID numeric(16,0) IDENTITY, : // CZSJ datetime NULL, : // FPBZ char(1) NOT NULL, : // CONSTRAINT PK_T99_RH_LOG : // PRIMARY KEY NONCLUSTERED (ID) : //) : //LOCK ALLPAGES : //go : // : //insert into T99_RH_LOG (FILENAME,FPBZ) values ('fname','0') : //go : Dim update_rows, number : Dim rows, number : DatabaseConnect( "sd_inq" ) : //success : DatabaseRetrieve( "SELECT FILENAME,ID,CZSJ,FPBZ FROM T99_RH_LOG WHERE : FPBZ='0'", rows ) : //rows return 1 : DatabaseSet( 1, 4, "1" ) : DatabaseUpdate( "UPDATE", update_rows) : //return error message : //Job job execution error. Exit code: -1. : //An error occured while executing JAL script: Line 6: Result set is not : updatable, : //must be singleton select and the affected table must have a primary key. : // : DatabaseDisconnect
|
|
Mon Jan 22, 2001 11:54 pm |
|
 |
weizeyin
Joined: 22 Jan 2001 Posts: 9
|
|
Re: DatabaseUpdate |
|
: What was your question? My question is why DatabaseUpdate( "UPDATE", update_rows) return error message?
|
|
Tue Jan 23, 2001 11:43 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
Re: DatabaseUpdate |
|
The error message that you mentioned in your original post fully answer this question: Job execution error. Exit code: -1. An error occurred while executing JAL script: Line 6: Result set is not updateable, must be singleton select and the affected table must have a primary key. In your case, T99_RH_LOG does not have nether a primary key or an unique index on it. Without it, 24x7 does not know how to construct properly the UPDATE statement. Solution: create unique index on the ID column (or any other appropriate column or column set) : My question is why DatabaseUpdate( "UPDATE", update_rows) return : error message?
|
|
Tue Jan 23, 2001 1:21 pm |
|
 |
weizeyin
Joined: 22 Jan 2001 Posts: 9
|
|
Re: DatabaseUpdate |
|
: The error message that you mentioned in your original post fully answer this : question: Job execution error. Exit code: -1. : An error occurred while executing JAL script: Line 6: Result set is not : updateable, must be singleton select and the affected table must have a : primary key. : In your case, T99_RH_LOG does not have nether a primary key or an unique : index on it. Without it, 24x7 does not know how to construct properly the : UPDATE statement. Solution: create unique index on the ID column (or any : other appropriate column or column set) But,T99_RH_LOG has a primary key on ID,please see "//CREATE TABLE dbo.T99_RH_LOG //( // FILENAME varchar(255) NOT NULL, // ID numeric(16,0) IDENTITY, // CZSJ datetime NULL, // FPBZ char(1) NOT NULL, // CONSTRAINT PK_T99_RH_LOG // PRIMARY KEY NONCLUSTERED (ID) -- see !!! //) //LOCK ALLPAGES //go "
|
|
Wed Jan 24, 2001 4:13 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
Re: DatabaseUpdate |
|
Try without NONCLUSTERED : But,T99_RH_LOG has a primary key on ID,please see : "//CREATE TABLE dbo.T99_RH_LOG : //( : // FILENAME varchar(255) NOT NULL, : // ID numeric(16,0) IDENTITY, : // CZSJ datetime NULL, : // FPBZ char(1) NOT NULL, : // CONSTRAINT PK_T99_RH_LOG : // PRIMARY KEY NONCLUSTERED (ID) -- see !!! : //) : //LOCK ALLPAGES : //go "
|
|
Wed Jan 24, 2001 9:06 am |
|
 |
weizeyin
Joined: 22 Jan 2001 Posts: 9
|
|
Re: DatabaseUpdate |
|
: Try without NONCLUSTERED Sorry,I had modified 'NONCLUSTERED' to 'CLUSTERED',but result was same. //CREATE TABLE dbo.T99_RH_LOG //( // FILENAME varchar(255) NOT NULL, // ID numeric(16,0) IDENTITY, // CZSJ datetime NULL, // FPBZ char(1) NOT NULL, // CONSTRAINT PK_T99_RH_LOG // PRIMARY KEY CLUSTERED (ID) //) //LOCK ALLPAGES //go
|
|
Wed Jan 24, 2001 9:56 am |
|
 |
weizeyin
Joined: 22 Jan 2001 Posts: 9
|
|
Re: DatabaseUpdate |
|
: Try without NONCLUSTERED : Try without NONCLUSTERED Sorry,I had modified 'NONCLUSTERED' to 'CLUSTERED',but result was same. //CREATE TABLE dbo.T99_RH_LOG //( // FILENAME varchar(255) NOT NULL, // ID numeric(16,0) IDENTITY, // CZSJ datetime NULL, // FPBZ char(1) NOT NULL, // CONSTRAINT PK_T99_RH_LOG // PRIMARY KEY CLUSTERED (ID) //) //LOCK ALLPAGES //go
|
|
Thu Jan 25, 2001 12:20 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
Re: DatabaseUpdate |
|
Hm... Are you connecting to database as dbo or some other user, not aliased to dbo? : Sorry,I had modified 'NONCLUSTERED' to 'CLUSTERED',but result was same. : //CREATE TABLE dbo.T99_RH_LOG : //( : // FILENAME varchar(255) NOT NULL, : // ID numeric(16,0) IDENTITY, : // CZSJ datetime NULL, : // FPBZ char(1) NOT NULL, : // CONSTRAINT PK_T99_RH_LOG : // PRIMARY KEY CLUSTERED (ID) : //) : //LOCK ALLPAGES : //go
|
|
Thu Jan 25, 2001 9:34 am |
|
 |
weizeyin
Joined: 22 Jan 2001 Posts: 9
|
|
Re: DatabaseUpdate |
|
: Hm... Are you connecting to database as dbo or some other user, not aliased : to dbo? I had logined to database with 'sa'.
|
|
Thu Jan 25, 2001 10:18 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
Re: DatabaseUpdate |
|
Please try specifying full table name in the SELECT as SELECT FILENAME,ID,CZSJ,FPBZ FROM DBO.T99_RH_LOG WHERE FPBZ='0' If it does not help, please email to support@softtreetech.com to open support case. : I had logined to database with 'sa'.
|
|
Thu Jan 25, 2001 11:40 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|