2011/06/10

to_numberの使用 (to_number)

OTNにて、数値の変換が取り上げられていました。
http://forums.oracle.com/forums/thread.jspa?threadID=2192044

解決策としては、データソース側で算出すべき、というそもそも論と、以下の様にto_numberを使用する方法が提案されています。
<?xdoxslt:to_number(BEGIN_SEATS) + xdoxslt:to_number(MIN_SCHOOL2_BEG_SEATS) + xdoxslt:to_number(MAX_SCHOOL2_BEG_SEATS)?>

上記の構文は以下の様に記述することもできます。全体をxdofxで囲うことで、記述が若干ですがシンプルになります。
<?xdofx:(to_number(BEGIN_SEATS) + to_number(MIN_SCHOOL2_BEG_SEATS) + to_number(MAX_SCHOOL2_BEG_SEATS))?>


[Summary]
to_number is available in two ways.  In OTN, you can find the following formula:

<?xdoxslt:to_number(BEGIN_SEATS) + xdoxslt:to_number(MIN_SCHOOL2_BEG_SEATS) + xdoxslt:to_number(MAX_SCHOOL2_BEG_SEATS)?>


With Extended SQL function, you can rewrite it as follow.  In this syntax, you need to place xdofx at its beginning only.

<?xdofx:(to_number(BEGIN_SEATS) + to_number(MIN_SCHOOL2_BEG_SEATS) + to_number(MAX_SCHOOL2_BEG_SEATS))?>


OTN thread:



0 件のコメント:

コメントを投稿