--基本函数--select name,count(id) from work_test group by name having count(id)>1--select upper(name),t.*,lower(name),substr(name,1,5) from WORK_TEST t--连表更新/*update work_test set(price)=(select t.price from work_test t where t.price=80.00 and t.id=work_…
oracle记录各登陆主机用户名,登陆ip,所执行的命令 /etc/profile #history USER_IP=`>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'` HISTDIR=/usr/share/.history if [ -z $USER_IP ] then USER_IP=`hostname` fi if [ ! -d $HISTDIR ] then mkdir -p $HISTDIR $HISTDIR fi if [ ! -d…
对于企业级大型系统,Oracle数据库的重要性不言而喻,作为长期使用Sql server的developer,花了点时间学习了一个Oracle的系列课程,总结一下. 1.oracle一些基础命令 sql*plus是操作Oracle的常用工具,以下一些常用命令: (1)连接数据库:conn 用户名/密码 as sysdba/sysoper (2)关闭连接:disc (3)改密码:psssw, alter user *** identified by *** (4)显示当前用户: show user…
存储过程创建语法: create or replace procedure 存储过程名(param1 in type,param2 out type) as 变量1 类型(值范围); 变量2 类型(值范围); Begin Select count(*) into 变量1 from 表A where列名=param1: If (判断条件) then Select 列名 into 变量2 from 表A where列名=param1: Dbms_output.Put_line(‘打印信息’); El…
高级查询 随机返回5条记录 select * from (select ename,job from emp order by dbms_random.value())where rownum<=5; 处理空值排序 select * from emp order by comm desc nulls last(first); 查询跳过表中的偶数行 select ename from (select row_number() over (order by name) rn,ename from e…