需求:找出代理商中没有挂商家的代理商 简单SQL如下: select * from t_proxy tp where tp.id not in (SELECT tp.id as p_id FROM t_proxy tp start with tp.id in (select distinct tm.proxy_id from t_merchant tm where tm.proxy_id is not null) connect by prior tp.parent_id = tp.id)…
Oracle列操作 增加一列: alter table emp4 add test varchar2(10); 修改一列: alter table emp4 modify test varchar2(20); 删除一列: alter table emp4 drop column test; 这里要注意几个地方,首先,增加和修改列是不需要加关键字COLUMN,否则会报错ora-00905. 其次,对删除单列的话,一定要加COLUMN,然后记住,删除是不需要加列类型的. 做法如下: 增加多列: al…
众所周知,递归编程是一项有争议的技术,因为它需要大量的内存,但是它能简化一些编程任务.基本上,一个递归操作都是程序调用自己传递参数修改的值或者参数传递到当前的程序循环中.递归编程通常用来计算阶乘斐波那契数列,回文,谢尔宾斯基地毯等问题.下面的代码演示了用递归实现的阶乘. /** * Calculate the factorial of n (n! = 1 * 2 * 3 * … * n). * * @param n the number to calculate the factorial of…
沿用 Oracle OCI操作UDT相关学习 一文中定义的类型和表. 1.更改数据 在sqldeveloper 中更新数据, update dxl.cust set addr.street='a11' where addr.street ='aaa';commit; 上边这个语句会报错,而如果采用下边这个语句操作则正确update dxl.cust a set a.addr.street='a11' where a.addr.street ='aaa';commit; 2.OCI 更改数据 同样…
--Oracle clob 操作 -- Created on 2015/4/8 by TianPing declare -- Local variables here v_clob1 Clob; v_clob2 Clob; v_amount Int; --长度 v_offset Int; --偏移量 ); Begin --初始或清空clob变量 dbms_lob.createtemporary(v_clob1,True); dbms_lob.createtemporary(v_clob2,Tru…
using System; using System.Data; using System.Collections.Generic; using System.Configuration; using System.Data.OracleClient; using System.Text; using System.IO; /// <summary> /// Oracle数据库操作类 /// </summary> public static class OracleHelper {…
环境:SunOS + Oracle 11.2.0.3 对部分表进行Move操作之后,未重建对应的索引,会导致ORA-1502 索引不可用. 此时需要用下面的查询拼接出重建不可用索引的sql语句: select 'alter index '||index_name||' rebuild tablespace dbs_cssf_gt online;' from user_indexes where status = 'UNUSABLE' order by index_name desc; 重建过…