Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP + Oracle + SQL Insert
Message
 
 
À
12/01/2001 18:15:04
Anderson Girardi
Athenas Automação de Escritório
Porto Alegre, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00463273
Message ID:
00463291
Vues:
14
>Dear Friends,
>
>I´m trying to do the follow statemant
>
>Insert Into Programa (Id_Programa, Data) Values ('Id_Programa.NextVal','10/10/2000)
>
>but the VFP shows me a error saying that i can insert NULL in SIC. Programas. Id_Programa.
>
>what is wrong?
>
>Thanks

You have to create an insert trigger to populate the ID_Programa field with the NextVal of your ID_Programa sequence. You can not use NextVal like a value. YOu have to Select ID_Programa from dual into v_ID variable to actually get the value. A trigger example is below. You also have to grant SELECT privilege to your users on any sequence. You should also create a public synonym for any sequence and table.
create or replace trigger PROGRAMA_BEFORE_INSUPDT
 BEFORE INSERT OR UPDATE ON SCHEMA.PROGRAMA FOR EACH ROW
DECLARE
 v_Id    Number;
BEGIN
 IF :new.ID_Programa Is Null or :new.ID_Programa < 1 THEN
    select ID_Programa.nextval into v_Id from dual;
    :new.ID_Programa := v_Id;
 END IF;
END;
/
Then all you have to do is issue your SQL without including ID_Programa in the list:

Insert Into Programa (Data) Values ('mydata')
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform