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. vs2013下使用Assist X的破解方法

    Assist X的破解下载:http://pan.baidu.com/s/1kTnDH23 密码:j9jp 01.安装,点击VA_X_Setup2042.exe 安装 02.破解 找到这样的目录:C: ...

  2. 如何确定照片是否被PS过

    除了用软件,还可以先右键属性----解除锁定----重新打开属性看详细信息.

  3. 练习PYTHON之EVENTLET

    以下是重点,要会运用: eventlet是一个用来处理和网络相关的python库函数,而且可以通过协程来实现并发,在eventlet里,把“协程”叫做 greenthread(绿色线程).所谓并发,就 ...

  4. PHP file_exists() 函数

    定义和用法 file_exists() 函数检查文件或目录是否存在. 如果指定的文件或目录存在则返回 true,否则返回 false. 语法 file_exists(path) 参数 描述 path ...

  5. android 设备唯一码的获取,Cpu号,Mac地址

    开发Android应用中,我们常常需要设备的唯一码来确定客户端. Android 中的几中方法,使用中常常不可靠 1. DEVICE_ID 假设我们确实需要用到真实设备的标识,可能就需要用到DEVIC ...

  6. 选择排序SelectSort

    /** * * @author Administrator * 功能:选择排序法 */ package com.test1; import java.util.Calendar; public cla ...

  7. 启动Activity时显示空白界面的问题

    问题描述: 启动activity时,先显示一个空白的界面,带标题栏的,1秒左右的时间后才显示activity对应 layout上的内容. 解决办法: 将activity的windows设置为透明的就可 ...

  8. 【HDOJ】3509 Buge's Fibonacci Number Problem

    快速矩阵幂,系数矩阵由多个二项分布组成.第1列是(0,(a+b)^k)第2列是(0,(a+b)^(k-1),0)第3列是(0,(a+b)^(k-2),0,0)以此类推. /* 3509 */ #inc ...

  9. hdu4722Good Numbers(dp)

    链接 这题规律其实挺明显的 打表找规律估计都可以 正规点就是DP 算出第N位所包含的good number的数量 如果给出的数是N+1位 就枚举各位上比原来小的数 加上下一位的dp值 一个i写成g了 ...

  10. java文件IO操作

    package com.io; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream ...