Oracle10g Common commands and common functions

Source: Internet
Author: User

Select view_name from user_views view the User View list

Select view_name from dba_views System View list

 
 

Desc User_views view information structure

Desc User_tables

 
 

DESC user_synonyms

DESC Dba_synonyms // view the synonym Field

 
 

 
 

Select user from dual current Login user Name

Length

CharacterQuantity

Usage:LENGTH (Str)

LengthB

BytesQuantity

Usage:LENGTHB (Str)

Ltrim


Remove spaces on the left

Rtrim

Remove spaces on the right

Trim

Remove leading and trailing Spaces

Eg:

Select Length (Ltrim ('abc') from dual;

4

 
 

SubSTR


Substring

Usage:SUBSTR (str, startCount, Length)

Str: string to be retrieved

StartCount: Start number, starting from 1.

Length of Count

Replace

Replace

Replace (oldStr, newStr)

 
 

 
 

 
 

 
 

 
 

SYSDATE

System time

Select sysdate from dual

 
 

CURRENT_DATE


Current Time

Alert session set NLS_DATE_FORMAT = 'dd-mon-yyyy hh: mi: si ';

// Change the current time format

 
 

NEXT_DAY

SELECT NEXT_DAY (SYSDATE, 'monday') FROM dual

// Select the date of the next Monday.

 
 

TO_CHAR

Convert non-character to character

Usage
TO_CHAR (content to be converted, Format)

Eg:

Select TO_CHAR (sysdate, 'yyyy-mm-dd') FROM dual;

2008-11-8

 
 

SELECT TO_CHAR (SYSDATE, 'yyyy-mm-ddHh24: Mi: ss') FROM dual;

23:15:00

 
 

TO_DATE

Converts a character to a time

SELECT TO_DATE ('12-March-08 ') FROM dual

 
 

TO_NUMBER

Convert to digital

SELECT TO_NUMBER ('123') FROM dual

8

 
 

 
 

 
 

Aggregate functions

 
 

MAX

Maximum Value

MIN

Minimum

SUM

And

AVG

Average

COUNT

Count // note

COUNT (*) is not necessarily equal to COUNT (column)

  

  

 
 

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.