Search This Blog

Showing posts with label Function. Show all posts
Showing posts with label Function. Show all posts

Monday, 4 December 2017

ORA-22950 cannot ORDER objects without MAP or ORDER method

The following is the cause of this error:

The values of a scalar datatype such as CHAR or REAL have a predefined order, which allows them to be compared.
But an object type, such as a some_type, which can have multiple attributes of various data types, has no predefined axis of comparison.
To be able to compare and order variables of an object type, you must specify a basis for comparing them.
Two special kinds of member methods can be defined for doing this: map methods and order methods.
The action you can take to resolve this issue: Define a MAP or ORDER method for the object type.

For more information, you can see https://docs.oracle.com/cd/B19306_01/appdev.102/b14260/adobjbas.htm#sthref211

Thursday, 25 February 2016

MS Excel: ABS function

DESCRIPTION
The Microsoft Excel ABS function returns the absolute value of a number

SYNTAX
The syntax for the ABS function in Microsoft Excel is:
ABS( number )

PARAMETERS or ARGUMENTS
number - A numeric value used to calculate the absolute value.

EXAMPLES
Let's look at some Excel ABS function examples and explore how to use the ABS function as a worksheet function in Microsoft Excel:



Based on the Excel spreadsheet above, the following ABS examples would return:
=ABS(A1)
 Result: 120
=ABS(A2)
 Result: 3.5
=ABS(A3)
 Result: 45
=ABS(-6.9)
 Result: 6.9
=ABS(5-15)
 Result: 10

Tuesday, 23 February 2016

MS Excel: IF function

DESCRIPTION
The Microsoft Excel IF function returns one value if a condition is true and another value if is not.

SYNTAX
The syntax for the IF function in Microsoft Excel is:
IF(logical_test, value_if_true, [value_if_false])

PARAMETERS or ARGUMENTS
logical_test     - The condition you want to test. You can use other logical functions within this argument, including AND, OR and XOR functions.
value_if_true - The value that you want to be returned if the result of logical_test is TRUE.
value_if_false - The value that you want to be returned if the result of logical_test is FALSE. This parameter is optional.

NOTE
You can put another IF function in IF function in the place of some of the arguments.
=IF(E2>=85,"A",IF(E2>=75,"B","C"))

EXAMPLES
Let's look at some Excel IF function examples and explore how to use it

The following IF examples would return:
=IF(A2>B2,"Over Budget","OK")
  Result: Over Budget
=IF(A4=500,B4-A4,"")
  Result: 425
=IF(A3>200, "Larger", "Smaller")
  Result: Larger
=IF(A2=1500, "Equal", "Not Equal")
  Result: Equal

Wednesday, 10 February 2016

Oracle DB: REPLACE Function

DESCRIPTION

The Oracle REPLACE function replaces a sequence of characters in a string with another set of characters.

SYNTAX

REPLACE( string1, string_to_replace, replacement_string )

PARAMETERS or ARGUMENTS

string1 - The string to replace a sequence of characters with another set of characters.

string_to_replace - The string that will be searched for in string1.

replacement_string – This parameter is optional. All occurrences of string_to_replace will be replaced with replacement_string in string1. If the replacement_string parameter is omitted, the REPLACE function simply removes all occurrences of string_to_replace, and returns the resulting string.

EXAMPLES

REPLACE('123123test', '12');    
     Result: '33test'
REPLACE('123work123', '123');   
     Result: 'work'
REPLACE('222oracle', '2', '3'); 
     Result: '333oracle'
REPLACE('0000102300', '0');     
     Result: '123'
REPLACE('0000888', '0', ' ');   
     Result: '    888'

Tuesday, 9 February 2016

Oracle DB: NVL Function

DESCRIPTION

NVL replaces NULL value with other value in the results of a query.

SYNTAX

NVL(expr1, expr2)

PARAMETERS or ARGUMENTS

If expr1 is NULL, then NVL returns expr2. If expr1 is not NULL, then NVL returns expr1.
The arguments expr1 and expr2 can have any datatype. If their datatypes are different, then Oracle Database implicitly converts one to the other. If they are cannot be converted implicitly, the database returns an error.
The implicit conversion is implemented as follows:
-          If expr1 is character data, then Oracle Database converts expr2 to the datatype of expr1 before comparing them and returns VARCHAR2 in the character set of expr1.
-          If expr1 is numeric, then Oracle determines which argument has the highest numeric precedence, implicitly converts the other argument to that datatype, and returns that datatype.

EXAMPLES
SQL> SELECT NVL(supplier_city, 'n/a')
       FROM suppliers;


The SQL statement above would return 'n/a' if the supplier_city field contained a NULLvalue. Otherwise, it would return the supplier_city value.

Friday, 5 February 2016

MS Excel: SUM function

DESCRIPTION
The Microsoft Excel SUM function adds all numbers in a range of cells and returns the result.

SYNTAX
The syntax for the SUM function in Microsoft Excel is:
SUM( number1, [number2, ... number_n] )
OR
SUM ( cell1:cell2, [cell3:cell4], ... )

PARAMETERS or ARGUMENTS
number    -  A numeric value that you wish to sum.
cell           -  The range of cells that you wish to sum.

NOTE
You can sum combinations of both numbers and ranges of cells using the SUM function.

EXAMPLES
Let's look at some Excel SUM function examples and explore how to use the SUM function as a worksheet function in Microsoft Excel:

Based on the Excel spreadsheet above, the following SUM examples would return:

=SUM(A2, A3)            
  Result: 17.7
=SUM(A3, A5, 45)        
  Result: 57.6
=SUM(A2:A6)             
  Result: 231.2
=SUM(A2:A3, A5:A6)      
  Result: 31.2
=SUM(A2:A3, A5:A6, 500) 
  Result: 531.2

Search This Blog