호야님~ 한번 더 부탁드립니다.(Ms-SQL -> 오라클) 0 2 4,457

by 손님 [PL/SQL] ORA-00904 오라클 Ms-SQL Toad [2010.03.23 16:44:39]



지난번 문의 드렸던 내용입니다.
답변 주셨구요..
근데.. 아래와 같이 하니 ORA-00904:  invalid identifier 에러가 뜹니다.
이유는 도무지 모르겠습니다.

CREATE OR REPLACE PROCEDURE PARKDVL.PROC_TEST_LIST_SEARCH (
    sType   in   varchar2,
    sYear    in  varchar2,
    sSType   in    varchar2,
    sSubject in    varchar2,
    O_RESULT out TYPES.CURSORTYPE
)IS

    ssql     varchar(4000);

BEGIN
    if sType = 'S' then
   
    ssql := 'SELECT t_code, t_year, t_term, t_title, t_start_date, t_start_time,
    t_end_time, t_continue, t_place, (select count(*) from OnlineTest_user
    where t_code = OnlineTest_Info.t_code and t_year = OnlineTest_Info.t_year
    and t_term = OnlineTest_Info.t_term and t_subjcd = OnlineTest_Info.t_subjcd) t_appcnt,
      (select count(*) from OnlineTest_user
    where t_code = OnlineTest_Info.t_code and t_year = OnlineTest_Info.t_year
    and t_term = OnlineTest_Info.t_term and t_subjcd = OnlineTest_Info.t_subjcd and U_CONTINUE = ''y'') t_usecnt,
    (select count(*) from OnlineTest_user
    where t_code = OnlineTest_Info.t_code and t_year = OnlineTest_Info.t_year
    and t_term = OnlineTest_Info.t_term and t_subjcd = OnlineTest_Info.t_subjcd) t_passcnt
    FROM OnlineTest_Info where t_active = ''y''';
   
    if sYear = 'All' then
    ssql := ssql;
    else
    ssql := ssql || 'and q_year = sYear' ;
    end if;
   
    if sSType = 'All' then
    ssql := ssql;
    else
    ssql := ssql || ' and t_type = sSType';
    end if;
   
    if sSubject = 'All' thne
    ssql := ssql;
    else
    ssql := ssql || ' and T_SUBJCD = sSubject';
    end if;
   
    open O_RESULT   
    for ssql;
   
    end if;
   
   
END PROC_TEST_LIST_SEARCH;
/

위의 경우 각각 sYear, sSType, sSubject를 인식하지 못하는것 같습니다. 자꾸 그 부분에 ORA-00904:  invalid identifier  에러가 나는 걸로 봐서는요..
뭐가 잘못된 건가요??

그리고 혹시 toad에서 제가 작성한 프로시저를 실행하고 쿼리문을 찍어보거나 뭔가 디버깅 하는 방법 혹시 아시면 좀 알려주세요.. ^^
제가 오라클이 처음이라서 많이 힘듭니다. 잘 부탁드립니다~^^

미리 감사해요~

by 마농 [2010.03.23 16:56:22]
ssql := ssql || ' and q_year = ''' || sYear || '''' ;

by 손님 [2010.03.23 17:04:31]
감사합니다. ㅎㅎ
위의 방법도 해봤는데.. 문제는 '이 갯수에 있었나봅니다.
ㅎㅎ 전 두개만 했더니 계속 같은 에러가 나더라고요.. ^^
감사합니다~
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입