Products Downloads


French version


 


ADELIA

VADELIA

SADELIA

WADELIA

EADELIA

(I/B)

(I/B) (S)

(B) (S)

(I/B) (S)

(B) (S)


Warning: In the case of ADELIA programs, this instruction is only compatible with the RPG generator.


Section for use

All


Syntax

UPD_SQL EntityName SetColumnUpd AdeliaCondition NullParameter MRParameter


SetColumnUpd

SetColumn | *ALL



SetColumn

SetColumn, Field = Expression



| Field = Expression | Field = :HostVarId

:HostVarId

VarId | VarId  :IndicatorVarId



NullParameter

*NULL_IND | None



MRParameter

*NO_MR | *MR | None

Description

This instruction updates one or more fields in a record in a given entity EntityName, obeying the (optional) condition AdeliaCondition and modifying the values specified in the fields Field.


It is equivalent to the SQL instruction: "Update EntityName set Field1 = expression where AdeliaCondition".


*ALL indicates that all the fields in the entity (except the possible auto increment-type property) will be updated, inserting the values of the entity variables matching the fields.



Expression is an alphanumeric or numeric Adelia expression.


For programs other than ADELIA, you can also check that the record is not locked, by testing it with the *LOCKED reserved word.


The *NULL_IND parameter allows you to take into account the management of NULL values when writing the lines. These values result from a reading operation or from the use of the SET_INDICATOR instruction.

This parameter is only used if the SetColumnUpd parameter is set to *ALL.

If you want the column values to be null and you specify which columns are to be updated, you should specify two variables for HostVarId: an allocation variable, VarId, and an indicator variable, IndicatorVarId (a NUM_BIN_2 variable containing a negative value (-1) to indicate that the column is to take a null value, and 0 to have the column take the value contained in VarId).


The *MR parameter allows you to generate update implicit management rules that are linked to the entity, even if the program is generated without the option to generate implicit management rules.


The *NO_MR parameter allows you not to generate update implicit management rules that are linked to the entity, even if the program is generated with the option to generate implicit management rules.


After this instruction has been run, it is possible to test the SQL return code with the *SQLCODE reserved word.


Example

UPD_SQL ITEM *ALL *COND(ITEM_ID = :ZITEM:Value) *NULL_IND


UPD_SQL ORDER OAMOUNT = OAMOUNT * 0,9 , OUPD_DATE = :DATE *COND(OORDER_NBR = :ZORDER_NBR)


IF INVOICE_CREATED = 'O'

INVOICE_INDICATOR = 0

ELSE

INVOICE_INDICATOR = -1

END

UPD_SQL ORDER OAMOUNT = OAMOUNT * 0,9 -

OINVOICE NBR = :ZINVOICE_NBR :INVOICE_INDICATOR -

OUPD_DATE = :DATE *COND(OORDER_NBR = :ZORDER_NBR)



↑ Top of page

  • Aucune étiquette