Sql関数の切り上げ処理をメモします。
select TRUNC(1000 / 1000 + 0.999,0) from dual --結果:1
select TRUNC(1001 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1103 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1203 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1303 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1403 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1503 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1603 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1703 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1803 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1903 / 1000 + 0.999,0) from dual --結果:2
select TRUNC(1999 / 1000 + 0.999,0) from dual --結果:2
PS:
TRUNC関数は切り上げ関数ではなく、切捨て関数です。
自分で作ったり提供したりするものは、まず自分自身で使ってみろろということです。自分じゃ使わないものなら人はいくらでも無責任にも無思考にもなれる。そういう投げやりな「サービス」やら「プロダクツ」なんて、だれだってイヤだ。自分が作り手と同時に利用者の立場になれば、ちゃんと使えるレベルのものを提供しようとします。
2010年9月27日月曜日
2010年4月5日月曜日
Oracle常用コマンド
●Oracleキャラクタ・セット:
select * from nls_database_parameters
select nls_charset_id('JA16SJIS') from dual;
select nls_charset_name(832) from dual;
●Oracleデータベースバージョン:
select * from v$version;
●ユーザ名の取得:
select user from dual
select * from nls_database_parameters
select nls_charset_id('JA16SJIS') from dual;
select nls_charset_name(832) from dual;
●Oracleデータベースバージョン:
select * from v$version;
●ユーザ名の取得:
select user from dual
登録:
コメント (Atom)