mbleron / ExcelTable

ExcelTable is an Oracle SQL interface to read Microsoft Excel files (.xlsx, .xlsm, .xlsb, .xls, .xml), ODF spreadsheet files (.ods) and flat files as external tables
MIT License
45 stars 12 forks source link

DML API insert static values from PLSQL #6

Closed jordancortes closed 5 years ago

jordancortes commented 6 years ago

Is there a way to include static values coming from PLSQL variables as part of the new DML API INSERT operation?

For example

DECLARE
    ctx         ExcelTable.DMLContext;
    nrows       INTEGER;
    user_email  VARCHAR2(100);
BEGIN
    -- Set variables
    ctx := ExcelTable.createDMLContext('TMP_SAMPLE2');
    user_email := 'myEmail@provider.com';

    ExcelTable.mapColumn(ctx, p_col_name => 'NAME',         p_col_ref => 'B');
    ExcelTable.mapColumn(ctx, p_col_name => 'VAL',          p_col_ref => 'C');
    ExcelTable.mapColumn(ctx, p_col_name => 'CREATED_BY',   /* a way to referece variable user_email*/);

    nrows := ExcelTable.loadData(
        p_ctx      => ctx
        , p_file     => ExcelTable.getFile('XL_DATA_DIR','sample_2.xlsx')
        , p_sheet    => 'DataSource'
        , p_dml_type => ExcelTable.DML_INSERT
    );
END;
/
mbleron commented 6 years ago

It's currently not possible, but I'll consider it for a future release.

Thanks.

mbleron commented 5 years ago

Implemented in v3.1