Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inexplicable exception upon create.

Status
Not open for further replies.

delphiman

Programmer
Dec 13, 2001
422
ZA
Hi folks!

I am relatively new to SQL and Interbase 6 and need a bit of help.

I have the following code which works insofar as
(upon using the Interactive SQL in IBConsole of Interbase 6)
I can succesfully run the routine below.

It has the required result in that it won't allow me to enter
data into Tables PSWRD or PDCTS unless I already have something
in P_NO OF Table SAPARENT.

But I don't understand the significance of the following exception
which arises after running the Create routine.

Can someone throw some light on this please?

"Invalid request BLR at offset 21
generator PK_GEN_SAPARENT is not defined
Statement: CREATE TRIGGER PK_GEN_SAPARENT FOR SAPARENT
ACTIVE BEFORE INSERT POSITION 0
as
begin
new.P_NO = gen_id(PK_GEN_SAPARENT, 1);
end"

Thanks in advance.

TERRY
 
Sorry! I ommited to put in the code which is as follows ...

CREATE DATABASE "C:\h\DataBase\SAPARENT.gdb" PAGE_SIZE 4096 user "SYSDBA" password "masterkey";
CREATE DOMAIN TNOTNULLID AS INTEGER NOT NULL;
CREATE DOMAIN TINT AS INTEGER;
CREATE DOMAIN GEN25_M AS VARCHAR(25) NOT NULL;
CREATE DOMAIN GEN10 AS VARCHAR(10);

CREATE TABLE SaParent(
P_NO TNOTNULLID,
PNAME GEN25_M,
PRIMARY KEY (P_NO)
);
Commit Work;

CREATE TABLE PSWRDS(
PW_NO TNOTNULLID,
P_NO TNOTNULLID CONSTRAINT VALID_UID_IN_PSWRDS REFERENCES SAPARENT(P_NO),
PW_NAME GEN25,
PRIMARY KEY (PW_NO)
);
Commit Work;

CREATE TABLE PDCTS(
PDCT_NO TNOTNULLID,
P_NO TNOTNULLID CONSTRAINT VALID_UID_IN_PDCTS REFERENCES SAPARENT(P_NO),
PDCT_NAME GEN10,
PRIMARY KEY (PDCT_NO)
);
Commit Work;

SET TERM ^ ;

CREATE TRIGGER PK_GEN_SAPARENT FOR SAPARENT
ACTIVE BEFORE INSERT POSITION 0
as
begin
new.P_NO = gen_id(PK_GEN_SAPARENT, 1);
end
^
CREATE TRIGGER PK_GEN_PSWRDS FOR PSWRDS
ACTIVE BEFORE INSERT POSITION 0
as
begin
new.PW_NO = gen_id(PK_GEN_PSWRDS, 1);
end
^
CREATE TRIGGER PK_GEN_PDCTS FOR PDCTS
ACTIVE BEFORE INSERT POSITION 0
as
begin
new.PDCT_NO = gen_id(PK_GEN_PDCTS, 1);
end
^
COMMIT WORK ^
SET TERM ; ^

SET BLOBDISPLAY 1;
SET TERM ;;
SET NAMES ;
EXIT;
SET BLOBDISPLAY 1;
SET TERM ;;
SET NAMES ;
EXIT;

The exception is

"Invalid request BLR at offset 21
generator PK_GEN_SAPARENT is not defined
Statement: CREATE TRIGGER PK_GEN_SAPARENT FOR SAPARENT
ACTIVE BEFORE INSERT POSITION 0
as
begin
new.P_NO = gen_id(PK_GEN_SAPARENT, 1);
end"

Thanks in advance.

TERRY
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top