few weeks of each yearTo_char (sysdate, ' mm ') the first few months of each yearTo_char (sysdate, ' Q ') the first quarter of each yearTo_char (sysdate, ' yyyy ') yearSql> Select To_char (sysdate, ' PM yyyy-mm-dd hh24:mi:sssss AD year Mon day ddd iws ') from DUAL;To_char (sysdate, ' Pmyyyy-mm-ddh--------------------------------------------------------------------------------Morning 2008-03-27 09:58:35917 A.D. thousand eight March Thu 087 13Sql> SELECT to_char (Systimestamp, ' HH24:MI:SS. FF5 '
Oracle pl/SQL common functions, oracleplsql Functions
On csdn, I also saw a post called Oracle common function 110. after a rough look, there are many data calculations, such as covariance. I don't think I have used much. I can see it today, but it is not very comprehensive.
Mathematical functions of Oracle SQL functionsABS (x) "function" returns the absolute value of x "parameter" x, numeric Expression "return" numeric SQL> SELECT ABS ( -), ABS (- -) from DUAL; ABS ( -) ABS (- -)---------- ---------- - -Sign (x) "function" returns the positive negative value of X "parameter" x, nu
SQL date functions
-- DATEADD-- Returns a new datetime value based on a specified date.-- DATEADD (datepart, number, date)-- Abbreviation of date-- Year yy, yyyy-- Quarter qq, q-- Month mm, m-- Dayofyear dy, y-- Day dd, d-- Week wk, ww-- Hour hh-- Minute mi, n-- Second ss, s-- Millisecond MSSELECT dateadd (mm, 5, '2014/1/8080') as date -- DATEADD-- Returns a new datetime value based on a specified date.-- D
],c3]) "function" converts a string X to a numeric type "parameter" c2,c3, character type, reference To_char () "Return" number string "reverse" to_char (DATE[[,C2],C3]) "Example" SelectTo_number ('199912'), To_number ('450.05') fromdual; To_multi_byte (C1) "function" converts half-width in a string to full-width "parameter" C1, character "return" string "Example" SQL>SelectTo_multi_byte ('High A') text fromdual; test--High A To_single_byte (C1) "func
SQL single-row functions in Oracle databases-numeric Functions1. trigonometric FunctionsSIN ASIN SINHCOS ACOS COSHTAN ATAN TANHFor the above trigonometric functions, see the name. Do a continuous exercise [SQL] select sin (2), asin (1), SINH (1) from dual;Select cos (1), ACO
the return value VAR salary number; exec:salary:=get_sal (7369); PRINT salary; Mode two: Call function directly in SQL statement SELECT get_sal (7369) from DUAL; way three: Use Dbms_output call function SET serveroutput on EXEC Dbms_output.put_line (' Wages are: ' | | get_sal (7369));Delete functions drop function get_sal;
Create a PackageA package is a PL/
As a result of project requirements, SQL Server must be converted to Oracle, some SQL Server views using the IsNull function, the following several Oracle functions and IsNull have a similar effect:
NVL (EXPR1,EXPR2) If EXPR1 is null, returns the value of EXPR2, otherwise r
In fact, it's a good way to work with analytic functions, flipping through Tom's book and including one of the examples here. For example, to query the Scott.emp table for user Sal ordering information, you can use the following query: SQL> SELECTDeptno, ename,2Row_number () Over(PARTITION byDeptnoORDER bySalDESC) Seq3 fromEMP; DEPTNO ename SEQ---------- ---
In the company often use the Oracle analysis function, in statistics this piece of useful, especially complex SQL query, I am here to combine the network some information to summarize, hope can help everyone:Oracle Analytic functions--List of functionsSUM: The function calculates the accumulation of expressions in a gr
Directory===============================================1. The arrangement with null value2.top/bottom N Query3.first/last ranking Query4. Query by LevelOne, with a null value of the arrangement:In the previous article on Oracle development topics: Analytic functions 2 (Rank, Dense_rank, row_number), we have learned how to arrange and group records in a full arra
Functions in oracle are divided into character functions, number functions, date functions, empty processing functions, conversion functions, and other common
the X field type SQL>SelectMax (distinct Sal), Max (XM) fromTable3; Max (distinctsal) max (XM)---------------- --------5555.55zhumin ([Distinct|all]x) The maximum value of the row x column is selected in the function statistics table. The "parameter" all means the maximum value for all values, distinct only the maximum value for the different values, the default is all if there is a parameter distinct or all, a space is separated from the X (column).
Label:To create a function: Create or Replace function My_fun (in_no in number) return VARCHAR2 isOut_name VARCHAR2 (64);BeginSelect Ename to Out_name from EMP where emp.empno=in_no;return out_name;End My_fun; Java Program Demo: Import java.sql.CallableStatement;Import java.sql.Connection;Import Java.sql.DriverManager;Import java.sql.SQLException;Import Java.sql.Types; public class Javacallmath {public static void Main (string[] args) {String driver= "Oracle.jdbc.driver.OracleDriver";String ur
Syntax for building functionsCreate or Replace function name (parameter input or output parameter type) return data typeis return value data type of return valueBeginAction to be done by the functionEndSQL Statement Demo:Create or Replace function My_fun (in_no in number) is Out_name VARCHAR2 (64);BeginSelect Ename to Out_name from EMP where emp.empno=in_no;return out_name;End My_fun;Note: There is no longer end my_fun and end;Function call:DeclareVar_name VARCHAR2 (32);BeginVar_name:=my_fun (73
In the program, Oracle databases and SQL databases are often supported. Some Oracle built-in functions are mostly used, but the syntax in SQL is somewhat different. I have done some sorting and hope to help you .... 1. built-in functions
Comparison of common functions for SQL Server to Oracle
1. Absolute ValueS: Select ABS (-1) ValueO: Select ABS (-1) value from dual
2. INTEGER (large)S: Select ceiling (-1.001) ValueO: Select Ceil (-1.001) value from dual
3. Round (small)S: Select floor (-1.001) ValueO: Select floor (-1.001) value from dual
4. Round (truncation)S: Select cast (-1.002 as INT) Valu
Oracle broadly divides functions into single-line functions, aggregate functions, and analytic functions.Single-line functions are divided into character functions, date
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.