oracle行转列
select i.sid,i.sname,i.birthday,i.schooltime,i.sphone,c.classname,a.assnname,sum(decode(subject,'语文',s.score,0)) as chin,
sum(decode(subject,'数学',s.score,0)) as math,
sum(decode(subject,'英语',s.score,0)) as eng from student_info i
left join student_expand e on i.sid = e.sid left join student_class c on
c.classid = e.classid left join student_assn a on a.assnid = e.assnid left join student_score s on s.sid = i.sid
group by i.sid,i.sname,i.birthday,i.schooltime,i.sphone,c.classname,a.assnname;
行转列:
decode(subject,'数学',s.score,0) 用法:如果subject会等于数学 ,则最后值等于 s.score 否则值等于: 0
相关文档:
虽然这是我找到最详细的配置描述,但是尝试还是没有成功。
1.下载Oracle Client Package
.
从
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html
下载
Instant
Client Package – Basic
包
(
标注
:All files
required to run OCI, OCCI, and JDBC-OC ......
CREATE OR REPLACE TYPE ty_str_array IS TABLE OF VARCHAR2 (4000);
CREATE OR REPLACE FUNCTION fn_split (p_str IN VARCHAR2, p_delimiter IN VARCHAR2)
RETURN ty_str_split
IS
j INT := 0;
i INT := 1;
len INT := 0;
&nbs ......
首先以sysdba身份登录
sqlplus connect system/orcl as sysdba;
然后修改参数
1.sga_target不能大于sga_max_size,可以设置为相等。
2.SGA加上PGA等其他进程占用的内存总数必须小于操作系统的物理内存。
alter system set sga_target=150M scope=spfile;
alter system set sga_max_size=150M scope=spfile;
//数据库 ......
select a.constraint_name, a.table_name, b.constraint_name
from user_constraints a, user_constraints b
where a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_constraint_name = b.constraint_name
P 代表主键
R 代表外键 ......