Oracle Learning Note Line function

Source: Internet
Author: User

Single-line function

Transform only one row returns a single result for each row

Single-line functions divide characters, values, dates, conversions, universal

Character functions: Casing control functions, character control functions

Capitalization control functions: Lower, Upper, initcap

Character control function: Concat,substr,length,instr,lpad|rpad,trim,replace

Lower,upper,initcap

Select lower (' SQL ') from dual;--results sqlselect Upper (' SQL ') from dual;--results sqlselect initcap (' sql COurs ') from dual;--result SQL Cours First Letter Capital

Concat,substr,length,instr,lapd|rpd,trim, replace

Select concat (' Hello ', ' world ') from dual; Results HelloWorld Select substr (' HelloWorld ', 1,4) from dual; Result Hell 4 characters from the first character select length (' Hellowrld ') from dual; Result 9 The character length */select InStr (' Helloword ', ' W ') from dual; Results 6 The first occurrence of the position of the W Select Lpad (Salary, ten, ' & ') from employees; Results &&&&&&2600 left Fill & Select Rpad (Salary, ' & ') from employees; Results 2600&&&&&& left Fill & Select Trim (' H ' from ' HHLLWOHLDHH ') from dual; Results llwohld go to the middle

Digital control Round,trunc,mod

Select Round (45.36954,4) from dual; 45.3695 Rounding Select Trunc (45.36954,3) from dual;     45.369 truncate SELECT mod (1600,300) from dual; 100 seeking remainder

Date control date can only be added minus Months_betwwen,add_months,next_day,last_day

Two date subtraction returns the difference between a date days

You can add or subtract a number of days to a date with a number except 24来

--Check the company's entry time is the last two days of each month staff select Last_name,to_char (hire_date, ' yyyy-mm-dd ') hdate from employees where hire_date=last_day (hire_date)-1
--Query for employees who have been in employment for more than 5 years by 2005, select Last_name,to_char (hire_date, ' Yyyy-mm-dd ') from Employeeswhere to_date (' 2005-12-31 ', ' Yyyy-mm-dd ')-hire_date >=5
Next month's Today (System time plus 1 months) Select Add_months (sysdate,1) from dual;
--Date after two days select Next_day (sysdate,2) from dual;


Oracle Learning Note Line function

Related Article

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.