APPEND Examples
The following examples provide details.
Example 1:
This example illustrates the use of the append statement to add a row to the "employee" table, based on values in variables "namevar" and "numvar".
## append to employee
## (empname = namevar, sal = sal * 1.1, eno = numvar)
Example 2:
This example illustrates the use of the append statement to add interviewees that tested above the minimum grade value to the "employee" table.
## range of i is interviewee
## append to employee (empname = i.name)
## where i.evaluate >= minimum grade
Example 3:
This example appends data from an array of 100 names into the "employee" table. Because the statement is issued many times, the repeat keyword is specified. This example assumes that "names" has been declared and initialized as an array of 100 character strings, and "i" has been declared as an integer.
i = 1
loop until i > 100 ## repeat append to employee (empname = @names(i))
i = i + 1
end loop
Example 4:
This example shows the use of a null indicator to assign null to the "age" column if the employee's age is not known.
loop while more rows in data set
read name, salary, dept, age from data set
if eage = 0 then
nullind = -1
else
nullind = 0
## append to employee
## (empname = name, #salary = salary, edept = dept,
## eage = age:nullind)
end loop
Last modified date: 08/28/2024