Pages

Sunday, 28 February 2016

Functions

Functions can be categorized as follows.

1. Single row functions      2. Group functions

SINGLE ROW FUNCTIONS:  

Single row functions can be categorized into five. These will be applied for each row and produces individual output for each row.

1. Numeric functions
2. String functions
3. Date functions
4. Miscellaneous functions
5. Conversion functions

GROUP FUNCTIONS 
1. Sum
2. Avg
3. Max
4. Min
5. Count

Numeric functions

1     abs
2     sign
3     sqrt
4     mod
5     nvl
6     power
7     exp
8     ln
9     log
10  ceil
11  floor
12  round
13  trunk
14  bitand
15  greatest
16  least
17  coalesce


String functions

18  initcap
19  upper
20  lower
21  length
22  rpad
23  lpad
24  ltrim
25  rtrim
26  trim
27  translate
28  replace
29  soundex
30  concat  ( ‘ || ‘ concatenation operator)
31  ascii
32  chr
33  substr
34  instr
35  decode
36  greatest
37  least
38  coalesce


Date functions

39  sysdate
40  current_date
41  current_timestamp
42  systimestamp
43  localtimestamp
44  dbtimezone
45  sessiontimezone
46  to_char
47  to_date
48  add_months
49  months_between
50  next_day
51  last_day
52  extract
53  greatest
54  least
55  round
56  trunc
57  new_time
58  coalesce

H) to_char

  
    Date formats
 
            D                      --         no of days in week
            Dd                    --         no of days in month
            Ddd                 --         no of days in year
            Mm                   --         no of month
            Mon                 --         three letter abbreviation of month
            Month             --         fully spelled out month
            Rm                   --         roman numeral month
            Dy                    --         three letter abbreviated day
            Day                  --         fully spelled out day
            Y                      --         last one digit of the year
            Yy                    --         last two digits of the year
            Yyy                  --         last three digits of the year
            Yyyy                --         full four digit year
            Syyyy             --          signed year
            I                       --         one digit year from iso standard
            Iy                     --         two digit year from iso standard
            Iyy                   --         three digit year from iso standard
            Iyyy                 --         four digit year from iso standard
            Y, yyy              --         year with comma
            Year                --         fully spelled out year
            Cc                    --         century
            Q                      --         no of quarters
            W                     --         no of weeks in month
            Ww                  --         no of weeks in year
            Iw                    --         no of weeks in year from iso standard
            Hh                    --         hours
            Mi                    --         minutes
            Ss                    --         seconds
            Ff                     --         fractional seconds
            Am or pm         --         displays am or pm depending upon time of day
            A.m or p.m       --         displays a.m or p.m depending upon time of day
            Ad or bc          --         displays ad or bc depending upon the date
            A.d or b.c        --         displays ad or bc depending upon the date
            Fm                    --         prefix to month or day, suppresses padding of month or day
            Th                    --         suffix to a number
            Sp                    --         suffix to a number to be spelled out
            Spth                --         suffix combination of th and sp to be both spelled out
            Thsp                --         same as spth




S) new_time


    Timezones

                        Ast/adt         --         atlantic standard/day light time
                        Bst/bdt          --         bering standard/day light time
                        Cst/cdt          --         central standard/day light time
                        Est/edt          --         eastern standard/day light time
                        Gmt                 --         greenwich mean time
                        Hst/hdt         --         alaska-hawaii standard/day light time
                        Mst/mdt         --         mountain standard/day light time
                        Nst                 --          newfoundland standard time
                        Pst/pdt          --         pacific standard/day light time
                        Yst/ydt          --         yukon standard/day light time

Miscellaneous functions

59  uid
60  user
61  vsize
62  rank
63  dense_rank

Conversion functions

64  bin_to_num
65  chartorowid
66  rowidtochar
67  to_number
68  to_char
69  to_date


Group functions

70  sum
71  avg
72  max
73  min

74  count

No comments:

Post a Comment