Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle PL/SQL ORDER Method      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

Term: ORDER

Definition:
In Oracle PL/SLQ,, the ORDER method is one of the member methods used in the Oracle Object Relational Model to order variables of an object type. It compares the values of two objects based on criteria you specify. One of these objects is SELF while the other one is a parameterized object belonging to the same object type. Based on a comparative condition it returns numeric values -1 (less than), 0 (equal), or +1 (greater than).

Do not confuse ORDER with ORDER_BY; they are completely different terms with different meanings and applications.

Example Syntax:

ORDER MEMBER FUNCTION [METHOD NAME] ( [TYPE PARAMETER] )


Example Usage:

CREATE OR REPLACE TYPE TYP_ORD AS OBJECT (
L_NUM1 NUMBER,
L_NUM2 NUMBER,
ORDER MEMBER FUNCTION SORT (P TYP_ORD) RETURN INTEGER );
/

CREATE OR REPLACE TYPE BODY TYP_ORD AS
ORDER MEMBER FUNCTION SORT(P TYP_ORD) RETURN INTEGER IS
BEGIN
IF L_NUM1 < P.L_NUM1 THEN
RETURN -1;
ELSIF L_NUM1 > P.L_NUM1 THEN
RETURN 1;
ELSE
RETURN 0;
END IF;
END;
END;
/

Related Code Snippets:
  • ORDER BY Clause - The ORDER BY clause is used by, and is the last clause of, a SELECT statement.
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 340 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?