Original: Decode in OracleThe Decode function is equivalent to a conditional statement (IF). It compares the input value to the parameter list in the function and returns a corresponding value based on the input value. The parameter list of a
Look at other people's SQL today look at this inside there are also decode () function, has never been in contact with the Internet to check a bit, but also very useful for a function, write down hope to help friends Ah!Introduction to the Decode ()
In Oracle, even if the condition is not met, the NVL function also performs a conditional non-conforming option, and for the Decode function, if there is a custom function in it, decode will not execute the non-conforming function, but if Decode has
# # #. Using Functions in Query statements@1. round (D1,D2) is used to round the number D1 to indicate the number of digits D2 after the decimal point (D2 does not write by default is 0)@2. trunc (D1,D2) intercept the method of de-tail@3. Date
Use the decode function or casewhen to implement row-to-column Oracle ---- create test table createtablestudent_score (namevarchar2 (20), subjectvarchar2 (20), scorenumber (); ----- insert test data into (name, subject, score) values (Zhang San,
Oracle Database: the DECODE function compares the value with a series of sequence dolls to determine the final returned results. The ordinal even is in pairs.
Oracle Database: the DECODE function compares the value with a series of sequence dolls to
Oracle considers null to be the largest. Sort in ascending order. By default, the null value is placed behind. Sort in descending order. By default, the null value is ranked first. How to change the null value: (1) Use the nvl function or decode
1. Although each database supports SQL statements, each database also has operation functions supported by each database. These are single-row functions. If you want to develop a database, in addition to SQL statements, you must learn more functions.
OracleDecode () Functions and CASE statements are often used. What are their differences? The following describes the differences between the OracleDecode () function and the CASE statement for your reference. First, let's give two simple examples
Common oracle knowledge accumulation and oracle knowledge accumulation1. Basic operation 1. Table operation 1.1 copy and create a table
Create table test as select * from dept; -- copy data and structure from a known table
Create table test as
V. Index Optimization Design
1. Manage organization Indexes
The index can greatly accelerate the database query speed. The index maps the logical value in the table to a safe RowID, so the index can quickly locate the physical address of the data.
SQL statements have always been weak. The entire report has been difficult recently. A select statement can be written for two days. Sort out some common functions and writing methods here, and forget to take a look later (for Oracle databases ).
Http://doc.linuxpk.com/49161.html
As follows:SELECT logid,userid,logtime,url,description, (case operatetype when operatetype = 0 Then ' Add ' when operatetype=1 then ' modify ' Else ' delete ' end case ' from LOG 1. CaseSELECT Logid,userid,logtime,
Oracle Bulk Update table field createtime--2018 February 27 16:02:24author:marydon(i) Replace the numbers with Chinese charactersThe first step is to re-queryUse the DISTINCT keyword to check the value of the field first, to see the total number of
1. Understand the implementation plan1-1. What is the execution planWhen an Oracle database executes an SQL statement, the Oracle optimizer determines the execution path of the SQL statement according to certain rules. To ensure that SQL statements
Read Catalogue
(1) Select the most efficient table name order (valid only in the rule-based optimizer)
(2) connection order in the WHERE clause
(3) Avoid using ' * ' in the SELECT clause
(4) Reduce the number of accesses to the database
(
1.Altertable table name Add system Time field datedefaultsysdate;--newaltertable Table name MODIFY The field to be modified VARCHAR2 (12);--Modify2.The decode () function is one of the most powerful functions of Oracle PL/SQL and is currently
Read Catalogue
(1) Select the most efficient table name order (valid only in the rule-based optimizer)
(2) connection order in the WHERE clause
(3) Avoid using ' * ' in the SELECT clause
(4) Reduce the number of accesses to the database
(
Perl has begun to use UTF8 coding internally to represent characters from 5.6, meaning that the processing of Chinese and other language characters should be completely free of problems. We just need to take advantage of the Encode module to give
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.