Database Reference
In-Depth Information
IF (left_fruit.name = 'ORANGE' AND
right_fruit.name = 'APPLE' )
THEN
RETURN (1.5 * left_fruit.qty) >
right_fruit.qty;
END IF;
RETURN left_fruit.qty > right_fruit.qty;
END;
$$
LANGUAGE plpgsql;
postgres=# SELECT
fruit_qty_larger_than('("APPLE",
3)'::FRUIT_QTY,'("ORANGE", 2)'::FRUIT_QTY);
fruit_qty_larger_than
-----------------------
f
(1 row)
postgres=# SELECT
fruit_qty_larger_than('("APPLE",
4)'::FRUIT_QTY,'("ORANGE", 2)'::FRUIT_QTY);
fruit_qty_larger_than
-----------------------
t
(1 row)
CREATE OPERATOR > (
leftarg = FRUIT_QTY,
rightarg = FRUIT_QTY,
procedure = fruit_qty_larger_than,
commutator = >
);
postgres=# SELECT '("ORANGE", 2)'::FRUIT_QTY >
'("APPLE", 2)'::FRUIT_QTY;
?column?
----------
Search WWH ::




Custom Search