Skip to Main Content
  • Questions
  • load date into apex 20.1 with defaults for some columns

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Loai.

Asked: October 13, 2020 - 4:36 pm UTC

Answered by: Connor McDonald - Last updated: October 16, 2020 - 4:11 am UTC

Category: Application Express - Version: 20.1

Viewed 100+ times

You Asked

I want to insert data from excel or csv file (Id, Name, Address, Amount) into database table by using data load but during the insert of this data i want to decide this data is related to HSBC Bank (Because i have many bank and each bank have thousand of customer). so how i can insert the name of HSBC bank to the table during the load of data (Note that the excel or csv file did not contain the name of HSBC bank).

and we said...

Yes, you just need a default on the column.

For example, I did this

1) table with default

create table asktom.t ( pk int generated as identity primary key, x int, y int default 0 );

2) Create an APEX app with a standard data loader page. I then ran it with the following data

1
2
3
4

(ie, only 1 column worth of data). I get prompted to choose which column to load that into (I chose X).

3) The data then loads and I look at the table

SQL> select * from asktom.t;

        PK          X          Y
---------- ---------- ----------
         1          1          0
         2          2          0
         3          3          0
         4          4          0
         5          5          0
         6          6          0
         7          7          0
         8          8          0
         9          9          0
        10         10          0

10 rows selected.


You can see the Y picks up its default without incident.


More to Explore

APEX

Keep your APEX skills fresh by attending their regular Office Hours sessions.