Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

While creating a table dynamically, length of a column has issue

TinaJun 6 2018 — edited Jun 6 2018

Hi Gurus,

  I have one table created dynamically in one shell script.

  Actual query has lots of columns selected from real tables.

  There are few columns which are created like below (0 as id , 'ABC...Z' AS Value etc), which we populate later.

   When you describe this table it is :

                      ID NUMBER

                      VALUE CHAR(26 BYTE)

However, when you insert into this table, even if 'value' is <26 bytes, it shows length as 26 bytes.

This creates issue during UNION where I am expecting distinct.Any idea if there is any way we can resolve this issue?

CREATE TABLE TEST

AS (

SELECT

0 AS ID,

'ABCDEFGHIJKLMNOPQRSTUVQZYZ' AS VALUE

FROM DUAL S

WHERE 1 = 0);

insert into test values(1,'abc');

select length(id), length(VALUE) from Test;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2018
Added on Jun 6 2018
3 comments
419 views