阿拉丁的神灯
===========================================================
生成列名的连接
===========================================================
转自http://lastwinner.itpub.net/category/7102/14807
没有侵权的意思啊,放在自己这里用的时候好找。
开发中常常会用到一个表的字段组成的字符串,通常是用逗号分隔的一个列表,例如C_DM, C_MC, N_YXX 以前都是desc 表,然后将列名复制粘贴到Word里,然后用查找替换的方式将回车替换成“,”或者其他分隔符来做到,现在用sql来得到 select str from ( select str, rank()over(order by length(str) desc) rk from ( select sys_connect_by_path(column_name,'&Prefix') str from ( select s.*, rank()over(order by column_id desc) rn from user_tab_cols s where s.table_name=upper('&x') ) connect by rn = prior rn-1) ) where rk=1; 运行时输入前缀和表名即可,表名不区分大小写,对生成的字符串去掉最前面的分隔符即可

zzw0598 发表于:2006.05.22 15:55 ::分类: ( oracle开发 ) ::阅读:(2702次) :: 评论 (12)
re: 生成列名的连接 [回复]

this

cheap@cheap.com 评论于: 2006.09.29 14:59
re: 生成列名的连接 [回复]

this

cheap@cheap.com 评论于: 2006.10.12 08:47
re: 生成列名的连接 [回复]

this

cheap@cheap.com 评论于: 2006.10.12 08:48
re: 生成列名的连接 [回复]

this

cheap@cheap.com 评论于: 2006.10.12 08:51
re: 生成列名的连接 [回复]

this

cheap@cheap.com 评论于: 2006.10.12 08:51
re: 生成列名的连接 [回复]

this

cheap@cheap.com 评论于: 2006.10.12 08:51
re: 生成列名的连接 [回复]

this

cheap@cheap.com 评论于: 2006.11.22 20:15
好文章 [回复]

海是无边无际的,朋友是QQ428161617

gawrgjr 评论于: 2006.12.07 23:10
好文章 [回复]

海是无边无际的,朋友是QQ109811699

hseqacj 评论于: 2006.12.12 19:54
re: 生成列名的连接 [回复]

学习啦

oracle 评论于: 2007.11.28 19:49
re: 生成列名的连接 [回复]

你都注明来源了呀laughing

lastwinner 评论于: 2007.12.26 00:56
re: 生成列名的连接 [回复]

diprolene-af

diprolene-af 评论于: 2008.01.02 19:09

发表评论
标题

在此添加评论
表情符号: smile laughing tongue angry crying sad wassat wink

称呼

邮箱地址(可选)

个人主页(可选)




自我介绍
切换风格
新闻聚合
博客日历
文章归档...
最新发表...
博客统计...
Blog信息
网站链接...