Subject | Insert within a stored procedure not inserting records |
---|---|
Author | Peter Welch |
Post date | 2007-09-19T19:42:21Z |
I am trying to Insert within a stored procedure but it does not work -
-- the data are not saved in the table, but there are no
exceptions/violations either.
OTOH, if I pull out the very same Insert Statement from the Stored
Procedure and run it in IB_SQL's DSQL (Jason's beta 15 release), with
literal values, it works just fine.
I know the stored procedure is getting called because if I manually
add a record and then run the sp again, it causes the Unique
constraint violation when it gets to that MRN value.
I have tried various flavors of this stored procedure but the result
is always the same - it just won't insert the records. Oddly, there
are other similar stored procedures working just fine.
The following is the metadata:
Create PROCEDURE INS_SC ( MRN INTEGER
, ADMITDATETIME TIMESTAMP
, STATUS CHAR( 1 ) )
AS
BEGIN
insert into sc_list
(mrn, admitdatetime, status)
values (? /* PRM_0 */ , ? /* PRM_1 */ ,? /* PRM_2 */ );
END
CREATE TABLE SC_LIST (
MRN VARCHAR( 20 ) NOT NULL
, ADMITDATETIME TIMESTAMP
, STATUS CHAR( 1 ) Default 'I'
, CREATEDATETIME TIMESTAMP DEFAULT 'NOW' NOT
NULL
, CONSTRAINT INTEG_78
UNIQUE ( MRN )
)
====
Using Firebird 2.1 Beta1 64bit classic on Debian Linux AMD 64 though
it also failed to work in Alpha1 2.1
The calling program is written in Delphi 2007 with Jason's IBObjects
4.87E, though I can and have called the stored procedure directly
within IB_SQL dsql with the same results.
I've been wrestling with this for several days.
Things attempted:
backup/restore the database
Delete and recreate the sc_list table
Recreate the stored procedure
Change parameters and datatypes
Thank you all who bother to think about this problem..
-- the data are not saved in the table, but there are no
exceptions/violations either.
OTOH, if I pull out the very same Insert Statement from the Stored
Procedure and run it in IB_SQL's DSQL (Jason's beta 15 release), with
literal values, it works just fine.
I know the stored procedure is getting called because if I manually
add a record and then run the sp again, it causes the Unique
constraint violation when it gets to that MRN value.
I have tried various flavors of this stored procedure but the result
is always the same - it just won't insert the records. Oddly, there
are other similar stored procedures working just fine.
The following is the metadata:
Create PROCEDURE INS_SC ( MRN INTEGER
, ADMITDATETIME TIMESTAMP
, STATUS CHAR( 1 ) )
AS
BEGIN
insert into sc_list
(mrn, admitdatetime, status)
values (? /* PRM_0 */ , ? /* PRM_1 */ ,? /* PRM_2 */ );
END
CREATE TABLE SC_LIST (
MRN VARCHAR( 20 ) NOT NULL
, ADMITDATETIME TIMESTAMP
, STATUS CHAR( 1 ) Default 'I'
, CREATEDATETIME TIMESTAMP DEFAULT 'NOW' NOT
NULL
, CONSTRAINT INTEG_78
UNIQUE ( MRN )
)
====
Using Firebird 2.1 Beta1 64bit classic on Debian Linux AMD 64 though
it also failed to work in Alpha1 2.1
The calling program is written in Delphi 2007 with Jason's IBObjects
4.87E, though I can and have called the stored procedure directly
within IB_SQL dsql with the same results.
I've been wrestling with this for several days.
Things attempted:
backup/restore the database
Delete and recreate the sc_list table
Recreate the stored procedure
Change parameters and datatypes
Thank you all who bother to think about this problem..