19.8 GENERATE_DATA Procedure Signature 1
This procedure creates rows of data based on the blueprint tables and their columns customizations.
This procedure inserts data into tables in the schema when the p_format is set to INSERT INTO or FAST INSERT INTO. The outputs do not contain data (all are set to NULL).
                  
This procedure also generates data in a file. For that file, the three outputs contain the following data:
- p_output(BLOB) with the data output. Contents can be inside a JSON, CSV, ZIP, or SQL file.
- p_file_extand- p_mime_type(VARCHAR2) indicates the file extension and its MIME type.
These three output parameters send the file to the user's browser so it can be handled client-side.
In both scenarios, p_errors may have a NULL value or a CLOB with a JSON output that contains any errors.
                  
Syntax
APEX_DG_DATA_GEN.GENERATE_DATA (
    p_blueprint             IN          VARCHAR2,
    p_format                IN          VARCHAR2,
    p_blueprint_table       IN          VARCHAR2 DEFAULT NULL,
    p_row_scaling           IN          NUMBER DEFAULT 100,
    p_stop_after_errors     IN          NUMBER DEFAULT c_max_error_count,
    p_output                OUT NOCOPY  BLOB,
    p_file_ext              OUT NOCOPY  VARCHAR2,
    p_mime_type             OUT NOCOPY  VARCHAR2,
    p_errors                OUT NOCOPY  CLOB )Parameters
Table 19-8 GENERATE_DATA Parameters
| Parameter | Description | 
|---|---|
| p_blueprint | Name of the blueprint. | 
| p_format | Can be set to one of the following options: 
 
 
 
 
 | 
| p_blueprint_table | Null for all tables. If not null, generates data only for designated table. If not null, must be table name of a table within the blueprint. This value is case sensitive. | 
| p_row_scaling | Scales the number of rows defined into the blueprint by this percentage value. | 
| p_stop_after_errors | How many errors can happen before the process is stopped. This is only applicable for INSERT INTO. | 
| p_output | The blob to hold the output. Null for INSERT INTOandFAST INSERT INTO. | 
| p_file_ext | The file extension of the output. Null for INSERT INTOandFAST INSERT INTO. | 
| p_mime_type | The MIME type of the output. Null for INSERT INTOandFAST INSERT INTO. | 
| p_errors | JSON output of any errors. NULLupon success. | 
Example
DECLARE
    l_output    blob;
    l_file_ext  varchar2(255);
    l_mime_type varchar2(255);
    l_errors    clob;
BEGIN
    apex_dg_output.generate_data
        (p_blueprint          => 'Cars',
         p_blueprint_table    => 'my_cars',
         p_stop_after_errors  => 100,
         p_output             => l_output
         p_file_ext           => l_file_ext,
         p_mime_type          => l_mime_type,
         p_errors             => l_errors
        );
END;Parent topic: APEX_DG_DATA_GEN