You can save multiple values in a single bank field

1

I declare the field in the database like this:

descricao VARCHAR2(5)not null,

You can, for example, save 1 , 2 , 3 , 4 a single record) in the descricao field, where each of these values refers to a specific thing.

    
asked by anonymous 16.10.2016 / 03:13

2 answers

2

Yes, it is possible, if the column is varchar you can put whatever text you want inside it. But it is seldom the right thing to do. It may be your case, I do not know what you want. Of course your application will have to know how to handle it properly.

If you have 5 values at all, create 5 columns. If it goes from 0 to 5 values, it may be useful to do the same. But it can be considered wasteful, some say it's a case for database normalization .

You can also create a varray , but it's a topic much more advanced.

You can do this in C # or any other language that has the ability to access all Oracle features.

    
16.10.2016 / 03:31
0

An easy and simple way is to use a separator character in the varchar field. example '|' (pipe) and format in SQL in the database and query insert.

But I do not think it necessary or recommend it, if you still want to know how, send me a PM ... I recommend that you follow the instructions of the friend bigown ♦     

18.10.2016 / 16:11