Ankit Saxena
Ankit Saxena

Reputation: 1

Difference between varchar2(16 Char) and varchar2(16)

In one table I am defining field as

FORACID VARCHAR2(16 CHAR)

Output of query : select foracid from tbaadm.gam where rownum <= 5;

FORACID
----------------------------------------------------------------
00000063011015
00000063011028
00000063011024
00000063011023
00000441021004

In another table I am defining field as

FORACID VARCHAR2(16)

Output of query : select foracid from tbaadm.gam where rownum <= 5;

FORACID
----------------
0382010021491
UB3
3667
PCAP
LO-CCA2

You can see that in the first query, the spool is of size 64 (i.e 16 char i.e 16*4=64) In the second query, the spool is of 16 size (i.e 16 byte i.e 16*1 = 16)

How can I make the spool output of first query also to show only 16 size.? Is it possible?

Upvotes: 0

Views: 1896

Answers (1)

MT0
MT0

Reputation: 167902

You can format SQL/Plus reports (spooled queries) by issuing formatting directives before the query

COLUMN FORACID FORMAT A16;                          -- A = Alphabetic, 16 = Column Width
SELECT FORACID FROM tbaadm.gam WHERE ROWNUM <= 5;

Upvotes: 1

Related Questions