char and varchar2
Hi all
Why use tank if it has a fixed length and it will affect the useless space on the disk and ram
while I can use a variable space when I use 'varchar2 '?
Thank you
99.999% of the time, you should use varchar2.
Tags: Database
Similar Questions
-
(1) char and varchar2 (1)
Can someone tell me the difference between (1) char and VARCHAR2 (1), I need to use the flag of 1 byte column.
What is the best to useRead this link
[http://asktom.oracle.com/pls/apex/f?p=100:11:0:P11_QUESTION_ID:123212348063] -
NLSSORT function not used with CHAR and VARCHAR2 column index
Hello!
Create a test bench:
Now "explain plan" these 8 select statements in SQL * more:CREATE TABLE scott.nls_demo ( col_varchar varchar2(4), col_char char(4), col_varchar_NLS_GERMAN varchar2(4), col_char_NLS_GERMAN char(4) ); INSERT INTO scott.nls_demo ( col_varchar, col_char, col_varchar_NLS_GERMAN, col_char_NLS_GERMAN ) SELECT substr(object_name,1,4), substr(object_name,1,4), substr(object_name,1,4), substr(object_name,1,4) FROM all_objects where rownum<5000; COMMIT; create index scott.i_varchar on scott.nls_demo (col_varchar); create index scott.i_char on scott.nls_demo (col_char); create index scott.i_varchar_NLS_GERMAN on scott.nls_demo ( NLSSORT(col_varchar_NLS_GERMAN,'nls_sort=''GERMAN_CI''')); create index scott.i_char_NLS_GERMAN on scott.nls_demo ( NLSSORT(col_char_NLS_GERMAN, 'nls_sort=''GERMAN_CI'''));
What I see on 11.2.0.2 is:variable c char(4); variable v varchar2(4); exec :c:= 'abc'; exec :v:= 'abc'; explain plan for SELECT /* 1*/ * FROM scott.nls_demo where col_varchar=:v; SELECT * FROM TABLE(dbms_xplan.display); explain plan for SELECT /* 2*/ * FROM scott.nls_demo where col_char=:c; SELECT * FROM TABLE(dbms_xplan.display); explain plan for SELECT /* 3*/ * FROM scott.nls_demo where col_varchar_NLS_GERMAN=:v; SELECT * FROM TABLE(dbms_xplan.display); explain plan for SELECT /* 4*/ * FROM scott.nls_demo where col_char_NLS_GERMAN=:c; SELECT * FROM TABLE(dbms_xplan.display); ALTER SESSION SET NLS_COMP = linguistic; ALTER SESSION SET NLS_SORT = german_ci; explain plan for SELECT /* 5*/ * FROM scott.nls_demo where col_varchar=:v; SELECT * FROM TABLE(dbms_xplan.display); explain plan for SELECT /* 6*/ * FROM scott.nls_demo where col_char=:c; SELECT * FROM TABLE(dbms_xplan.display); explain plan for SELECT /* 7*/ * FROM scott.nls_demo where col_varchar_NLS_GERMAN=:v; SELECT * FROM TABLE(dbms_xplan.display); explain plan for SELECT /* 8*/ * FROM scott.nls_demo where col_char_NLS_GERMAN=:c; SELECT * FROM TABLE(dbms_xplan.display);
1.) statement 1 would use the I_VARCHAR index, that is what I expected.
2.) statement 2 would use the I_CHAR index, that is what I expected.
3.) no clue used, because none are available right here for you. Understood.
4.) no clue used, because none are available right here for you. Understood.
And when define us NLS_SORT = german_ci:
5.) no clue used, because none are available right here for you. Understood.
6.) no clue used, because none are available right here for you. Understood.
7.) I_VARCHAR_NLS_GERMAN we used. Large.
8.) no index used, although I think that "i_char_NLS_GERMAN" would do the job...
Why the index 'i_char_NLS_GERMAN' is not used with the 8 statement? Jonathan? Someone else?
Thanks for your help!
MarcusNot really a reason to not use TANK - although there are many of them.
More than one reason to not always rely to "explain the plan for?
All the variables passed in EXPLAINING the PLAN for are treated as VARCHAR2.
In addition, there is no point setting the values of the variable because they will not cast a look either with MAP to EXPLAIN.SQL> CREATE TABLE nls_demo 2 ( 3 col_varchar varchar2(4), 4 col_char char(4), 5 col_varchar_NLS_GERMAN varchar2(4), 6 col_char_NLS_GERMAN char(4) 7 ); Table created. SQL> SQL> INSERT INTO nls_demo ( 2 col_varchar, 3 col_char, 4 col_varchar_NLS_GERMAN, 5 col_char_NLS_GERMAN ) 6 SELECT 7 substr(object_name,1,4), 8 substr(object_name,1,4), 9 substr(object_name,1,4), 10 substr(object_name,1,4) 11 FROM all_objects where rownum<5000; 4999 rows created. SQL> SQL> commit; Commit complete. SQL> SQL> create index i_varchar on nls_demo (col_varchar); Index created. SQL> create index i_char on nls_demo (col_char); Index created. SQL> SQL> create index i_varchar_NLS_GERMAN on nls_demo ( NLSSORT(col_varchar_NLS_GERMAN,'nls_sort=''GERM AN_CI''')); Index created. SQL> create index i_char_NLS_GERMAN on nls_demo ( NLSSORT(col_char_NLS_GERMAN, 'nls_sort=''GERM AN_CI''')); Index created. SQL> SQL> variable c char(4); SQL> variable v varchar2(4); SQL> SQL> exec :c:= 'abc'; PL/SQL procedure successfully completed. SQL> exec :v:= 'abc'; PL/SQL procedure successfully completed. SQL> SQL> ALTER SESSION SET NLS_COMP = linguistic; Session altered. SQL> ALTER SESSION SET NLS_SORT = german_ci; Session altered. SQL> SQL> SELECT /* 8*/ * FROM nls_demo where col_char_NLS_GERMAN=:c; no rows selected SQL> SELECT * FROM TABLE(dbms_xplan.display_cursor); PLAN_TABLE_OUTPUT ---------------------------------------------------------------------------------------------------- SQL_ID 9su0j5vzuwzyj, child number 0 ------------------------------------- SELECT /* 8*/ * FROM nls_demo where col_char_NLS_GERMAN=:c Plan hash value: 2830339923 ------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | | 3 (100)| | | 1 | TABLE ACCESS BY INDEX ROWID| NLS_DEMO | 50 | 2150 | 3 (0)| 00:00:01 | |* 2 | INDEX RANGE SCAN | I_CHAR_NLS_GERMAN | 20 | | 1 (0)| 00:00:01 | ------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access("NLS_DEMO"."SYS_NC00006$"=NLSSORT(:C,'nls_sort=''GERMAN_CI''')) Note ----- - dynamic sampling used for this statement (level=2) 23 rows selected. SQL>
Published by: Dom Brooks on February 21, 2011 15:39
-
NVL function varies from char to varchar2 data type
My question is why nvl function varies from char to varchar2 data type?SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for 32-bit Windows: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production SQL> create table fullJoinTest1(col1 char(14)); Table created. SQL> create table fullJoinTest2(col1 char(14)); Table created. SQL> insert all 2 into fullJoinTest1 values('aaa') 3 into fullJoinTest1 values('bbb') 4 into fullJoinTest2 values('aaa') 5 into fullJoinTest2 values('ccc') 6 select 1 from dual; 4 rows created. SQL> select nvl(a.col1,b.col1) as aaaa 2 from fullJoinTest1 a full join fullJoinTest2 b 3 on a.col1=b.col1 4 where nvl(a.col1,b.col1)= 'ccc'; no rows selected SQL> create table fullJoinTest3 as 2 select nvl(a.col1,b.col1) as "WhatIsType?" 3 from fullJoinTest1 a full join fullJoinTest2 b 4 on a.col1=b.col1 5 where nvl(a.col1,b.col1)= 'ccc'; Table created. SQL> desc fullJoinTest3 Name Null? Type ------------- -------- ------------ WhatIsType? VARCHAR2(14) SQL> create table fullJoinTest4 as 2 select case when a.col1 is not null then a.col1 else b.col1 end as "WhatIsType?" 3 from fullJoinTest1 a full join fullJoinTest2 b 4 on a.col1=b.col1; Table created. SQL> desc fullJoinTest4 Name Null? Type ----------- -------- -------- WhatIsType? CHAR(14)
Same case expression does not change the data type.
I insist that this is a bug of function nvl isn't - it.Documented behavior:
http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/functions119.htm#SQLRF00684If expr1 is character data, then Oracle Database converts expr2 to the data type of expr1 before comparing them and returns VARCHAR2 in the character set of expr1.
-
It is recommended to use when I want to store a character length given in Oracle, (1) char or VARCHAR2 (1) ? and why?
Thanks, KIt is recommended to use when I want to store a character length given in Oracle, (1) char or VARCHAR2 (1) ? and why?
For a character data for both are the same. See [http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:123212348063]
Kind regards.
-
Change char to varchar2 for all tables
Hello
I need to change the data type of char to varchar2 globally for all tables. For example, if four tables in a database contains one or more columns of type char (128), it should be replaced by varchar2 (128). I can do in a single statement?
Thank you
SujnanHello
Try this...
Coil d:\column_type.sqlSelect 'alter table' | table_name |' change '. column_name |' varchar2 (128);' from all_tab_columns where data_type = 'CHAR' and table_name ='
or select from user_tables help subquery ' >; Spool off
You will get sql statements to change the data type of Char to varchar2 (128)
Run the file on hold and you have completed the task.Concerning
You can also do this by using the procedure. Use the cursor to select name tablename and column of the user_tab_columns or All_tab_columns and then use immediate Execute to execute the statement Alter table.
Published by: user644725 on October 22, 2008 12:16 AM
-
How can I change table between char and varchar field
Hi I need change my column of table of char in varchar2
Published by: adf009 on 08/05/2013 17:18SQL> ALTER TABLE CFG_OFFICE MODIFY(OFFICECODE VARCHAR2(5 BYTE)) ALTER TABLE CFG_OFFICE MODIFY(OFFICECODE VARCHAR2(5 BYTE)) Error at line 3 ORA-02267: column type incompatible with referenced column type
Published by: adf009 on 08/05/2013 17:19Disable the FK constraints
Update of the child(ren)
Update the parent
reactivate the FK constraints
-
What is the difference between varchar and varchar2
Hello
can someone tell me difference between varchar and varchar2
Thank you
Chantal>
can someone tell me difference between varchar and varchar2
>See VARCHAR2 and VARCHAR in the section of the doc of the SQL language data types
>
The VARCHAR2 data type
The VARCHAR2 data type specifies a variable-length character string. When you create a VARCHAR2 column, you specify the maximum number of bytes or characters of data it can hold. Oracle then stores each value in the column exactly as you specify, provided that the value does not exceed the maximum length of the column. If you try to insert a value that is greater than the specified length, then Oracle returns an error.The VARCHAR data type
Do not use the VARCHAR data type. Use the VARCHAR2 data type. Although the VARCHAR data type is currently synonymous with the VARCHAR2, VARCHAR data type is programmed to be redefined as a separate datatype used for character strings of variable length compared to different comparison semantics. -
Table attached using CHAR and VARCHAR data indicator type
Hi all
I would like to bring together 3 tables, but I am unable to get a perfect match (using =) between the CHAR and VARCHAR data type.
A command exists to get impartially all data treated as CHAR or VARCHAR?
Thank you in advance for your help!Apart from the fact that it's the wrong forum...
Just use:
Trim (your_char_column) = TRIM (your_varchar2_column)
However, it is bad practice because it is a showstopper for the optimizer and will probably lead to poor performance.
Consider re-thing your data model PK - FK relationships.Concerning
-
How can I justify the difference between varchar and varchar2 data type
Hi all
How can I justify the difference between the data type varchar and varchar2 on any table for space management.
Is there any query to justify this.
Concerning
Girish
Published by: boujemaa on February 2, 2011 21:23http://download.Oracle.com/docs/CD/B19306_01/server.102/b14220/datatype.htm#sthref3780
The VARCHAR data typeThe VARCHAR data type is synonymous with the VARCHAR2 data type. To avoid any changes in behavior, always use the VARCHAR2 data type to store strings of variable length.
-
TANK (and VARCHAR2) semantic attribute in views catalog
Hello
This may seem very basic, but I am struggling to find information about it.
I created an object that contains an attribute declared in the specification of type char (8 CHARACTERS).
But where in views catalog I find the semantic character?
For example, in the case of the paintings, I can watch the CHAR_USED column in the DBA_TAB_COLUMNS view. Unfortunately, none of the three views (DBA_TYPES, DBA_TYPE_VERSIONS and DBA_TYPE_ATTRS) associated to type specification have such an indicator.
Of course, I could do an analysis of the chain on the TEXT in the DBA_TYPE_VERSIONS opinion column, but that seems rather unnatural if there is a direct wayl...
Any ideas?
Best regards
PhilippeSolomon,
Very well! I looked at it before and he couldn't understand. I applied your solution to a test case that I had previously put in place at the time and found that I had to make a slight change (additional join) for several columns. I have provided below.
SCOTT@orcl_11gR2> create or replace type test_object as object 2 (char_attribute char(8 char), 3 byte_attribute char(8 byte)); 4 / Type created. SCOTT@orcl_11gR2> column type_name format a11 SCOTT@orcl_11gR2> column attr_name format a14 SCOTT@orcl_11gR2> column attr_type_name format a14 SCOTT@orcl_11gR2> column char_semantic format a13 SCOTT@orcl_11gR2> select t.type_name, 2 ta.attr_name, 3 ta.attr_type_name, 4 case 5 when ta.attr_type_name in ('CHAR','VARCHAR2') 6 then decode(bitand(a.properties,4096),0,'BYTE','CHAR') 7 end char_semantic 8 from user_types t, 9 user_type_attrs ta, 10 sys.attribute$ a 11 where t.type_name = 'TEST_OBJECT' 12 and t.type_name = ta.type_name 13 and t.type_oid = a.toid 14 and ta.attr_no = a.attribute# 15 / TYPE_NAME ATTR_NAME ATTR_TYPE_NAME CHAR_SEMANTIC ----------- -------------- -------------- ------------- TEST_OBJECT CHAR_ATTRIBUTE CHAR CHAR TEST_OBJECT BYTE_ATTRIBUTE CHAR BYTE 2 rows selected.
-
Partitioning the table - range on data type (21, 7) number and varchar2
Hello
Database version:
DB: Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
Operating system: HP - UX nduhi18 B.11.31 U ia64 1022072414 unlimited-license user
APP: SAP - ERP
I have to the partition of the RANGE on UPDATED_ON or PROFILE is a table that has a structure below:
Name Null? Type
-------------------- -------- --------------
------------------
MANDT NOT NULL VARCHAR2 (9)
MR_ID NOT NULL VARCHAR2 (60)
PROFILE NON-NULL VARCHAR2 (54)
NO_REGISTRE NOT NULL VARCHAR2 (30)
INTERVAL_DATE NOT NULL VARCHAR2 (24)
AGGR_CONSUMPTION NOT NULL NUMBER (21.6)
MDM_VERS_NO NOT NULL VARCHAR2 (9)
MDP_UPDATE_DATE NOT NULL VARCHAR2 (24)
MDP_UPDATE_TIME NOT NULL VARCHAR2 (18)
NMI_CONFIG NOT NULL VARCHAR2 (120)
NMI_CONFIG_FLAG NOT NULL VARCHAR2 (3)
MDM_DATA_STRM_ID NOT NULL VARCHAR2 (6)
NSRD NOT NULL VARCHAR2 (24)
REASON_CODE NOT NULL VARCHAR2 (9)
QUALITY_FLAG NOT NULL VARCHAR2 (3)
METHOD_FLAG NOT NULL VARCHAR2 (6)
MSATS_UPDATE_DAT NOT NULL VARCHAR2 (24)
MSATS_UPDATE_TIM NOT NULL VARCHAR2 (18)
READ_STATUS NOT NULL VARCHAR2 (3)
LEGACY_FLAG NOT NULL VARCHAR2 (3)
CREATED_ON NOT NULL NUMBER (21.7)
CREATED_BY NOT NULL VARCHAR2 (36)
UPDATED_ON NOT NULL NUMBER (21.7)
UPDATED_BY NOT NULL VARCHAR2 (36)
CVERSNO NOT NULL VARCHAR2 (18)
OLDER_MD_FLAG NOT NULL VARCHAR2 (3)
TRANSACTION_ID NOT NULL VARCHAR2 (108)
According to my knowledge, RANGE is better suited for the DATE or NUMBER. and partition INTERVAL is available on the DATE or number.
PROFILE of column
I havets is of type VARCHAR2. I know that again I can partition as Oracle convert internally to varchar2 in number when the data is inserted. But the INTERVAL is not possible. However, so could you please suggest how RANGE partition on PROFILE?
CREATED_ON column:
It's the NUMBER with decimals. Could you guide me please?
Please let me know if you need more information?
See you soon
Sameer
I partitioned table as below:
PARTITION BY RANGE
(
"CREATED_ON".
)
SUBPARTITION BY HASH
(
'PROFILE '.
)
SUBPARTITION TEMPLATE
(
TABLESPACE SUBPARTITION 'PROF_SUB01"'PSAPISU."
TABLESPACE SUBPARTITION 'PROF_SUB02"'PSAPISU."
TABLESPACE SUBPARTITION 'PROF_SUB03"'PSAPISU."
TABLESPACE SUBPARTITION 'PROF_SUB04"'PSAPISU."
TABLESPACE SUBPARTITION 'PROF_SUB05"'PSAPISU."
TABLESPACE SUBPARTITION 'PROF_SUB06"'PSAPISU."
TABLESPACE SUBPARTITION 'PROF_SUB07"'PSAPISU."
TABLESPACE SUBPARTITION 'PROF_SUB08"'PSAPISU."
TABLESPACE SUBPARTITION 'PROF_SUB09"'PSAPISU."
TABLESPACE SUBPARTITION 'PROF_SUB10' 'PSAPISU '.
)
(
"BEF12_CP00" VALUES LOWER PARTITION TO (20120101000000),
"JAN12_CP01" VALUES LOWER PARTITION TO (20120201000000),
"FEB12_CP02" VALUES LOWER PARTITION TO (20120301000000),
"MAR12_CP03" VALUES LOWER PARTITION TO (20120401000000),
"APR12_CP04" VALUES LOWER PARTITION TO (20120501000000),
"MAY12_CP05" VALUES LOWER PARTITION TO (20120601000000),
"JUN12_CP06" VALUES LOWER PARTITION TO (20120701000000),
"JUL12_CP07" VALUES LOWER PARTITION TO (20120801000000),
"AUG12_CP08" VALUES LOWER PARTITION TO (20120901000000),
"SEP12_CP09" VALUES LOWER PARTITION TO (20121001000000),
"OCT12_CP10" VALUES LOWER PARTITION TO (20121101000000),
"NOV12_CP11" VALUES LOWER PARTITION TO (20121201000000),
"DEC12_CP12" VALUES LOWER PARTITION TO (20130101000000),
"JAN13_CP13" VALUES LOWER PARTITION TO (20130201000000),
"FEB13_CP14" VALUES LOWER PARTITION TO (20130301000000),
"MAR13_CP15" VALUES LOWER PARTITION TO (20130401000000),
"APR13_CP16" VALUES LOWER PARTITION TO (20130501000000),
"MAY13_CP17" VALUES LOWER PARTITION TO (20130601000000),
"JUN13_CP18" VALUES LOWER PARTITION TO (20130701000000),
"JUL13_CP19" VALUES LOWER PARTITION TO (20130801000000),
"AUG13_CP20" VALUES LOWER PARTITION TO (20130901000000),
"SEP13_CP21" VALUES LOWER PARTITION TO (20131001000000),
"OCT13_CP22" VALUES LOWER PARTITION TO (20131101000000),
"NOV13_CP23" VALUES LOWER PARTITION TO (20131201000000),
PARTITION 'OTHER_CPMAX' VALUES LESS THAN (MAXVALUE)
)
works very well.
-
Comparison of column values for Char and numbers
Hello
I have a requirement to compare the columns of the two tables value as described below-
Table - T1 (NAME VARCHAR2, VARCHAR2 VALUE)
Table - T2 (NAME VARCHAR2, VARCHAR2 VALUE)NAME VALUE A 1 B ABC C 2 D XYZ
Column 'NAME' is unique in the two tables. The comparison must exact match for the values of character ("ABC" = "ABCD", "XYZ" = "XYZ"), but in the numerical values, there must be a comparison of the value (T1. VALUE < T2. (VALUE).NAME VALUE A 1 B ABCD C 4 D XYZ
For example, the output from the example table above should be-
Thank you for your time and please let me know if any necessary clarification.T1.NAME T1.VALUE T2.VALUE A 1 1 C 2 4 D XYZ XYZ
Khayyam wrote:
you mean that the following output?C 2 4 D XYZ XYZ
Because T1. VALUE< t2.value="" (1="" not=""><>
Try this:
WITH t1 AS (SELECT 'A' name, '1' VALUE FROM DUAL UNION SELECT 'B', 'ABC' FROM DUAL UNION SELECT 'C', '2' FROM DUAL UNION SELECT 'D', 'XYZ' FROM DUAL), t2 AS (SELECT 'A' name, '1' VALUE FROM DUAL UNION SELECT 'B', 'ABCD' FROM DUAL UNION SELECT 'C', '4' FROM DUAL UNION SELECT 'D', 'XYZ' FROM DUAL) SELECT * FROM (SELECT name, t1.VALUE t1val, t2.VALUE t2val FROM t1 JOIN t2 USING (name) WHERE NOT REGEXP_LIKE (t1.VALUE, '[[:digit:]]')) WHERE t1val = t2val UNION SELECT * FROM (SELECT name, t1.VALUE t1val, t2.VALUE t2val FROM t1 JOIN t2 USING (name) WHERE REGEXP_LIKE (t1.VALUE, '[[:digit:]]')) WHERE t1val < t2val
Note that this will work in 10G and 11G (supported regular expression) databases.
Add<= then="" op="" expected="" output="" will="" come="">=>
WITH t1 AS (SELECT 'A' name, '1' VALUE FROM DUAL UNION SELECT 'B', 'ABC' FROM DUAL UNION SELECT 'C', '2' FROM DUAL UNION SELECT 'D', 'XYZ' FROM DUAL), t2 AS (SELECT 'A' name, '1' VALUE FROM DUAL UNION SELECT 'B', 'ABCD' FROM DUAL UNION SELECT 'C', '4' FROM DUAL UNION SELECT 'D', 'XYZ' FROM DUAL) SELECT * FROM (SELECT name, t1.VALUE t1val, t2.VALUE t2val FROM t1 JOIN t2 USING (name) WHERE NOT REGEXP_LIKE (t1.VALUE, '[[:digit:]]')) WHERE t1val = t2val UNION SELECT * FROM (SELECT name, t1.VALUE t1val, t2.VALUE t2val FROM t1 JOIN t2 USING (name) WHERE REGEXP_LIKE (t1.VALUE, '[[:digit:]]')) WHERE t1val <= t2valWITH t1 AS (SELECT 'A' name, '1' VALUE FROM DUAL UNION SELECT 'B', 'ABC' FROM DUAL UNION SELECT 'C', '2' FROM DUAL UNION SELECT 'D', 'XYZ' FROM DUAL), t2 AS (SELECT 'A' name, '1' VALUE FROM DUAL UNION SELECT 'B', 'ABCD' FROM DUAL UNION SELECT 'C', '4' FROM DUAL UNION SELECT 'D', 'XYZ' FROM DUAL) SELECT * FROM (SELECT name, t1.VALUE t1val, t2.VALUE t2val FROM t1 JOIN t2 USING (name) WHERE NOT REGEXP_LIKE (t1.VALUE, '[[:digit:]]')) WHERE t1val = t2val UNION SELECT * FROM (SELECT name, t1.VALUE t1val, t2.VALUE t2val FROM t1 JOIN t2 USING (name) WHERE REGEXP_LIKE (t1.VALUE, '[[:digit:]]')) WHERE t1val <= t2val NAME T1VAL T2VAL ---- ----- ----- A 1 1 C 2 4 D XYZ XYZ 3 rows selected
-
Afternoon people,
My apologies if I use the wrong forum, but I can't seem to find a place related to SQL and PL/SQL. In the affirmative, please let me know.
Here's my problem on site:
I have a very long sql who fault kept in my program with an ORA error 6502. After a while I thought about it and I was trying to assign a length of 48000 string to a variable declared in my PL/SQL which is varchar2 (32767). Then, of course the program is a failure for known causes.
I know there a CLOB, but this isn't workign fine with dbms_sql.parse. Anyone know what is the precision for a long TIME? I found some information on lONG but my program doesn't work.
--> Long character variable length up to 2 gigabytes of data, is 2 to the power of 31-1 bytes. Provided for backward compatibility.
Number of bytes = 2147483647
So, how is it I'm being not able to entrust the 48000 string? Anyone know of a better solution? Any help is greatly appreciated!
Thank youThis is the wrong forum. There is a forum called SQL and PL/SQL where you'll get better answers.
The short answer is that long (which are obsolete) and LOBS require special treatment and behave differently from other types of data.
-
Best practices - comparison of NUMBER (4, 0) and VARCHAR2 (5)
I have two fields in two different views that I compare in a complex query. This is just a small part of the query.
I want to assure you that I do this the best way. First of all, here are the two fields:
ZAS.ORG_ID NUMBER (4.0)
ORG. IORG_NBR VARCHAR2 (5)
And this is the part of the query that I select the first field.
(WHERE THE ZAS.ORG_ID IS NULL THEN NO OTHER END OF (TO_CHAR (ZAS.ORG_ID, ' 0000')))
As you can see, I do the same thing in the second part of the query. To help you understand, note that I'm basically pulling back a bunch of data from two sources and comparing them.
(CASE WHERE org.iorg_nbr IS NULL THEN NULL ELSE (TO_CHAR (org.iorg_nbr, '0000')) END)
Please let me know if I need to provide additional information. Any help would be greatly appreciated. Thank you!Hello
To_char returns NULL if the first argument is NULL, then you might as well say:
TO_CHAR (ZAS.ORG_ID, '0000')
"If zas.org_id is not NULL, it returns a string of 5 characters (the first character will be a sign less or a cache).
If you know that zas.org_id is not negative, and you want 4 characters, say:TO_CHAR (ZAS.ORG_ID, 'fm0000')
Maybe you are looking for
-
Iphone6 more, unable to save pictures from emails. Save image button disappeared
-
Warranty & Services for battery
Hey can someone tell me if the warranty covers the batterys? I plug an extension from 1 to 3 years warranty for my Satellite Pro U300 when I bought the laptop and battery additional 9cell which now, after a little less 2 years only runs for about 1:3
-
Message, "boot image selected is not authentic > press to continue:"then the computer shuts down. " I believe that it is a HP Set Up issue, no question of recovery Win8. Please notify. I don't want recovery of Windows 8, but you want to install the n
-
Windows XP - Windows Explorer search the files hyperlink text
Navigation in the site of MS is rather hard to find where I have to post my question. Please move it to the correct location. (Thank you) I have a directory with some 400 documents (Word, PDF, PowerPoint, Excel, etc.) I want to search for "a word or
-
Can I install a 1 GB video card and still be able to run Windows Vista?
Original title: need information about my os/graphics card... Hello! I have a problem with my gfx I want to buy a new video card in my computer. I am running Windows Vista 32-bit, and here is the 'problem '. I currently have 3 GB of RAM installed and