Solution for Cut & Divide Text by ',' without Declare or Create Procedure
来源:互联网 发布:linux vi显示行数 编辑:程序博客网 时间:2024/05/30 02:24
with Core as
(select co.course_number,
(case
when termid=((substr('¶m1',1,4))-'1990') *100
then substr('¶m1',1,9)
when termid=((substr('¶m1',1,4))-'1990')*100+1
then 'S1'
when termid=((substr('¶m1',1,4))-'1990')*100+2
then 'S2'
when termid=((substr('¶m1',1,4))-'1990')*100+3
then 'Q1'
when termid=((substr('¶m1',1,4))-'1990')*100+4
then 'Q2'
when termid=((substr('¶m1',1,4))-'1990')*100+5
then 'Q3'
when termid=((substr('¶m1',1,4))-'1990')*100+6
then 'Q4'
end)
as Term,
co.course_name,cc.section_number,cc.teacherid,cc.studentid from
cc join courses co
on co.course_number=cc.course_number
and termid>=UPPER(
(select ((substr('¶m1',1,4))-'1990')*100 from dual))
group by co.course_number, co.course_name,cc.section_number,cc.teacherid,cc.studentid,
(case
when termid=((substr('¶m1',1,4))-'1990') *100
then substr('¶m1',1,9)
when termid=((substr(¶m1',1,4))-'1990')*100+1
then 'S1'
when termid=((substr('¶m1',1,4))-'1990')*100+2
then 'S2'
when termid=((substr('¶m1',1,4))-'1990')*100+3
then 'Q1'
when termid=((substr('¶m1',1,4))-'1990')*100+4
then 'Q2'
when termid=((substr('¶m1',1,4))-'1990')*100+5
then 'Q3'
when termid=((substr('¶m1',1,4))-'1990')*100+6
then 'Q4'
end)
order by course_number,section_number)
SELECT COURSE_NUMBER,TERM,COURSE_NAME,SECTION_NUMBER,TEACHERNAME,STUDENT_NUMBER,StudentName,HOME_ROOM,FATHERPHONE,FATHEREMAIL,MOTHERPHONE,MOTHEREMAIL FROM
(
select course_number,Term,course_name,section_number,t.lastfirst as TeacherName,student_number,s.lastfirst as StudentName,s.home_room,MF.CUST_FATHERMOBILEPHONE AS FATHERPHONE,MF.CUST_FATHEREMAIL AS FATHEREMAIL,MF.CUST_MOTHERMOBILEPHONE AS MOTHERPHONE,MF.CUST_MOTHEREMAIL AS MOTHEREMAIL
from students s
join core c
on s.id=c.studentid
and s.enroll_status='0'
join teachers t
on t.id=c.teacherid
join U_STUDENTSUSERFIELDS MF
on MF.studentsdcid=s.dcid
)
WHERE
course_NUMBER=UPPER('¶m2')
and
(
(case
when
'¶m3' is null
and 1=1
then 1 end )=1
or
(case
when '¶m3' is not null
and
(
section_number in (
select substr(regexp_substr(UPPER('¶m3'),
'[^,]+',
1,
level),
1
,40)
from dual
connect by level <= regexp_count(UPPER('¶m3'),
',') + 1)
)
then 1 end)=1
)
order by course_number,section_number,studentname,student_number
;
- Solution for Cut & Divide Text by ',' without Declare or Create Procedure
- Solution for calculate & Output without Declare (Useful for SQL Developer)
- Capture Text solution for Qt
- Divide a number by 3 without using *, /, +, -, % operators
- CREATE PROCEDURE
- CREATE PROCEDURE
- CREATE PROCEDURE
- Solution Manager Key (SMSY) (Solution Manager 4.0) Step by Step Procedure with Screens
- Replace OR with UNION solution for Oracle
- 存储过程-CREATE PROCEDURE
- create procedure error 1607
- CREATE procedure pr_createjxc
- create procedure example
- SAP HANA CREATE PROCEDURE
- Solution for Error: APP-FND-01931 or FRM-92050
- How To Create a Full Android Phone or Tablet Backup Without Rooting or Unlocking Your Device
- Solution for supporting fieldLength when creating shapefile by Geotools
- LintCode Wood Cut java solution
- 关于Redis不能从连接池获取资源的错误
- 将JPG,BMP,PNG图片插入到ACCESS数据库
- 转载,是好?是坏?
- Ubuntu16.04安装MATLAB2014a
- Windows下mxnet的编译与安装
- Solution for Cut & Divide Text by ',' without Declare or Create Procedure
- DES加密和解密工具Ⅰ
- IPMI命令常用命令设置
- How to Use Cursor
- 【PHP高级】Smarty模板二
- jsp 页面 el表达式无法使用
- js 中数据类型和对象的相关
- Android开发之图片处理框架(二)
- 2016CCPC-Fianl宁波流水账