I need to make all my products to have a caracteristic(id 5) so im trying to make a procedure that will insert into a table 'product-caracteristics' a line with its atributes, linking all products IDs with the caracteristic id 5. Thats what I have so far :
BEGIN
FOR SELECT ID-PROD FROM PRODUCT INTO :VAR1 DO
BEGIN
INSERT
INTO PRODUCT-CARACTERISTICS(
ID-PRODUCT-CARACTERISTICS, //char9
ID-CARACTERISTICS, //char9
ID-PROD, //char9
DATE-CARACTERISTICS //date
)
VALUES (
'', //its a pk, so it should be automatic, right?...
'000000005',
:VAR1,
'04.03.2015'
);
END
END
Another thing, if possible i would like to know how to make this only for the products that doesnt have caracteristic5.
(if its relevant, the application is IBExpert, using firebird 2.0, SQL dialect 3.0) Thanks in advance.