select * from t_hq_ryxx; select nianl, xingm from t_hq_ryxx; select nianl as 年龄, xingm as 姓名 from t_hq_ryxx t; select nianl 年龄 from t_hq_ryxx; select nianl || xingm as 年龄和姓名 from t_hq_ryxx; select nianl as hhh,t.* from t_hq_ryxx t order by nianl desc…
oracle部分: 定义类型(用于字符串分割): create or replace TYPE "STR_SPLIT" IS TABLE OF VARCHAR2 (4000); 字符串分割函数: create or replace FUNCTION splitstr(p_string IN VARCHAR2, p_delimiter IN VARCHAR2) RETURN str_split PIPELINEDAS v_length NUMBER := LENGTH(p_string)…
一.常用sql 1.查看版本 SELECT * FROM V$VERSION; SELECT version FROM V$INSTANCE 2.数据库发生死锁时,跟踪文件的位置 关于跟踪文件,大义是oracle发生错误时,会写日志到跟踪文件,比如发生死锁时,该文件就是排查利器: Each server and background process can write to an associated trace file. When an internal error is detected…
--1.简单的数据查询语句--查询所有的员工的信息select * from emp;--查询员工的姓名和工作职位select ename,job from emp;--姓名和工作以中文的形式显示出来select ename "姓名",job "工作职位" from emp;select ename as "姓名",job as "工作职位" from emp;--查询每个员工的职位select job from emp;--…
分支语句/循环语句 v_case ) :; begin then dbms_output.put_line('条件成立'); elsif then then dbms_output.put_line('条件不成立1'); end if; elsif then dbms_output.put_line('条件不成立2'); else dbms_output.put_line('条件不成立3'); end if; case v_case then dbms_output.put_line('条件成立…
alter table test enable row movement; alter table test shrink space; execute dbms_stats.gather_table_stats(ownname=>'&owner',tabname=>'&table_name', estimate_percent=>null,method_opt=>'for all columns' ,degree=>2,cascade=>true);…