sql语句相关整理
select * from jcls_lawfirms where length(lf_2)=2 for update
select * from jcls_lawfirms where length(lf_2)>4
select * from jcls_lawfirms where lf_1 like '%凉山%'for update
select * from jcls_lawfirms where lf_2 like '%江油%'
update jcls_lawfirms set lf_2 = '都江堰市'where lf_2 like '%都江堰%'
update jcls_lawfirms set lf_2 ='金堂县'where l_firmname = '金堂县广兴法律服务所'
select * from jcls_lawfirms where l_firmname = '金堂县广兴法律服务所'
delete from jcls_lawfirms where l_id ='2553'
select * from jcls_lawfirms where l_id ='2553'
update jcls_lawfirms set l_firmname ='峨眉山市符溪法律服务所'where l_id ='2553'
select * from jcls_lawfirms for update
select * from jcls_lawfirms where length(l_firmname)<10
名称:l_firmname 组织形式:l_firmproperty 负责人:l_director 地址:l_address 联系电话:l_phone 所属地市:lf_1
---------------------------------------------------------------------------------------
select y.l_id,y.l_lawfirmsid,y.l_name,y.l_la1,f.lf_1,f.lf_2 from jcls_lawfirms f,jcls_lawyer y where y.l_lawfirmsid=f.l_id
select y.l_id,y.l_lawfirmsid,y.l_name,y.l_la1,f.lf_1,f.lf_2
0:id 1:机构id 2:姓名 3:机构名 4:市 5:县
alter table Tablename add(column1 varchar2(255))
update gzc_notary_office set jgbm='5101'where n_areacounty like '成都%'
update gzc_notary_office set jgbm='5107'where n_areacounty like '绵阳%'
update gzc_notary_office set jgbm='5103'where n_areacounty like '自贡%'
update gzc_notary_office set jgbm='5104'where n_areacounty like '攀枝花%'
update gzc_notary_office set jgbm='5105'where n_areacounty like '泸州%'
update gzc_notary_office set jgbm='5106'where n_areacounty like '德阳%'
update gzc_notary_office set jgbm='5108'where n_areacounty like '广元%'
update gzc_notary_office set jgbm='5109'where n_areacounty like '遂宁%'
update gzc_notary_office set jgbm='5110'where n_areacounty like '内江%'
update gzc_notary_office set jgbm='5111'where n_areacounty like '乐山%'
update gzc_notary_office set jgbm='5113'where n_areacounty like '南充%'
update gzc_notary_office set jgbm='5115'where n_areacounty like '宜宾%'
update gzc_notary_office set jgbm='5116'where n_areacounty like '广安%'
update gzc_notary_office set jgbm='5117'where n_areacounty like '达州%'
update gzc_notary_office set jgbm='5119'where n_areacounty like '巴中%'
update gzc_notary_office set jgbm='5118'where n_areacounty like '雅安%'
update gzc_notary_office set jgbm='5114'where n_areacounty like '眉山%'
update gzc_notary_office set jgbm='5120'where n_areacounty like '资阳%'
update gzc_notary_office set jgbm='5132'where n_areacounty like '阿坝%'
update gzc_notary_office set jgbm='5133'where n_areacounty like '甘孜%'
update gzc_notary_office set jgbm='5134'where n_areacounty like '凉山%'
delete from jcls_lawyer
DROP TRIGGER jcls_lawyer_trigger
create sequence position_seq
start with 1
increment by 1
minvalue 1
maxvalue 9999999
nocycle
nocache
noorder;
create or replace trigger jcls_lawyer_trigger
before insert on jcls_lawyer
for each row
begin
select position_seq.nextval into :new.l_id from dual;
end ;
insert into jcls_lawyer(l_lawfirmsid,l_la1,l_name)
with temp as
(
select l_id as id,l_firmname as firmname,lf_3 as text from jcls_lawfirms
)
select id,firmname,substr(text,instr(text,'、',1,rn)+1,instr(text,'、',1,rn+1)-instr(text,'、',1,rn)-1) text from
(
select id,firmname,'、'||t1.text||'、' text,t2.rn from
(select id,firmname,text,length(text)-length(replace(text,'、',''))+1 rn from temp) t1,
(select rownum rn from all_objects where rownum <= (select max(length(text)-length(replace(text,'、',''))+1) rn from temp)) t2
where t1.rn >= t2.rn order by text,rn
)
select * from jcls_lawyer
———————————————————————————————————————————
select * from rmtj_twh t where xian is null
update rmtj_twh set xian =(select dq from xzqh where xzqh.bm = '510105') where rmtj_twh.bm like'510105%'
update rmtj_twh set xian =(select dq from xzqh where xzqh.bm = '510106') where substr(rmtj_twh.bm,1,6)='510106'
select dq from xzqh where bm like '5101%'
begin
for i in reverse 513221..513437 loop
update rmtj_twh set xian =(select dq from xzqh where xzqh.bm = i) where substr(rmtj_twh.bm,1,6)=i;
end loop;
end;
select id,zztype,zzname,createdate,phone,address,city from rmtj_twh
select id,zztype,zzname,createdate,phone,address,city from rmtj_twh where 1=1 and city = '省直属' order by id
select r.id,r.zztype,r.zzname,r.createdate,r.phone,r.address,r.city from rmtj_twh r where 1=1
---------------------------------------------------------------------------------------
根据另一张表修改表字段
update lss_lawyer t set sortnum ='9' where exists(select 1 from ac07 a where t.idcard=a.aac002 and a.aac009 is not null)
---------------------------------------------------------------------------------------
联表查询
DetachedCriteria cre = DetachedCriteria.forClass(NataryPersonnal.class);
if (group != null) {
String groupcode = group.getGroupCode();
if (groupcode.substring(4, 6).equals("00")) {
groupcode = groupcode.substring(0,4);
}
DetachedCriteria unitinfo = DetachedCriteria.forClass(NotaryOffice.class);
unitinfo.add(Restrictions.like("jgbm", (groupcode+"%")));
unitinfo.setProjection(Property.forName("nid"));
cre.add(Property.forName("notaryId").in(unitinfo));
}
------------------------------------------------------------------------------------
如何在Oracle中复制表结构和表数据 【转载】
1. 复制表结构及其数据:
create table table_name_new as select * from table_name_old
2. 只复制表结构:
create table table_name_new as select * from table_name_old where 1=2;
或者:
create table table_name_new like table_name_old
3. 只复制表数据:
如果两个表结构一样:
insert into table_name_new select * from table_name_old
如果两个表结构不一样:
insert into table_name_new(column1,column2...) select column1,column2... from table_name_old
pasting
sql语句相关整理的更多相关文章
- [20190329]探究sql语句相关mutexes补充2.txt
[20190329]探究sql语句相关mutexes补充2.txt --//昨天测试sql语句相关mutexes,看看如果出现多个子光标的情况. 1.环境:SCOTT@book> @ ver1P ...
- [20190328]简单探究sql语句相关mutexes.txt
[20190328]简单探究sql语句相关mutexes.txt --//摘要:http://www.askmaclean.com/archives/understanding-oracle-mute ...
- 捷信达会员管理系统SQL语句相关
捷信达会员管理系统SQL语句相关 USE gshis GO SET ANSI_NULLS, QUOTED_IDENTIFIER ON GO /***************************** ...
- SQL语句的整理
mysql语句的整理 1.SQL DML 和 DDL 可以把 SQL 分为两个部分:数据操作语言 (DML) 和 数据定义语言 (DDL). SQL (结构化查询语言)是用于执行查询的语法.但是 SQ ...
- Oracle数据库高效sql语句的整理
业务需求说明:由于之前公司后台APP端有一个document表,该表中包含了所有的信息,新的需求就是通过该表创建出一个新的用户表(usertable)和一个档案表(document,该表只保留原doc ...
- SQL语句简单整理
转载原文:http://blog.sina.com.cn/s/blog_48df31d901017c6o.html 1.用户 - 查看当前用户的缺省表空间 select username,defaul ...
- 常用SQL语句汇总整理
1.SQL 插入语句得到自动生成的递增ID 值 insert into Table1(Name,des,num) values (''ltp'',''thisisbest'',10); select ...
- sql语句相关操作
create user test identified by test default tablespace users temporary tablespace temp quota 3M on u ...
- 常用SQL语句学习整理
增 insert into table_name (column_name1,column_name2) values (value1,value2) 删 delete from table_name ...
随机推荐
- dos下的edit命令使用详解
dos下的edit命令使用详解 来源:网络 作者:未知 edit命令是一个简单的编辑软件,我们经常用它来编辑一些程序和批处理文件. 比如,我想在c盘根目录下编辑一个简单的批处理文件,要求无论当前盘和当 ...
- 用jQuery在IFRAME里取得父窗口的某个元素的值
收集网上的一些示例: 用jQuery在IFRAME里取得父窗口的某个元素的值 只好用DOM方法与jquery方法结合的方式实现了 1.在父窗口中操作 选中IFRAME中的所有单选钮 $(window. ...
- csuoj 1350: To Add Which?
这个题目其实很简单,可惜当时比赛的时候看到出的人少,以为有trick,就和队友扯淡去了: 因为每个数总是被相邻的数影响,所以往前往后扫两遍就行了: #include<cstdio> #in ...
- Python 标准库 urllib2 的使用细节
刚好用到,这篇文章写得不错,转过来收藏. 转载自 道可道 | Python 标准库 urllib2 的使用细节 Python 标准库中有很多实用的工具类,但是在具体使用时,标准库文档上对使用细节 ...
- SQL跨表更新
[一篮饭特稀原创,转载请注明出自http://www.cnblogs.com/wanghafan/p/4384039.html] 前提:两张表要更新的字段.关联字段结构一致 更新库:FJPDI_TZ ...
- [jobdu]把数组排成最小的数
这道题见过,就是把相加的结果作为比较来排序就行了.注意的是comp函数里面要用const引用.而且c++里的字符串直接操作(读入和相加)也很方便. #include <iostream> ...
- .Net remoting, Webservice,WCF,Socket区别
传统上,我们把计算机后台程序(Daemon)提供的功能,称为"服务"(service).比如,让一个杀毒软件在后台运行,它会自动监控系统,那么这种自动监控就是一个"服务& ...
- -_-#【CSS 优化】
高性能CSS 关于css通配符性能问题不完全测试 CSS的渲染效率 border: none; /* 不写 border: 0; 但几乎都是写 border: 0;的.. */ 不要使用过小的图片做背 ...
- 如何删除已上线的IAP项
cleared for sale to NO. then Delete.
- C# MVC模式下商品抽奖
很久没有写博客,于是就把最近项目需求的一个抽奖功能给整理了下,语言表达能力不好,写的不好请勿吐槽,一笑而过就好.好了下面开始说说这个抽奖功能.因为涉及到公司的项目所以一些敏感的地方均已中文代替. 首先 ...