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

-----------------------------------------------------------------------------
不等于(可查看为空的) and nvl(l.islvsuo,'xx')<>'0'

sql语句相关整理的更多相关文章

  1. [20190329]探究sql语句相关mutexes补充2.txt

    [20190329]探究sql语句相关mutexes补充2.txt --//昨天测试sql语句相关mutexes,看看如果出现多个子光标的情况. 1.环境:SCOTT@book> @ ver1P ...

  2. [20190328]简单探究sql语句相关mutexes.txt

    [20190328]简单探究sql语句相关mutexes.txt --//摘要:http://www.askmaclean.com/archives/understanding-oracle-mute ...

  3. 捷信达会员管理系统SQL语句相关

    捷信达会员管理系统SQL语句相关 USE gshis GO SET ANSI_NULLS, QUOTED_IDENTIFIER ON GO /***************************** ...

  4. SQL语句的整理

    mysql语句的整理 1.SQL DML 和 DDL 可以把 SQL 分为两个部分:数据操作语言 (DML) 和 数据定义语言 (DDL). SQL (结构化查询语言)是用于执行查询的语法.但是 SQ ...

  5. Oracle数据库高效sql语句的整理

    业务需求说明:由于之前公司后台APP端有一个document表,该表中包含了所有的信息,新的需求就是通过该表创建出一个新的用户表(usertable)和一个档案表(document,该表只保留原doc ...

  6. SQL语句简单整理

    转载原文:http://blog.sina.com.cn/s/blog_48df31d901017c6o.html 1.用户 - 查看当前用户的缺省表空间 select username,defaul ...

  7. 常用SQL语句汇总整理

    1.SQL 插入语句得到自动生成的递增ID 值 insert into Table1(Name,des,num) values (''ltp'',''thisisbest'',10); select ...

  8. sql语句相关操作

    create user test identified by test default tablespace users temporary tablespace temp quota 3M on u ...

  9. 常用SQL语句学习整理

    增 insert into table_name (column_name1,column_name2) values (value1,value2) 删 delete from table_name ...

随机推荐

  1. csuoj 1351: Tree Counting

    这是一个动态规划的题: 当初想到要用dp,但是一直想不到状态转移的方程: 题解上的原话: 动态规划,设 g[i]表示总结点数为 i 的方案种数,另设 f[i][j]表示各个孩子的总结点数为i,孩子的个 ...

  2. "Money, Money, Money"

    acdream1408:http://115.28.76.232/problem?pid=1408 题意:给你一个x,让你构造a,b,是的na+bm可以组成大于x的所有的数.a>1,b>1 ...

  3. 关于Jquery中ajax方法data参数用法的总结

    data 发送到服务器的数据.将自动转换为请求字符串格式.GET 请求中将附加在 URL 后.查看 processData 选项说明以禁止此自动转换.必须为 Key/Value 格式.如果为数组,jQ ...

  4. Eclipse导入git上的maven web项目 部署

    1 Eclipse中导入Git的maven项目 方法1: (1)首先当然是拉代码. 在Eclipse里面有个Git Repositories Exploring.就是Git仓库,clone a git ...

  5. 保护模式下GDTR,LDTR,全局描述符表,局部描述符表和选择器的关系

    这张图要注意:右边两个0-15,其中上面的是LDTR,  下面的是选择子. 图下第五个标线,是两个线交叉的,实际上第五个线是指向右边水平的那个线. 没有箭头的两组线分别表示GDT的区间,LDT的区间 ...

  6. codeforces Vasya and Digital Root

    /* * c.cpp * * Created on: 2013-10-7 * Author: wangzhu */ /** * 当时比赛时,想得复杂了,也想偏了, * 1).写出来之后,结果达到了预期 ...

  7. Oracle从11.2.0.2开始,数据库补丁包是一个完整安装包(转)

    从11.2.0.2开始,数据库补丁包是一个完整安装包.也就是说:比如要打11.2.0.2的补丁包,直接用11.2.0.2包来安装就可以了,不需要像10G一样先安装数据库软件再来打补丁包. 如果已经安装 ...

  8. Java 输入流读取文本文件换行符问题

    一问题 在学习流编程的过程中,我遇到了一下问题.首先来看一下我写的java源程序: package StreamLearn; import java.io.*; public class TestFi ...

  9. 安装gem invalid date format in specification错误的解决方法

    别的不说,报错信息直接贴图: 解决方法: 1.找到你环境目录下的spec,例如:D:\Ruby187\lib\ruby\gems\1.8\specifications. 2.找到引起错误文件的gems ...

  10. CH Round #17 舞动的夜晚

    舞动的夜晚 CH Round #17 描述 L公司和H公司举办了一次联谊晚会.晚会上,L公司的N位员工和H公司的M位员工打算进行一场交际舞.在这些领导中,一些L公司的员工和H公司的员工之间是互相认识的 ...