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. sql 锁相关(转)

    锁是数据库中的一个非常重要的概念,它主要用于多用户环境下保证数据库完整性和一致性. 我们知道,多个用户能够同时操纵同一个数据库中的数据,会发生数据不一致现象.即如果没有锁定且多个用户同时访问一个数据库 ...

  2. 为sublime text2 添加SASS语法高亮

    以前写CSS时,都是直接写样式,没有任何的第三方工具,后面发现越是面向大网站,越难管理,上次参加完携程UED大会后,发现SASS对于前端团队多人协作和站点代码维护上很有帮助,很多同学都开始用了,我还是 ...

  3. 使用Sass预定义一些常用的样式,非常方便(转)

    SS预处理技术现在已经非常成熟,比较流行的有Less,Sass,Stylus,在开发过程中提升我们的工作效率,缩短开发时间,方便管理和维护代码,可以根据自己的喜好选择一款自己喜欢的工具开发,使用很接近 ...

  4. POJ2200+全排列模拟

    简单. 手动的实现全排列 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<a ...

  5. cocos2d-x for js 继承的写法

    cocos2d-x for js中集成了两套继承写法,一套是JR的(jquery的作者),一套是google. 目前来说,cocos2d-x for js demo使用JR的写法----未完待续... ...

  6. matlab 画图

    先前讲解了简单绘图方法: http://www.cnblogs.com/youxin/p/3859923.html x = 0:pi/100:2*pi; y = sin(x); plot(x,y)下面 ...

  7. 在运行时切换 WinForm 程序的界面语言 ---------多语言设置基础

    System.ComponentModel.ComponentResourceManager .ApplyResources 时间:2015-06-17 14:59:06      阅读:473    ...

  8. hadoop mapreduce核心功能描述

    核心功能描述 应用程序通常会通过提供map和reduce来实现 Mapper和Reducer接口,它们组成作业的核心. Mapper Mapper将输入键值对(key/value pair)映射到一组 ...

  9. phpstrom 与 xdebug 配合实现PHP单步调试

    不说废话,直接开始. 第一步: 安装并配置xdebug 安装 可以从官网直接下载对应php版本的xdebug,下载地址:  https://xdebug.org/download.php 配置,典型的 ...

  10. BZOJ_1009_[HNOI2008]_GT考试_(动态规划+kmp+矩阵乘法优化+快速幂)

    描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1009 字符串全部由0~9组成,给出一个串s,求一个长度为n的串,不包含s的种类有多少. 分析 ...