Questions tagged [varchar2]

The VARCHAR2 datatype stores variable-length character strings.

The VARCHAR2 datatype stores variable-length character strings. When you create a table with a VARCHAR2 column, you specify a maximum string length (in bytes or characters) between 1 and 4000 bytes for the VARCHAR2 column. For each row, Oracle Database stores each value in the column as a variable-length field unless a value exceeds the column's maximum length, in which case Oracle Database returns an error. Using VARCHAR2 and VARCHAR saves on space used by the table.

The VARCHAR datatype is synonymous with the VARCHAR2 datatype. To avoid possible changes in behavior, always use the VARCHAR2 datatype to store variable-length character strings.

http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT1822

192 questions
0
votes
1 answer

MySql varchar type performance

As I understand if you declare a column as varchar(15) or varchar(200), it makes no difference in memory size. If you store a 4-character string it should only use around 4 bytes. This is the same in Oracle for varchar2. But, for Oracle, their…
user1619397
  • 680
  • 2
  • 11
  • 23
0
votes
1 answer

Oracle CLOB to varchar2 over DBLINK

I have to migrate a database to another. I have a dblink to make it easyier. Know I try to copy the colum comments and description from a table. The Problem is that the type is a CLOB. In the new database I use VARCHAR2. I used a workaround and…
John Smithv1
  • 673
  • 5
  • 14
  • 33
-1
votes
2 answers

How to get a string with more than 4000 characters as input to a Store Procedure in PLSQL?

I have a store procedure in oracle which takes string input through a varchar2 type input parameter,I believe that 4000 bytes is the max length we can pass through the parameter, i need to have more characters in my input, what would be a viable…
-1
votes
3 answers

Oracle - How to tell between null and not null string?

In an anonymous block I have an input string that is empty/null and want to check that against a non-null string. Example: DECLARE v_notnull varchar2(50):='this string is never null'; v_input varchar2(50):=''; BEGIN IF trim(v_input) !=…
Hooplator15
  • 1,540
  • 7
  • 31
  • 58
-1
votes
2 answers

ORACLE - Set the length for a varchar2 length based on a query

I am trying to use the CAST function to convert the output of a column in a query, from VARCHAR2(255 CHAR) to VARCHAR2 of a variable length, the final number being returned by a sub-query, like this: SELECT CAST(Title as VARCHAR2(SELECT…
calin.bule
  • 95
  • 1
  • 15
-1
votes
1 answer

NVARCHAR to VARCHAR2 insert

I have the following table structure: UDA_ID (NUMBER) Translation (NVARCHAR2) I need to insert in the table UDA_ID (NUMBER) Translation (VARCHAR2) How do i convert NVARCHAR2 to VARCHAR2 ?
Imran Hemani
  • 599
  • 3
  • 12
  • 27
-1
votes
1 answer

Joining on a varchar to a char does not work in JPA (oracle)

I have an existing DB that two tables are joined based on a string. The problem is that one table column is defined as a varchar2 and the other is a char. Oracle will pad the char with spaces and the varchar2 will not so that when JPA tries to…
KRico
  • 501
  • 2
  • 6
  • 13
-1
votes
1 answer

Name of day padded with spaces prevent proper behavior

I'm trying to go in a if condition in PLSQL when certaint dates are on a specific day in the week. DECLARE v_gebDatum CONSTANT DATE := to_date('21-01-1995', 'dd-MM-yyyy'); v_mathDatum DATE :=…
Politiepet
  • 93
  • 1
  • 2
  • 11
-1
votes
1 answer

difference between char(3) and char(3 char) for the below description

When declaring a CHAR or VARCHAR2 variable, to ensure that it can always hold n characters in any multibyte character set, declare its length in characters—that is, CHAR(n CHAR) or VARCHAR2(n CHAR), where n does not exceed FLOOR(32767/4) =…
raviteja
  • 1
  • 1
-1
votes
1 answer

Performance issue with varchar2 2000 byte column in oracle

i have a column that is varchar2 (2000 bytes), this is an existing column and is being used in many places, the issue is when i am trying to compare with this column the query is taking 30-40 seconds to execute. the query is as simple as…
Dip
  • 1
  • 1
-1
votes
2 answers

Return word in a string

How can I return the second word in a varchar2 data type and blank if there is nothing? The idea is to use a function within a function.
Dave
  • 503
  • 1
  • 8
  • 21
-2
votes
1 answer

What could cause ORA-00910: specified length too long for its datatype?

While running rdsadmin.rds_file_util.read_text_file, I got error "ORA-00910: specified length too long for its datatype". After extensive investigation, I found out the cause. The system is Oracle Database 19c. The data type is VARCHAR2. Parameter…
Brian Fitzgerald
  • 634
  • 7
  • 14
1 2 3
12
13