摘要:
General FunctionsThe following functions work with any data ype and pertain to using nulls:NVL(expr1,expr2)NVL2(expr1,expr2,expr3)NULLIF(expr1,expr2)COALESCE(expr1,expr2,...,exprn)NVL FunctionConverts an null value to an actual value:Data types that can be used are date,character,and number.Data typ 阅读全文
摘要:
Nesting FunctionsSingle-row functions can be nested to any level.Nested functions are evaluated from the deepese level to the least deep level.View Code SQL> SELECT last_name,UPPER(CONCAT(SUBSTR(LAST_NAME,1,8),'_US')) FROM employees WHERE department_id = 60;LAST_NAME UPPER(CONCAT(SUB... 阅读全文
摘要:
Conversions FunctionsImplicit Data Type ConversionIn expressions,the Oracle server can automatically conver the following:FromToVARCHAR2 or CHARNUMBERVARCHAR2 or CHARDATEDemo-01:View Code SQL> SELECT employee_id,first_name,TO_CHAR(hire_date,'YYYY-MM-DD HH24:MI:SS') FROM employees WHERE hi 阅读全文
摘要:
Using Conversion Functions and Conditional ExpressionsAfter completing this lesson,you should be able to do the following:Describe various types of conversion functions that are available in SQLUse the TO_CHAR,TO_NUMBER,and TO_DATE conversion functions.Apply conditional expressions in a SELECT state 阅读全文
摘要:
Working with DatesThe Oracle database stores dates in an internal numeric format:century,year,month,day,hours,minutes,and seconds.The default date display format is DD-MON-RR.-Enables you to store 21st-century dates in the 20th century by specifying only the last two digits of the year.-Enables you 阅读全文
摘要:
Number FunctionsROUND:Rounds value to a specified deciamlTRUNC:Truncates value to a specified decimalMOD:Returns remainder fo divisionFunctionResultROUND(45.926,2)45.93TRUNC(45.926,2)45.92MOD(1600,300)100Demo-01:Using the ROUND FunctionSQL> SELECT ROUND(45.923,2),ROUND(45.923,0),ROUND(45.923,-1) 阅读全文
摘要:
ObjectivesAfter completing this lesson,you should be able to do the following:Describe various types of functions available in SQL.Use character,number,and date functions in SELECT statements.Lesson AgendaSingle-row SQL functionsCharacter functionsNumber functionsWorking with datesDate functions/* 函 阅读全文