bibliography from the left/right of the string Select Left (' SQL Server Course ', 3), returning the result as "SQL". Select right (' SQL Server Course ', 3) returns the result as "course" 8. Replace function replaces characters in a string Select REPLACE (' SQL Server Course ', ' Course ', ' test '), return the resul
Single-record functions in SQL
1.ASCII
Returns the decimal number corresponding to the specified character;
Sql> Select ASCII (' a ') a,ascii (' A ') a,ascii (' 0 ') zero,ascii (') space from dual;
A A ZERO space
--------- --------- --------- ---------
65 97 48 32
2.CHR
Give an integer and return the corresponding character;
Oracle cold, stay at home and read the "Mastering Oracle SQL" 2nd, found that Oracle's function is still very strong, there are 200 optical functions, hsql is difficult to match. The next stubborn, it seems either to risk using Hibernate3.0 SQL mapping function, or to run th
, distinct means only the standard deviation for different values SELECT STDDEV (SAL) from SCOTT. EMP; SELECT STDDEV (DISTINCT SAL) from SCOTT. EMP; --5:variance (distinct| All) Covariance all means that all values are covariance, distinct means that only different values are evaluated for covariance SELECT VARIANCE (SAL) from SCOTT. EMP; SELECT VARIANCE (DISTINCT SAL) from SCOTT. EMP; --6:sum (distinct| All) Sum all means summing all values, distinct means summing only different values (t
functions.1. Detailed process Example 1.1
We consider the following given SQL:
select sysdate from dual;
Run and query v $ SQL in Oracle 10 Gb. The SQL _ID of this SQL statement is
SQL
oracle| function (author: Star Prodigal zhongcfido@126.com)
Ocidefinebyname
Allow the SELECT command to use PHP variables.
Syntax: boolean ocidefinebyname (int stmt, string ColumnName, mixed variable, int [type]);
Return Value: Boolean value
Types of functions: Database features
Content Description
This function is used to define the specified PHP variable so that it can be used by the SELECT com
out any record in the Description field in the Northwind.dbo.categories table that contains the word "bread" or "bread", then the SELECT statement might look like this:Select description from Northwind.dbo.categorieswhere PATINDEX (%[b,b]read%,description) > 0Here I use wildcard characters to determine the uppercase and lowercase "b". After I execute this script in the Notthwind database, I get the following result:Description--------------------------------------------------------Desserts, can
This is an oracle-defined function. how can we convert it to mysql worker (in_taskIdvarchar2, in_work_novarchar2) returnvarchar2isv_sumnumber (10); -- Average quality inspection completion quantity v_numNUMBER (10 ); -- individual QC completion quantity v_qualitied_cntNUMBER (10); v_resultvarchar2 (20); -- 0 exception, 1 is higher than the average... mysqloracle functions
This is a custom
Oracle provides the following explanations for ASCII and CHR functions:ASCII (x) gets the ASCII value of the character X, CHR () and ASCII () have the opposite effect.That is, the ASCII function is used to convert characters into their corresponding ASCII code, while the CHR function is opposite;Here are some simple examples:Select ascii ('x'), ASCII ('y'), ASCII ('Z') from dual;The statement execution result is 120,121,122 (the ASCII code correspondi
Label:
Turn from: http://www.2cto.com/database/201209/154045.html Oracle
the REGEXP_SUBSTR function Instructions for using the REGEXP_SUBSTR function in Oracle: The topic is as follows: In Oracle, a statement is implemented to split ' 17,20,23 ' into a collection of ' 17 ', ' 20 ', ' 23 '. The REGEXP_SUBSTR func
'Select Replace('000123','0') fromDual--The returned result is ' 123 ' NOTE: Omit the parameter replacement_string, replace the character ' 0 ' with null, i.e. delete all characters ' 0 '4. String connectionconcat (string1, string2) or ||Cases:Select concat (','World' from dual; -- returns the result as ' Hello world ' Select ' '| | ' World ' from dual; -- returns the result as ' Hello world '5. Get the string lengthLength (String)Cases:Select Length ('from- - Returns a result of 76, stri
server process session ID of the current user process. @ @SPID can identify the current user process in sp_who output results.ExampleThe following example returns the process ID, login name, and user name of the current user process. SELECT @ @SPID as ' ID ' System_user as ' Login Name ' USER as ' User Name ' Here is the result set: ID Login Name User Name
----- ------------- -----------
11 sa dbo [Email protected] @VERSION
amp;amp;amp;amp;amp
Tags: http io sp CTI on C SQL R BSWhere is the Oracle SQL Developer connection information saved?Oracle SQL Developer connection information is missing after switching the logged-on user. As long as the previous user information still exists, you can C:\Users\ the user name
is the number of strings returned, and if this number is shorter than the length of the original string, the Lpad function will intercept the string as a left-to-right n character;Pad_stringOptional parameter, this string is to be pasted to the right of the string, if this argument is not written, the Lpad function will paste a space on the right side of the string.Rpad (' Tech ', 7); will return ' tech 'Rpad (' Tech ', 2); will return ' Te 'Rpad (' Tech ', 8, ' 0 '); will return ' tech0000 'Rp
,=3000 when sale value =1000 translation to a , if other values are translated as other;SQL is as follows:Select Monthid,decode (sale,1000, ' D ', +, ' C ', +, ' B ', 4000, ' A ', ' other ') sale from outputSpecial cases:If you are comparing with only one valueSelect Monthid, decode (sale, NULL, '---', sale) sale from outputAnother: Decode can use other functions, such as the NVL function or the sign () fun
Question: Collect Oracle knowledge points that are commonly used at work, constantly update and accumulate, and use them as your own notebook.
Some keywords
1Is not null. Check whether the field is null.
Select*FromT_user uWhereU.NameIsNotNull
2 Case when... THEN... ELSE... END, Condition Statement
SELECTCASEWHEN'Condition'ISNOTNULLTHEN'Condition exist'ELSE'The condition is invalid'ENDASResultFROMT_user
3 EXITS, not exits, to determine whet
)Lowercase ConversionIdle> select lower ('abc') from dual;
LOW---Abc
Idle>Dual is a virtual table. When a statement does not need to obtain data from the table but maintains the SQL syntax, Oracle provides a virtual table to solve this problem.
UPPER (column name | expression)Capital Conversion
Idle> select upper ('abc') from dual;
UPP---ABC
Idle>
INITCAP (column name | expression)Uppercase and lowercase le
Character TypeASCIICHRLOWERUPPERINITCAPCONCATSUBSTRLENGTHINSTRTRIMDumpLpadRpadREPLACEASCII ('characters ')Returns the ASCII value of a character.Idle> select ASCII ('A') from dual;ASCII ('A ')----------97
Idle> select ASCII ('A') from dual;
ASCII ('A ')----------65
Idle>
CHR ('n ')Returns the character value n of n, which is the ASCII number.Idle> select chr (65) from dual;
C-A
Idle> select chr (39) from dual;
C-'
Idle>
However, the ASCII code format for single quotes is very special. There are
Tag: SQL Server SQL data MySQLThis article introduces the ISNULL functions in SQL Server, as well as the ifnull functions in MySQL, describes the specific usage and differences between the two, interested friends can study oh.First look at the IsNull function of
Tags: tun pre use statement Scala RAM data stun CALInline table-valued functionsConnect to T-SQL programming-user-defined functions (scalar functions) Http://www.cnblogs.com/viusuangio/p/6212072.html Inline table-valued functions can be used to implement parameterized views (queries), such as having a query whose de
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.