뇨내

PLS-00306 본문

Error/SQL

PLS-00306

삐옥 2021. 12. 5. 15:32

 

오류보고

PL/SQL: Statement ignored

PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'

= 문법 무시 + 'PUT_LINE'부분에 잘못된 숫자 및 인수가들어감

 


해 결

> 84 line 부분이 에러!! ',' 가 들어가면 안된다. 

 

  - 수정전

dbms_output.put_line(tname, cname, vstartclassdate, vfinishclassdate, crname,  vtotal, cstate);

 

 - 수정후

dbms_output.put_line(tname || cname || vstartclassdate || vfinishclassdate || crname ||  vtotal || cstate);

 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
create or replace procedure proTClassSearch
(
    pteacher_seq tblteacher.teacher_seq%type
)
is
    tname tblteacher.name%type;
    cname tblclass.name%type;
    vstartclassdate tbllclass.startclassdate%type;
    vfinishclassdate tbllclass.finishclassdate%type;
    crname tblclassroom.name%type;  
    
    vtotal tblsugang.lclass_seq%type;--- 총 등록 인원수
    cstate tbllclass.startclassdate%type; -- 강의 진행 상태
    
    cursor vcursor is
select 
    distinct t.name as "교사명"
    c.name as "과정명"
    lc.startclassdate as "개강"
    lc.finishclassdate as "종강"
    cr.name "강의실",
    
    (select count(distinct(student_seq)) 
    from tblteacher t inner join tbllsubject ls on t.teacher_seq = ls.teacher_seq
                      inner join tbllclass lc on lc.lclass_seq = ls.lclass_seq
                      inner join tblsugang su on su.lclass_seq = lc.lclass_seq
         where t.teacher_seq =pteacher_seq) as "등록인원수",
    
    case
        when lc.startclassdate <= sysdate and lc.finishclassdate >= sysdate then '진행중'
        when lc.startclassdate > sysdate then '예정'
        when lc.startclassdate < sysdate then '종료'
    end as "강의진행상태"
 
from tblclass c
    inner join tbllclass lc
        on c.class_seq = lc.class_seq
            inner join tbllsubject ls
                on ls.lclass_seq = lc.class_seq
                    inner join tblteacher t
                        on t.teacher_seq = ls.teacher_seq
                            inner join tblclassroom cr
                                on cr.classroom_seq = lc.classroom_seq                                    
                 where ls.teacher_seq = pteacher_seq
                    order by "개강" asc;
 
 
begin 
    open vcursor;
    select (select count(distinct(student_seq)) 
    from tblteacher t inner join tbllsubject ls on t.teacher_seq = ls.teacher_seq
                      inner join tbllclass lc on lc.lclass_seq = ls.lclass_seq
                      inner join tblsugang su on su.lclass_seq = lc.lclass_seq
         where t.teacher_seq =pteacher_seq) into vtotal from tblclass c
    inner join tbllclass lc
        on c.class_seq = lc.class_seq
            inner join tbllsubject ls
                on ls.lclass_seq = lc.class_seq
                    inner join tblteacher t
                        on t.teacher_seq = ls.teacher_seq
                            inner join tblclassroom cr
                                on cr.classroom_seq = lc.classroom_seq                                    
                 where ls.teacher_seq = pteacher_seq;
        select 
            (case
                when lc.startclassdate <= sysdate and lc.finishclassdate >= sysdate then '진행중'
                when lc.startclassdate > sysdate then '예정'
                when lc.startclassdate < sysdate then '종료'
            end ) into cstate from tblclass c
    inner join tbllclass lc
        on c.class_seq = lc.class_seq
            inner join tbllsubject ls
                on ls.lclass_seq = lc.class_seq
                    inner join tblteacher t
                        on t.teacher_seq = ls.teacher_seq
                            inner join tblclassroom cr
                                on cr.classroom_seq = lc.classroom_seq                                    
                 where ls.teacher_seq = pteacher_seq;
        
        
        loop
            fetch vcursor into tname, cname, vstartclassdate, vfinishclassdate, crname, vtotal, cstate;
            exit when vcursor%notfound;           
          -- !!!!에러부분!!!!! dbms_output.put_line(tname, cname, vstartclassdate, vfinishclassdate, crname,  vtotal, cstate);   
        end loop;
    close vcursor;
end proTClassSearch;
cs

'Error > SQL' 카테고리의 다른 글

ORA-02291  (0) 2021.12.08
ORA-08002  (0) 2021.11.21
ORA-00001  (0) 2021.11.21
ORA-00942  (0) 2021.11.21
ORA-01727  (0) 2021.11.14
Comments