best: SELECT * FROM ( SELECT A.*, ROWNUM RN FROM (SELECT * FROM tf_f_theme) A WHERE ROWNUM <= 40)WHERE RN >= 30
batter: select * from (select a.*,rownum rn from(select * from tf_f_theme) a) where RN BETWEEN 21 AND 40
update tablename colname=replace( colname, string_to_replace, [ replacement_string ] )
In Oracle/PLSQL, the replace function replaces a sequence of characters in a string with another set of characters.
The syntax for the replace function is:
replace( string1, string_to_replace, [ replacement_string ] )
string1 is the string to replace a sequence of characters with another set of characters.
string_to_replace is the string that will be searched for in string1.
replacement_string is optional. All occurrences of string_to_replace will be replaced with replacement_string in string1. If the replacement_string parameter is omitted, the replace function simply removes all occurrences of string_to_replace, and returns the resulting string.
For example:
replace('123123tech', '123'); would return 'tech'
replace('123tech123', '123'); would return 'tech'
replace('222tech', '2', '3'); would return '333tech'
replace('0000123', '0'); would return '123'
replace('0000123', '0', ' '); would return ' 123'
public Connection get Connection()
{
try{
String strUrl=CONNECTION_STRING+"?user="+username+"&password="+password+"&useUnicode=true&characterEncoding=gb2312";
conn=DriverManager.getConnection(strUrl);}
catch(Exception e)
{con=null;}
}
return con;
}
1,mysql
利用MySQL的一个特性实现MySQL查询结果的分页显示
来源:本文出自: 作者: (2001-07-05 18:08:00)
在mysql中利用select语句的一个特性就可以很方便地实现查询结果的分页,select语句的语法:
SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [HIGH_PRIORITY]
[DISTINCT | DISTINCTROW | ALL]
select_expression,...
[INTO OUTFILE 'file_name' export_options]
[FROM table_references
[WHERE where_definition]
[GROUP BY col_name,...]
[HAVING where_definition]
[ORDER BY {unsigned_integer | col_name | formula} [ASC | DESC] ,...]
[LIMIT [offset,] rows]
[PROCEDURE procedure_name] ]
LIMIT子句可以用来限制由SELECT语句返回过来的数据数量,它有一个或两个参数,如果给出两个参数,
第一个参数指定返回的第一行在所有数据中的位置,从0开始(注意不是1),第二个参数指定最多返回行
数。例如:
select * from table LIMIT 5,10; #返回第6-15行数据
select * from table LIMIT 5; #返回前5行
select * from table LIMIT 0,5; #返回前5行
(http://www.fanqiang.com)