Oracle 10g includes improved overloading of numeric types like:
-- Create package specification. CREATE OR REPLACE PACKAGE numeric_overload_test AS PROCEDURE go (p_number NUMBER); PROCEDURE go (p_number BINARY_FLOAT); PROCEDURE go (p_number BINARY_DOUBLE); END; /-- Create package body. CREATE OR REPLACE PACKAGE BODY numeric_overload_test AS PROCEDURE go (p_number NUMBER) AS BEGIN DBMS_OUTPUT.put_line('Using NUMBER'); END; PROCEDURE go (p_number BINARY_FLOAT) AS BEGIN DBMS_OUTPUT.put_line('Using BINARY_FLOAT'); END; PROCEDURE go (p_number BINARY_DOUBLE) AS BEGIN DBMS_OUTPUT.put_line('Using BINARY_DOUBLE'); END; END; /-- Test it. SET SERVEROUTPUT ON BEGIN numeric_overload_test.go(10); numeric_overload_test.go(10.1f); numeric_overload_test.go(10.1d); END; / |
It is important to check that the correct overload is being used at all times. The appropriate suffix or conversion function will make the engine to pick the correct overload.
Fonte: http://www.oracle-base.com/articles/10g/PlsqlEnhancements10g.php
Nenhum comentário :
Postar um comentário