摘要: Conditional ExpressionsPrvoide the use of the IF-THEN-ELSE logic within a SQL statementUse two methods-CASE expression(SQL标准)-DECODE function(专属Oracle)CASE ExpressionFacilitates conditional inquiries by doing the work of an IF-THEN-ELSE statement:CASE expr WHEN comparison_expr1 THEN return_expr1 ... 阅读全文
posted @ 2013-04-12 18:06 ArcerZhang 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2013-04-12 17:24 ArcerZhang 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2013-04-12 16:51 ArcerZhang 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2013-04-12 15:36 ArcerZhang 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2013-04-12 14:45 ArcerZhang 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2013-04-12 14:08 ArcerZhang 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 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) 阅读全文
posted @ 2013-04-12 12:35 ArcerZhang 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 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/* 函 阅读全文
posted @ 2013-04-12 10:38 ArcerZhang 阅读(321) 评论(0) 推荐(0) 编辑