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
1
vote
0 answers

Oracle XML table export objecttype not giving

If I do a export of a table with a field of type varchar2(12 char) or varchar2(12 byte) I only get in the XML file fields of type varchar2(12). Can you get the object type of a varchar2 field in the XML export file ? example create table TEST_XML…
PeterL
  • 11
  • 2
1
vote
1 answer

Oracle 12 equal and not equal (=, !=, <>) behavior about nvarchar2 working problem

In oracle an empty varchar2 and null are treated the same because Oracle internally changes empty string to NULL values. Please consider following example : --1- create table CREATE TABLE persons( person_id NUMBER GENERATED BY DEFAULT AS…
afshar
  • 523
  • 4
  • 16
1
vote
1 answer

How do I check that a varchar2 variable in PL/SQL is like 10 characters in a trigger?

How do I check that a varchar2 variable in PL/SQL is like 10 characters in a trigger? And does it automatically proceed with the insert it its good? --trigger that checks that number of characters are 10, doesnt work create or replace trigger…
Chris_45
  • 8,769
  • 16
  • 62
  • 73
1
vote
2 answers

What is the default value of VARCHAR2 in Oracle?

I have a column in one of my tables that is of type varchar2(2000), but does this mean 2000 bytes? or 2000 characters? Because I know there's a difference between bytes and characters...
samg
  • 311
  • 1
  • 8
  • 21
1
vote
1 answer

Assigning TO_CHAR result to VARCHAR2, NVARCHAR2

1) In Oracle, can I store result of TO_CHAR to VARCHAR2, NVARCHAR2? It seems Yes, according to below code, though. CREATE TABLE TBL ( R1 VARCHAR2(15), R2 NVARCHAR2(15), R3 NVARCHAR2(15) ); INSERT INTO TBL(R1, R2) VALUES…
Soon
  • 491
  • 3
  • 16
1
vote
0 answers

SSIS Trims When copying from one Oracle VARCHAR2 to another Oracle VARCHAR2 column

I'm new with SSIS. We are using it to copy data from one Oracle Database to another one. The structure of the destination is identical to the source. I expect SSIS to copy the data without any changes. But when i have a VARCHAR2 with a content like…
Gabriel82
  • 41
  • 4
1
vote
1 answer

Fetch oracle data VARCHAR2(N BYTE) return blank string in JAVA

I would like to know what's going on when, I'm trying to fetch data from ORACLE database. The datatype of the column is VARCHAR2(40 BYTE) NOT NULL ENABLE. From @Thoma advise in comment section I've changed the pics into text. In SQL DEVELOPPER, I…
kizawa tomaru
  • 103
  • 1
  • 8
1
vote
2 answers

increment function in plsql varchar2

I want use this in a varchar2. Ex.: declare num number := &Number; serie varchar2(200) := 'S = '; begin for x in 1 .. num loop serie += x, ' + '; end loop; ` end; / In the end I want that the serie be like "S = 1 + 2 + 3 ..." How can i…
Giulio
  • 13
  • 2
1
vote
0 answers

How to insert more than 2000 char in Oracle column of type Varchar2(4000 char) from Java Code

I am trying to insert 2000 char(ASCII char should take 1 byte only) into column of type Varchar2(4000 char) using Spring JDBC Template. But I am always getting the following error java.sql.SQLException: ORA-01461: can bind a LONG value only for…
Ankur Singh
  • 339
  • 3
  • 16
1
vote
1 answer

Error in my sql (varchar2)

I have the following error in all my tables where I am using varchar2 error ORA-01438: value larger than specified precision allowed for this column although I have used characters less than the specified length Note: I am using oracle apex
1
vote
2 answers

Max size in a connected by prior Oracle

I've got some help turning my table of the sort: Col 23 25 15 53 ... into something like 23,25,15,53... The query that does it is SELECT max(ltrim(sys_connect_by_path(flow_run_id, ','), ',')) FROM (select flow_run_id, rownum rn from table …
filippo
  • 5,583
  • 13
  • 50
  • 72
1
vote
1 answer

OracleCommand doesn't pick up LONG data types on ExecuteReader

I have a select query which retrieves a LONG data type value. SQL Developer execution pulls the data but the OracleCommand doesn't retrieve the value. Instead it returns empty strings even though I know that the values exist in the database. Is…
h-rai
  • 3,636
  • 6
  • 52
  • 76
1
vote
1 answer

How to delete from table with number stored as varchar2

This might be a silly question but here we go. Let's say I have a table 'MyTable' with one column 'Number' stored as varchar2. Is there any way to delete from this table the lines where the value from 'Number' is smaller than my input? Something…
Lerul Ler
  • 339
  • 7
  • 21
1
vote
1 answer

Convert datatype to Date format

I am unable to make data type of a column as DATE while creating view, default data type is varchar2. How can I change it to DATE column. Below is the column definition: TO_CHAR(DATE'1970-01-01' + ( 1465484488329 / 86400000 ), 'YYYY/MM/DD…
ankitpandey
  • 339
  • 1
  • 7
  • 23
1
vote
2 answers

How to define varchar2

I need to add a column with varchar2 data type in teradata sql , for example ALTER TABLE table_name ADD column_name varchar2 (20); But in teradata its not taking varchar2 as a defined type name.
Ravi
  • 11
  • 1