Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Oracle Updates From The Pits of....Help
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00752077
Message ID:
00752263
Vues:
9
>The Primary key is checked and the update is checked beside it.
>I don't understand.
>It updates every record regardless of the filter I use.

You really do not want to check the Update box for the PK field. Only the PK box should be checked. You should have a PK generator to populate this field if it is a new record. Since this is Oracle, how are you generating the PK? I strongly advise you add a NUMBER(8) column to your tables and define that as the PK. Then use an Oracle sequence and Insert/Update Trigger to populate the PK column. To create these in the Oracle schema, the syntax looks like:
create sequence s_schema_CUSTOMERS start with 1 increment by 1 nocache;

create or replace trigger CUSTOMERS_BEFORE_INSUPDT
before insert or update on schema.CUSTOMERS for each row
 declare
  v_Id   Number;
 BEGIN
  :new.Updated_By := USER;
  :new.Last_Update := SYSDATE;
  If :new.PrimaryKeyID Is Null or :new.PrimaryKeyID < 1 Then
     select s_schema_CUSTOMERS.nextval into v_Id from dual;
     :new.PrimaryKeyID := v_Id;
  End If;
End;
/
All my Oracle tables also have a Last_Update [Date] and Updated_By [varchar2(20)] column. So these columns get updated everytime a record is edited or inserted.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform