2009年5月19日星期二

mget一次传送多个文件都要回答y

使用ftp –i <ip>
或者prompt命令关闭Interactive mode

修改命令行窗口的Code Page

chcp 950 中文繁体big5
chcp 936 中文简体gbk

Sorting Multilingual Data

Oracle9i之前,中文是按照二进制编码进行排序的。在oracle9i中新增了按照拼音、部首、笔画排序功能。

1、设置NLS_SORT参数值
      SCHINESE_RADICAL_M 按照部首(第一顺序)、笔划(第二顺序)排序
      SCHINESE_STROKE_M 按照笔划(第一顺序)、部首(第二顺序)排序
      SCHINESE_PINYIN_M 按照拼音排序

2、Session级别的设置,修改ORACLE字段的默认排序方式:
      按拼音:alter session set nls_sort = SCHINESE_PINYIN_M;
      按笔画:alter session set nls_sort = SCHINESE_STROKE_M;
      按偏旁:alter session set nls_sort = NLS_SORT=SCHINESE_RADICAL_M;

3、语句级别设置排序方式:
      按照笔划排序
      select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_STROKE_M');
      按照部首排序
      select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_RADICAL_M');
      按照拼音排序,此为系统的默认排序方式
      select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_PINYIN_M');

4、修改系统参数(数据库所在操作系统):
      set NLS_SORT=SCHINESE_RADICAL_M ;export NLS_SORT (sh)
       setenv NLS_SORT SCHINESE_RADICAL_M (csh)
      HKLC\SOFTWARE\ORACLE\home0\NLS_SORT (win注册表)

Oracle 官方说明

NLS_SORT NLS_SORT specifies the collating sequence for ORDER BY queries. NLS_COMP NLS_COMP specifies the collation behavior of the database session.

Property

Description

Parameter type

String

Syntax

NLS_SORT = { BINARY | linguistic_definition }

Default value

Derived from NLS_LANGUAGE

Modifiable

ALTER SESSION

Range of values

BINARY or any valid linguistic definition name

  • If the value is BINARY, then the collating sequence for ORDER BY queries is based on the numeric value of characters (a binary sort that requires less system overhead).
  • If the value is a named linguistic sort, sorting is based on the order of the defined linguistic sort. Most (but not all) languages supported by the NLS_LANGUAGE parameter also support a linguistic sort with the same name.

    Note:

    Setting NLS_SORT to anything other than BINARY causes a sort to use a full table scan, regardless of the path chosen by the optimizer. BINARY is the exception because indexes are built according to a binary order of keys. Thus the optimizer can use an index to satisfy the ORDER BY clause when NLS_SORT is set to BINARY. If NLS_SORT is set to any linguistic sort, the optimizer must include a full table scan and a full sort in the execution plan.

         You must use the NLS_SORT operator with comparison operations if you want the linguistic sort behavior.

Property

Description

Parameter type

String

Syntax

NLS_COMP = { BINARY | LINGUISTIC | ANSI }

Default value

BINARY

Modifiable

ALTER SESSION

Basic

No

Values:

  • BINARY

Normally, comparisons in the WHERE clause and in PL/SQL blocks is binary unless you specify the NLSSORT function.

  • LINGUISTIC

Comparisons for all SQL operations in the WHERE clause and in PL/SQL blocks should use the linguistic sort specified in the NLS_SORT parameter. To improve the performance, you can also define a linguistic index on the column for which you want linguistic comparisons.

  • ANSI

A setting of ANSI is for backwards compatibility; in general, you should set NLS_COMP to LINGUISTIC

2009年5月18日星期一

FLT_EPSILON

FLT_EPSILON
This is the minimum positive floating point number of type float such that 1.0 + FLT_EPSILON != 1.0 is true. It's supposed to be no greater than 1E-5.

2009年5月13日星期三

《潜伏》中的一段对话

        余则成:是觉得无路可走了吗?
晚秋:(哭,点头)
余:其实你面前有一条通往未来的路啊。(秋流泪摇头)值得你活下去。那一路很美好,就像你的诗歌一样。怎么会觉得无路可走了呢?
秋:你愿意娶我吗?
余:比娶你更美好。还多了一份自由。你不是最向往自由吗?
秋:(点头)
余:你也知道我的身份了。你愿意去吗?
秋:那我就再也见不到你了。
余:那儿有很多人都像我一样。那是另一个世界,好地方,好风光。你那么年轻,那么漂亮,可以选择的。你想想,晚秋,你站在一列雄壮的队伍里,迈着大步,高唱着战歌,去改变整个中国,那是什么气势?一个小小的余则成,就是路边的一个送行者,你看见了他,他看见了你,你们挥挥手就过去了。再往前就是更有意义的生活。沮丧吗?无非就是一个小布尔乔亚的无病呻吟。留恋它就是一种高度近视。有时候看得远一点,不就什么都有了么。包括爱。

2009年4月27日星期一

Oracle Dump函数

DUMP returns a VARCHAR2 value containing the datatype code, length in bytes, and internal representation of expr. The returned result is always in the database character set. For the datatype corresponding to each code, see Table 2-2, "Storage of Scale and Precision".

The argument return_fmt specifies the format of the return value and can have any of the following values:

  • 8 returns result in octal notation.

  • 10 returns result in decimal notation.

  • 16 returns result in hexadecimal notation.

  • 17 returns result as single characters.

By default, the return value contains no character set information. To retrieve the character set name of expr, add 1000 to any of the preceding format values. For example, a return_fmt of 1008 returns the result in octal and provides the character set name of expr.

The arguments start_position and length combine to determine which portion of the internal representation to return. The default is to return the entire internal representation in decimal notation.

If expr is null, then this function returns NULL.

This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion.

The following examples show how to extract dump information from a string expression and a column:

SELECT DUMP('abc', 1016)
FROM DUAL;

DUMP('ABC',1016)
------------------------------------------
Typ=96 Len=3 CharacterSet=WE8DEC: 61,62,63

2009年4月24日星期五