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

Converting oracle datatype into teradata datatype

I have a column in oracle table of data type as varchar2. I am re-creating the same table in Teradata. what should the datatype in Teradata be for this column? Will it be varchar() ? Any help is greatly appreciated. Thanks in advance!
user3903418
  • 143
  • 1
  • 1
  • 11
0
votes
1 answer

Oracle SQL, get varchar2 column with greater length in select statement

I have a varchar2(8) column in a table, and I want to convert it to varchar2(100) in the select statement (i.e. I don't want to to call an "alter table" afterwards).* Is it possible? Is there some function like "to_varchar2(x, 100)"? (*) the reason…
Giuseppe
  • 518
  • 10
  • 22
0
votes
1 answer

Casting a column value as VARCHAR2() that holds 9 characters (TOPIC: ORACLE SQL & PL for Developers)

I've cast a column value as VARCHAR2(9) in my query to make it as a varchar2() that hold 9 characters. It's been suggested to me that VARCHAR2(10) works better and should be a solution to any requirement that asks for VARCHAR2 capable of holding 9…
user901
  • 3
  • 2
0
votes
2 answers

CAST(VARCHAR2 AS NUMERIC) with "." in the VARCHAR

I have a problem when converting VARCHAR2 to Number in Oracle SQL. My VARCHAR2 has the following characteristic: 0.000 For example: the value of Campo1 is 18.123 (with a .) But I get an error: 00000 - "invalid number" when trying to…
0
votes
1 answer

Why is my null check not working in this IF statement in Oracle?

This should be a simple question. I want a particular column claimedby to alternate between a user ID and nothing. So, I'm writing a simple procedure that should look at the column to see if a user ID is in there. If it is, set it to nothing. If…
Steve Stilson
  • 1,015
  • 7
  • 11
0
votes
1 answer

View and Table Column Size mismatch due to UNION

I have created View using unioned CVAS: CREATE OR REPLACE VIEW SAMPLEVIEW AS SELECT PT.CREDITPARTYACCOUNT AS PT_CREDITPARTYACCOUNT, PT.DEBITPARTYACCOUNT AS PT_DEBITPARTYACCOUNT, ... ... FROM accountingevent AE LEFT OUTER JOIN…
coming out of void
  • 1,454
  • 2
  • 12
  • 12
0
votes
0 answers

Char and Varchar2 Columns showing Larger size in View

I have a table like: Table { ... ... SETTLEMENTDAY VARCHAR2(10 CHAR) ACCOUNT VARCHAR2(50 CHAR) AMOUNT NUMBER(38,5) CURRENCY …
coming out of void
  • 1,454
  • 2
  • 12
  • 12
0
votes
1 answer

Ö and other special characters not getting saved correctly in the client data base

When I execute the code at my end, the characters get saved correctly. But when the same code with the same data is executed at client side, the characters change when they are written to the database and that causes issues when they are displayed…
siddhant
  • 35
  • 6
0
votes
1 answer

PL/SQL: Generating CSV varchar from select statement without loops

Using PL/SQL, I'm looking to programmatically generate a CSV string/varchar object from a select statement. So the output of the select statement would normally be 1-n records (I only need one column). But the kicker is, I cannot use loops or any…
rshaq
  • 149
  • 4
  • 13
0
votes
0 answers

Memory allocation to store strings using varchar2

I have been very interesting to know that when we declare a variable such as varchar2(10), some fixed amount of memory will be allocated. We can estimate it by printing/displaying output. It have some empty strings in that length where there are no…
0
votes
0 answers

Oracle column in table mysteriously changing value

I have a server_password column in my table server_services. I'm using a package to encrypt/decrypt the password. This sometimes fails with an internal Oracle error message and is what I am investigating. I believe the error message is oracle's way…
Adder
  • 5,708
  • 1
  • 28
  • 56
0
votes
2 answers

Extract BLOB with length greater than 4000 in Oracle SQL

I am trying to extract a BLOB variable using the below Query. select utl_raw.cast_to_varchar2(BLOB_VAR) from Dual However I am getting an error. ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 4060, maximum: 2000)…
vijay kumar
  • 203
  • 1
  • 6
  • 16
0
votes
2 answers

Oracle VARCHAR2 field to date with substr

I have a very messy date field that is fed from several systems, each with their own date format. I have: DD-MM-YY hh:mm:ss.ssss DD-MON-YY hh:mm:ss DD-MM-YYYY hh:mm:ss.ssss All of this is stored in a varchar2 field. Now I have to do searches…
vwdewaal
  • 975
  • 2
  • 11
  • 25
0
votes
1 answer

How to convert varchar2 to a number in SQL

I have a column which is varchar2 and I need to convert it to a number so I can sum up the column . When I try to convert it I get a - SQL ERROR ORA -0-1722 INVALID NUMBER. I know the issue is I need to convert the varchar2 column (extprice) to a…
cardonas
  • 109
  • 1
  • 1
  • 9
0
votes
1 answer

error when executing a varchar2 in a procedure

I have a varchar2 with an INSERT and I want to execute it in a procedure I try to do it with an execute but this happens: EXECUTE IMMEDIATE sql_str; Error: ERROR at line 1: ORA-00911: invalid character ORA-06512: at "SYS.INSERT_MOVIMIENTOS", line…
Victor
  • 29
  • 6