Implementation of the REVERSE function in DB2
Some guys asked DB2 if there were any built-in reverse functions in the group. I tested that DB2 does have built-in functions, but Oracle and SQL server both have built-in functions. Let's take a look.
ORACLE:
SQL> select reverse ('20140901') from dual;
REVERSE (--------432
The following content is the correct analysis of the DB2 snapshot function. I believe that if you have a good understanding of the DB2 snapshot function, it will be of great help in your future study or work, the following is a detailed description of the main content of the article. I hope you will have a better under
Recently encountered a test demand, the use of online analytical processing (OLAP), is summarized in the record, but also hope to help people with related problems.1. The test environment is DB2, through ETL (data extraction, data transformation, data loading) technology to load the data source data into the target data warehouse.2. Requirements approximate meaning: Verify that the order containing the product encoding is loaded from the data source i
In oracle, INSERT corresponds to the LOCATE function usage in db2. The SQL code www.2cto.com eg: SELECT CONCAT (FIRST_NAME, LAST_NAME) FROM T1 eg: SELECT CONCAT (FIRST_NAME, LAST_NAME) FROM T1 INSERT function Syntax: the INSERT (ARG1, POS, SIZE, ARG2) function returns a string, which deletes the SIZE of ARG1 from the P
The usage of the DB2 DECODE function generally uses CASE when data is queried and conditional judgment is required... WHEN the condition is equal, in addition to the CASE... you can also use the DECODE function. If you want to use like,>,
In the ETL project often encounter such a situation:A column in the target table originates from a different source data table A,b,c. If no valid data in A is taken from B, if none in B is taken from C, then set to null if none is in C.In situations like this, sometimes the first thought is the case and then else end, which can solve the problem, but it's still more complicated and error-prone, especially when someone looks at the SQL you're writing.So is there a better way?That's the COALESCE f
Values char (' ABCD ', ' A ', ' OPMN ') returns the result of OPMNBCDUpdate EMP Set Name=replace (name, ' D ', ' W ') where empno=70The key to the use of this function is case-sensitive, there can be no space between the strings, otherwise it cannot be replaced.Update test111 set A=replace[object Object] (A,CHR (13) | | Chr (10), ' 1 ') This is a substitution statement, Chr (13) | | CHR (10) wraps the carriage return. The experiment was successful on
DB2 Create function (a), which describes the use of function content as a field value, or as a where condition.DB2 creates function (ii), which describes the creation of the returned content as a table collection. A call example is shown below?
1
select * fromtable(GET_EFFECTIVE_USER_ID(21))--GET_E
string expression.
SELECT DOUBLE (' 5678 ') from Bsempms;
EXP ()
Returns the exponential function of the parameter.
SELECT EXP (2) from Bsempms;
FLOAT ()
Returns a floating-point representation of a number.
SELECT FLOAT (789) from Bsempms;
Floor ()
Returns the largest integer less than or equal to the parameter.
SELECT Floor (88.93) from Bsempms;
Oracle,sql server, and DB2 should also have its reverse function, because there is a certain application scenario.
CREATE OR REPLACE FUNCTION REVERSE
(
p1 varchar)
RETURNS varchar (m) Specific
"REVERSE"
LANGUAGE SQL
Deterministic
NO EXTERNAL ACTION
reads SQL DATA
BEGIN
declare v_str varchar (m) default ';
DECLARE V_index INTEGER; --Define subs
There are times when we need to index a set of data using letters from A to Z. If the data format is all half-width English is easy to achieve, but if the index of a group of Chinese data will cause a little trouble, data input database may not have specified an index letter, This requires the application to automatically generate information for indexing.
In general, the index of Chinese data uses the first letter of the Chinese pinyin of the phrase, for example:
Phrase Index letter
--- ----
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.