CREATE PROCEDURE proc_count( IN yearmonth CHAR(6), IN to_day CHAR(8), OUT p_trname VARCHAR(20), OUT p_count INTEGER )
SPECIFIC trname_cnt
LANGUAGE SQL
BEGIN DECLARE v_trsf CHAR(10); SET v_trsf='TRSF'||yearmonth; SELECT trname,count(*) INTO p_trname,p_count FROM $v_trsf WHERE date=$to_day and ( trname='trsf_1110_trsf' or trname='trsf_1210_trsf' ) group by trname;
END
제 의도는 -_-a
200401, 20040105 일케 두개를 입력받아서요,
FROM 부분에 trsf200401을 넣고,
WHERE 의 date에 20040105를 넣어서
결과값으로 trname과 count 값을 받아오는 걸 만들라고 합니다.
위에꺼대로 입력을 하면 . . .
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "= and ( trname='trsf_1110_trsf' or trname" was found following " FROM WHERE date". Expected tokens may include: "<space>". LINE NUMBER=17. SQLSTATE=42601
이런 에러가 나오네요 . . .
잘못된 부분이 어딘지좀 알려주세요 ㅜ.ㅜ
더불어 stored procedure 실행할땐 어떻게 해야 하는지두요 . . .
JDBC로 연결해서 웹에서 쓸라하는데 . . .
초본지라 도통 모르겠네요 ㅜ.ㅜ
|