In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "the problem analysis and solution of Oracle nvarchar2 error". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "Oracle nvarchar2 error problem analysis and solutions"!
Oracle nvarchar2 error
Question:
When you use the substr function to intercept a specified string, take out 4 character years (for example, 2019), resulting in only 3 digits (for example, 201).
The cause of the problem:
Character type nvarchar2
Solution:
Convert nvarchar2 to varchar2 through the TRANSLATE function.
The problem reappears:
-1 create test data
Create table T1 (id number,t_format nvarchar2, t_name varchar2)
Insert into T1 values (1) abcde2019xxx0707uuu`)
Commit
-2 intercept the year, month and day through the substr function
Select id
T_format
T_name
Length (t_format)
Length (t_name)
Substr (t_format, 6,4)
Substr (t_format, 13,4)
Substr (t_name, 6,4)
Substr (t_name, 13,4)
From t1
Select id
T_format
T_name
Substr (t_format, 6, 5)
Substr (t_format, 13,5)
Substr (t_name, 6,4)
Substr (t_name, 13,4)
From t1
-3 convert nvarchar2 to varchar2 through the TRANSLATE function
Select id
T_format
T_name
Substr (utl_raw.cast_to_varchar2 (utl_raw.cast_to_raw (Translate (t_format USING CHAR_CS), 6, 4)
Substr (utl_raw.cast_to_varchar2 (utl_raw.cast_to_raw (Translate (t_format USING CHAR_CS), 13jue 4)
Substr (t_name, 6,4)
Substr (t_name, 13,4)
From t1
At this point, I believe you have a deeper understanding of "Oracle nvarchar2 error problem analysis and solutions". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.