Oops. Still dangerous.
Bruce
-------- Original Message --------
Subject: [RBASE-L] - Re: Create FK in temporary table
From: Karen Tellef <[email protected]>
Date: Fri, February 15, 2013 7:11 am
To: [email protected] (RBASE-L Mailing List)

That will work as long as multi-user isn't a problem.  What if >1 person is
inserting into the table at once, or one user deletes all the rows before the
other one is finished?   I would be tempted to keep the table as temp and
use other means of checking for row validation.  You can either put a "on row
exit" eep to check the validity against other tables, or let them type away
and on the "save" button do your checking there and keep them in the form
until all errors have been fixed.


Karen




-----Original Message-----
From: Juan Otazú <[email protected]>
To: RBASE-L Mailing List <[email protected]>
Sent: Fri, Feb 15, 2013 6:00 am
Subject: [RBASE-L] - Re: Create FK in temporary table

Yes, I am doing it with the same name.
 
Thanks to all !
Regards
Juan Otazú
 
From: [email protected] [mailto:[email protected]] On Behalf Of Bruce Chitiea
Sent: jueves, 14 de febrero de 2013 07:04 p.m.
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Create FK in temporary table
 
Señor:
 
Why not then create a permanent table with the desired keys when needed, and then either:
 
a) drop the table after, or
 
b) delete all rows and preserve for next use.
 
While this might require more frequent PACKing, might this work for you?
 
Bruce Chitiea
SafeSectors, Inc.
-------- Original Message --------
Subject: [RBASE-L] - Re: Create FK in temporary table
From: Juan_Otazú <[email protected]>
Date: Thu, February 14, 2013 1:01 pm
To: [email protected] (RBASE-L Mailing List)
I am using 9.5 (32).. I think the same.
 
An opportunity to improve, because temporary table is very usefully to enter data using a form.
 
Thanks.
Juan
 
 
From: [email protected] [mailto:[email protected]] On Behalf Of Karen Tellef
Sent: jueves, 14 de febrero de 2013 04:54 p.m.
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Create FK in temporary table
 
You don't mention what version you're using.  I just fired up 9.5 and created a temp
table and then an FK on it and I got an error.  I fired up an old copy of 6.5 and it doesn't
work there either, so I assume this has never worked.

Karen
 
 
 
-----Original Message-----
From: Juan Otazú <[email protected]>
To: RBASE-L Mailing List <[email protected]>
Sent: Thu, Feb 14, 2013 1:42 pm
Subject: [RBASE-L] - Re: Create FK in temporary table
Thanks Karen, first I tried this process, the same error.
 
CREATE TEMPORARY TABLE tdexpara_cambios (momento DATETIME, codpais INT NOT NULL+
       ('ESPECIFIQUE A QUE PAIS CORRESPONDE'), material_anterior INT NOT NULL  +
       ('INGRESE CODIGO DE MATERIAL ANTERIOR'), material_actual INT NOT NULL   +
       ('INGRESE CODIGO DE MATERIAL ACTUAL'), artdes_anterior TEXT 40,         +
       artdes_actual TEXT 40, PRIMARY KEY (codpais, material_anterior)         +
       ('MATERIAL ANTERIOR DUPLICADO EN LA LISTA'), CHECK (material_actual <>  +
       material_anterior))
 
ALTER TABLE tdexpara_cambios ADD FOREIGN KEY (material_actual) REFERENCES      +
      sap_material
 
All the PK and Rules definition works in temporary table except the FK. (At least for me).
 
This could be a issue?
 
Thanks
Juan
 
From: [email protected] [mailto:[email protected]] On Behalf Of Karen Tellef
Sent: jueves, 14 de febrero de 2013 04:14 p.m.
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Create FK in temporary table
 
I've never tried to create a FK on a temp table so can't tell you if that works
or not.  But you can create the temp table first and then use the alter command
to add the FK afterwards.  See if that works.  Here's an example:

ALTER TABLE mpsinvoice ADD FOREIGN KEY (vendornum) REFERENCES vendors


Karen
 
 
 
-----Original Message-----
From: Juan Otazú <[email protected]>
To: RBASE-L Mailing List <[email protected]>
Sent: Thu, Feb 14, 2013 1:05 pm
Subject: [RBASE-L] - Create FK in temporary table
Hi to all,
 
I need to create a temporary table to enter data into a form and validate
some PK, FK rules.
 
This command work fine:
CREATE TABLE tdexpara_cambios (momento DATETIME, codpais INT NOT NULL
+
       ('ESPECIFIQUE A QUE PAIS CORRESPONDE'), material_anterior INT NOT
NULL  +
       ('INGRESE CODIGO DE MATERIAL ANTERIOR'), material_actual INT NOT NULL
+
       ('INGRESE CODIGO DE MATERIAL ACTUAL'), artdes_anterior TEXT 40,
+
       artdes_actual TEXT 40, PRIMARY KEY (codpais, material_anterior)
+
       ('MATERIAL ANTERIOR DUPLICADO EN LA LISTA'), FOREIGN KEY
+
       (material_anterior) REFERENCES sap_material
+
       ('MATERIAL ANTERIOR NO EXISTE EN SAP'), FOREIGN KEY (material_actual)
+
       REFERENCES sap_material ('MATERIAL ACTUAL NO EXISTE EN SAP'), CHECK
+
       (material_actual <> material_anterior))
It is a regular table.
 
But this do not work:
CREATE TEMPORARY TABLE tdexpara_cambios (momento DATETIME, codpais INT NOT
NULL+
       ('ESPECIFIQUE A QUE PAIS CORRESPONDE'), material_anterior INT NOT
NULL  +
       ('INGRESE CODIGO DE MATERIAL ANTERIOR'), material_actual INT NOT NULL
+
       ('INGRESE CODIGO DE MATERIAL ACTUAL'), artdes_anterior TEXT 40,
+
       artdes_actual TEXT 40, PRIMARY KEY (codpais, material_anterior)
+
       ('MATERIAL ANTERIOR DUPLICADO EN LA LISTA'), FOREIGN KEY
+
       (material_anterior) REFERENCES sap_material
+
       ('MATERIAL ANTERIOR NO EXISTE EN SAP'), FOREIGN KEY (material_actual)
+
       REFERENCES sap_material ('MATERIAL ACTUAL NO EXISTE EN SAP'), CHECK
+
       (material_actual <> material_anterior))
 
The message say: -ERROR- The referenced table does not exist. (2801)
Do not create the temporary table.
 
The only one change has been add "temporary" to line 1.
 
Some issues to connect temporary FK to regular PK ?
 
Thanks in advance.
R:egards
Juan Otazú
R:Base 9.5 (32)
 
 




Reply via email to