Condividi tramite


Arrays and SELECT - SQL

SELECT - SQL is a versatile command for querying tables and can direct query results to an array.

To send SELECT - SQL query results to an array, specify the INTO ARRAY clause with an array name. If the array doesn't exist, it is automatically created. If the array does exist, it is redimensioned automatically to accommodate the query results.

Example

In the following example, SELECT - SQL directs its query results to an array named RESULTS:

SELECT DISTINCT a.cust_id, a.company, b.amount ;
FROM customer a, payments b ;
WHERE a.cust_id = b.cust_id INTO ARRAY results

DISPLAY MEMORY LIKE results

RESULTS   Priv A            TEST
  ( 1, 1)   C  "000004"
  ( 1, 2)   C  "Stylistic Inc."
  ( 1, 3)   N    13.91  (    13.91000000)
  ( 2, 1)   C  "000008"
  ( 2, 2)   C  "Ashe Aircraft"
  ( 2, 3)   N    4021.98  (  4021.98000000)
  ( 3, 1)   C  "000010"
  ( 3, 2)   C  "Miakonda Industries"
  ( 3, 3)   N     9.84  (   9.84000000)

See Also

SELECT - SQL Command | Data Transfer and Arrays | Data Manipulation | Data Transfer from a Table to an Array | Data Transfer from an Array to a Table