Long and varchar2 data type
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 you
This 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.
Tags: Database
Similar Questions
-
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.
-
VARCHAR2 data type do not convert date
Dear gurus
Version of database - 10.2.0
I have a problem of varchar2 data type do not convert date...
I have a table like
SQL > table desc.
Name Null? Type
----------------------------------------- -------- ----------------------------
NAME VARCHAR2 (10)
RECORD_DATE VARCHAR2 (20)
and the record consists are...
SQL > select * from table;
NAME RECORD_DATE
---------- --------------------
Nimai 09/09/2012 09:10
Nimai 09/09/2012 10:10
Scott 09/09/2012 11:10
Scott 09/10/2012 10:00
Nimai 09/10/2012 11:00
If the "Record_date" column that's 09/09/2012(dd/mm/yyyy)
09/09/2012 and I want to query the records which includes the date ' select * from table where record_date = 09/09/2012 "...
This work of query...
Select * from table where
TO_CHAR (to_date (substr(record_date,1,10), ' dd/mm/yyyy'), ' dd/mm/yyyy')
=
TO_CHAR (to_date (substr('09/09/2012',1,10), ' dd/mm/yyyy'), ' dd/mm/yyyy')
;
But if the "record_date" column that's 9/9/2012(d/m/yyyy) I did not what to do which function to use? /
Help, please!
Thanks in advance
Nimai kinzonzi
Published by: 955748 on September 22, 2012 03:47
Published by: 955748 on September 22, 2012 04:10Hello;
Keep things simple: (get rid of TO_CHAR)
SELECT TO_DATE ((substr (record_date, 1, 10), ' DD/MM/YYYY') of?)
TO_DATE (substr (record_date, 1, 12), "HH24 MON-DD-YY")
Best regards
mseberg
-
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.
-
convert the varchar2 data type to the data number type
How to convert the varchar2 data type to the data type number.
It looks like my data
create table one)
col1 varchar2 (50)
col2 varchar2 (500);
Insert in a (col1, col2) values ('1234 ', ' 2345');
Select Column1 of number (19)) cast (to_number (col1);
IAM getting error invalid number
I need to create a table with the same columns with data like number types (19)
can someone help me
Thank youYou have changed your original post, so now I see that you get the invalid number.
This is why you should always avoid the varchar columns to store numbers or dates...
Since your table source contains a nonnumeric value, you can write a pl/sql to convert data and see what records are false:
SQL> insert into a (col1,col2) values ('xxxx','2345'); 1 row created. SQL> select * from a; COL1 COL2 -------- -------- 1234 2345 xxxx 2345 2 rows selected. SQL> create table b (col1 number(19), col2 number(19)); Table created. SQL> set serverout on SQL> declare 2 cursor c is 3 select * from a; 4 begin 5 for r in c loop 6 begin 7 insert into b values (to_number(r.col1), to_number(r.col2)); 8 exception 9 when invalid_number then 10 dbms_output.put_line('Row rejected: col1='||r.col1||' col2='||r.col2); 11 end; 12 end loop; 13 end; 14 / Row rejected: col1=xxxx col2=2345 PL/SQL procedure successfully completed. SQL> select * from b; COL1 COL2 ---------- ---------- 1234 2345 1 row selected.
Max
Published by: Massimo Ruocchio, June 14, 2011 20:00
Added the first query in the example -
Convert a varchar2 data type Date
Hi guys,.
Can someone help me convert a Varchar2 data type in the data type Date?
I have a query and my column is a varchar2 data type.
I want to just that convert the Varchar2 in a DATE, because I met
problem in my query. I want to do the day1 day10 transaction.
Ex:
Day 1 = January 1, 2010
Day10 = January 10, 2010
table.record_date varchar2 (12)
SELECT column1, Column2
table
where record_date between? and?
How can I set the record_date between day1 and day10 since record_date is of type varchar?
Thank you.
LaetitiaLala,
If the data in the database are in the format MM-DD-RR , then you must use the same format when you convert back to this day.
So change the query to
SELECT COLUMN1, COLUMN2 FROM TABLE WHERE TO_DATE(RECORD_DATE, 'MM-DD-RR') BETWEEN TO_DATE('01-JAN-2010') AND TO_DATE('10-JAN-2010')
Kind regards
Manu.
-
hold the SHIFT key too long and can only type 1 hits a second...
hold the SHIFT key too long and can only type 1 hits a second...
You have turned on the FilterKeys , which slows down the speed of repetition of the keyboard. To disable it, go to Control Panel > Classic view > Accessibility Options . Steve Winograd, Microsoft MVP (Windows desktop experience)
-
Bad high and low value with the varchar2 data type
Hello
It is an application on e - biz on database 9205, with inventory module.
In one of the mtl_txn_request_headers of the table, the data for the number of application type is varchar2 (30). When I checked the low_value & high_value in dab_tab_columns, I see that the low_value is 100001 (6 digits) and high_value is 99999 (5 digits).
I used the utl_raw.cast_to_varchar2 (low_value) to convert the value.
In our case, we save a large part of the value in incremental number and some of our query will be in the predicate of the range (between).
How should I handle this kind of situation and which option do I?
Appreciate any help. Thank you.Accepted this looks like a classic bad-data type problem, but as this picture seems be part of Oracle E-Business Suite the OP should probably talk first Oracle.
-
To display long the field data type
Hello
can any1 help me showing the column with the data type long. The version of oracle's 10g.
concerning
ChaitanyaSet the maximum width (in chars) for displaying and copying LONG values.
-
Change the number in Varchar2 Data Type
Hello
We have a running production applications. There is a column called home_number which is a type of data number, now called the new requirement to change of varchar2.
I tried to edit the table get the below error.
-Edit the "TECH_SOURCING_EMPLOYEE_DETAILS" table change
-("HOME_PH_NUMBER" VARCHAR2 (1000))
-- /
-ORA-01439: column to change must be empty to change data type
Please suggest me how to change the data type of column without affecting the data.
Thank you
SudhirTry below, I tested in my database.
create table tmp (ID NUMBER, HOME_NUMBER NUMBER(8)); insert into tmp values(1, 9122222); alter table tmp add MY_HOME_NUMBER VARCHAR2(1000); update tmp set my_home_number = home_number; update tmp set home_number = NULL; alter table tmp drop column home_number; alter table tmp rename column my_home_number to home_number;
-
Employee_number hr.per_all_people_f varchar2 data type
Hello Oracle gurus, could someone tell me why the number of employee in the table Per_All_People_F column is varchar2 instead of the data type data type Number.
Thanks in advance, Naveen GagadamHi Naveen
The employee number may be whatever it is based on the requirement, for example, you can have employee number which begins with the a. The data type of this field is Varchar2 instead of the number so you can customize employee number using the quick forumla.
HTH
Gerard -
Hi all!
I have a form, I want to import xml data.
In the xml data file: when I put a string in a numeric field (error) and the i value import data in my form:
Acrobat don't tell me there is an error in 'format', but rather the value 0 (zero) value is put is the field.
Is there a way (early event) to detect a data format error in the xml file?
Thank you
Not that I know of... .He is trying to bind the to imbound field in the form field and if it can you see your data... otherwise it will not appear.
It is assumed that the incoming data was validated against the schema before importation is made so avoid data type mismatches.
Paul
-
create new tab with the name of the pass and the data type of the tab &; ranks on the b tab
Hello
I'm really struggling with this.
Have two tables A and B
A is a table with columns, tag_label, tag_colmn code
-------------------------------------------------------------
CODE | TAG_LABEL | TAG_COLMN_NAME
-----------------------------------------------------------
023. Registration | CHAR_TAG1
023. Contract number | NUM_TAG1
023. Agency | NUM_TAG2
B is an operating table with code, CHAR_TAG1, CHAR_TAG2, NUM_TAG1, NUM_TAG2...
----------------------------------------------------------------------------------------------------------------------------
CODE | CHAR_TAG1 | CHAR_TAG2 | NUM_TAG1 | NUM_TAG2......
----------------------------------------------------------------------------------------------------------------------------
023. 420/09 | -- || 100023 | 1002
021 | -- || 400030 | -- || --
023. 450/10 | -- || 100025 | --
I need to create a dynamic new table or view C from these two with
----------------------------------------------------------------------------------------------------------------------------
CODE | REGISTRATION | CONTRACT NUMBER | AGENCY NUMBER
----------------------------------------------------------------------------------------------------------------------------
023. 420/09 | 100023 | 1002
023. 450/10 | 100025 | --
That's when my Jdeveloper, I will be able to get a view with table C object.
If you see C, there new column names, derived from the Tag_label of the table A column names and the lines are filled with the values from table B corresponding to the tag_column_name of the column of table A
Is it possible to do so. This is very important because it is the main part of my project and I'm stuck on this.
Kind regards.
Published by: user10264958 on August 21, 2010 22:28Try this:
CREATE OR REPLACE PROCEDURE MAKE_VIEW IS L_SQL VARCHAR2(32767); TYPE A_TAB_TYP IS TABLE OF A%ROWTYPE; A_TAB A_TAB_TYP; L_COMMA varchar2(10); BEGIN SELECT * BULK COLLECT INTO A_TAB FROM A; IF SQL%NOTFOUND THEN RAISE_APPLICATION_ERROR( -20999, ' Table A is empty ' ); END IF; L_SQL := 'CREATE OR REPLACE VIEW C AS SELECT'; L_COMMA := ' '; FOR I IN A_TAB.FIRST .. A_TAB.LAST LOOP L_SQL := L_SQL || L_COMMA; L_SQL := L_SQL || A_TAB( I ).TAG_COLMN_NAME || ' "' || A_TAB( I ).TAG_LABEL || '" '; L_COMMA := ','; END LOOP; L_SQL := L_SQL || ' FROM B WHERE '; L_COMMA := ' '; FOR I IN A_TAB.FIRST .. A_TAB.LAST LOOP L_SQL := L_SQL || L_COMMA; L_SQL := L_SQL || A_TAB( I ).TAG_COLMN_NAME || ' IS NOT NULL '; L_COMMA := ' OR '; END LOOP; EXECUTE IMMEDIATE L_SQL; END MAKE_VIEW; DROP VIEW C; EXECUTE MAKE_VIEW; SELECT * FROM C; DROP VIEW C succeeded. anonymous block completed Registration AGREEMENT NUMBER Agency ------------ ---------------------- ---------------------- 420/09 100023 1002 450/10 100025
-
date and timestamp data type lengths
Hello
Documentation, says the following:
: Date parameter valid [...]. The size is fixed to 7 bytes. This data type contains the datetime fields YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND. There can be no fractions of a second or a zone.
TIMESTAMP [(fractional_seconds_precision)]
Year, [...] setting. The size is 7 or 11 bytes, depending on the precision. This data type contains the datetime fields YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND. It contains fractions of a second, but does not have a time zone.
However, if I create a table as follows:
create table t9 (timestamp (3) c1, c2 date);
and do:
insert into values t9 (systimestamp, sysdate);
commit;
Select length (c1), (c2) length, lengthb (c1), (c2) lengthb of t9.
I get
LENGTH (C1) (C2) LENGTH LENGTHB (C1) (C2) LENGTHB
---------- ---------- ----------- -----------
21 8 21 8
Can someone please explain this to me?
Thank youI think you want to do this to check the time.
ME_XE?select dump(c1) as c1, dump(c2) as c2 from t9; C1 C2 ------------------------------ ------------------------------ Typ=180 Len=11: 120,110,4,19,1 Typ=12 Len=7: 120,110,4,19,16, 6,30,31,13,105,58,64 30,31 1 row selected. Elapsed: 00:00:00.17 ME_XE?
-
Hello
I am new to oracle db.want to know one simple thing.
How to manipulate the XMLtype and datatype anytype data type?
any link might be useful.
concerninghttp://www.morganslibrary.org/reference/ANYDATA.html
http://www.morganslibrary.org/reference/collections.htmlScroll to the bottom of the two demos
also
https://codesamples.SampleCode.Oracle.com/servlets/tracking/ID/s483
Maybe you are looking for
-
Pavilion Notebook 15 D9X34EA: UPGRADE of RAM
Morning, I'm interested in upgrading the RAM on my 15-D9X34EA. Matches can I install 2 x DDR3 8 GB 1600 MHz RAM modules for a total of 16 GB? Thanks for the reply
-
iCloud Photo library of backup hard disk external
Assuming that you don't use referenced files, copy & paste "Library.photoslibrary Photos" package to a hard external lead backup all my pictures in Photos? If I open this file on another computer, I will be able to access my photos?
-
Question about BIOS beep codes
Difficulty locating the BIOS beep codes... can anyone help? I get 3-3-1...
-
Projection KDF-50E2000 lamp problem
I replaced the projection lamp in our KDF-50E2000 after it finally bit the dust (after a warning for the few months that he was approaching the end of life). The replacement was easy, but now it will not come. I still three lights flash. I cleaned th
-
How to create a Windows XP Recovery disk?
Original title: floppy? backup Windows XP wants me to do a recovery on a floppy disk. There is no floppy drive if I use a dvd and if soHow to direct the program to copy the necessary files on the disk.