This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
kurs:typkonvertierung_-_casten [2016/05/11 12:10] mh |
kurs:typkonvertierung_-_casten [2016/11/30 11:14] (current) admin |
||
---|---|---|---|
Line 3: | Line 3: | ||
</code> | </code> | ||
+ | <code> | ||
+ | CREATE OR REPLACE FUNCTION TRY_TO_NUMBER | ||
+ | (p_val in varchar2) | ||
+ | RETURN NUMBER AS | ||
+ | v_number number; | ||
+ | BEGIN | ||
+ | begin | ||
+ | v_number := to_number(p_val); | ||
+ | exception | ||
+ | when VALUE_ERROR then | ||
+ | v_number := 0; | ||
+ | end; | ||
+ | return v_number; | ||
+ | END TRY_TO_NUMBER; | ||
+ | </code> | ||