Reputation: 1
I am new to Oracle SQL and I wasn't able to find correct answer to it.
For example I'm creating new table.
CREATE TABLE "DATASTORE"."NEWTABLE_A"
("BUSINESS_NAME" VARCHAR2(100 BYTE),
"TYPE" VARCHAR2(100 BYTE))
How do I identify the length of strings? Should have to find the longest word in column and calculate it in BYTES?
Thanks
Upvotes: 0
Views: 86
Reputation: 142710
Set it to be "large enough". Quite often it is pure estimation.
In your example, if "types" are - for example - A, CX and DDF, then setting that column to 100 bytes is far too much. But, if it can be anything between A and 7-words string, then 100 bytes might be just fine.
Certain columns are simpler to estimate or know for sure (such as "date of birth" - it'll be DATE datatype; or 2-gender sex - you'd use VARCHAR(1)). Others are rather difficult, so - give your best and estimate as close as you can. Even if you fail, you can alter table and modify column length. Though, that might cause problems in programs you based on that table.
Upvotes: 1