Common functions of Oracle

Source: Internet
Author: User

1. NVL

The format of the NVL function is as follows: NVL (EXPR1,EXPR2)

The implication is that if the first parameter of Oracle EXPR1 is empty, then the value of the second parameter is expr2, and if the value of the first parameter expr1 is not NULL, the value of the first parameter is displayed.

2. Nvl2

The format of the NVL2 function is as follows: NVL2 (EXPR1,EXPR2, EXPR3)

The implication is that if the first parameter of the function Expr1 is not empty, then the value of the second argument is expr2, and if the value of the first parameter EXPR1 is null, the value of the third argument is displayed EXPR3.

3. Conversion functions

3.1 To_char () [Converts date and number types to character types]

Date converted to character type:

SelectTo_char (sysdate) s1, To_char (Sysdate,'YYYY-MM-DD') s2, To_char (Sysdate,'yyyy') S3, To_char (Sysdate,'YYYY-MM-DD Hh12:mi:ss') S4, To_char (Sysdate,'Hh24:mi:ss') S5, To_char (Sysdate,' Day') S6 fromDual

Number converted to character type:

Select Sal,to_char (sal,'$99999') N1,to_char (Sal,'$99,999 '  from EMP

3.2 to_date () [Converts a character type to a date type]

Insert  into Values (8000, to_date ('2004-10-10','yyyy-mm-dd') ));

3.3 To_number () to numeric type

Select to_number (To_char (sysdate,'hh12'from// number of hours displayed in digital

4. Connection Operator | |

Select ' Hello ' || '  World '  from dual

The output is: HelloWorld

Common functions of Oracle

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.