* 질문 등록 시 다음의 내용을 꼭 기입하여 주세요.
|
|
CentOS 7.9 64bit |
|
|
CUBRID 11.4.4 (11.4.4.1832-7f8f019) |
|
|
[도움말]-[버전정보] 확인 |
|
|
java, php, odbc 등 입력 |
* CUBRID 응용 오류, SQL 오류 또는 SQL 튜닝 관련된 문의는 반드시 다음의 내용을 추가해 주세요. 비밀글이나 비밀 댓글도 가능합니다.
* 저희가 상황을 이해하고, 재현이 가능해야 알 수 있는 문제들이 많습니다. 가능한 정보/정황들을 부탁합니다.
| 에러 내용 및 재현 방법 | 재현 가능한 Source와 SQL |
| 관련 테이블(인덱스, 키정보 포함) 정보 | CUBRID 홈 디렉토리 아래 log 디렉토리 압축 |
-------------- 아래에 질문 사항을 기입해 주세요. ------------------------------------------------------------------------
# test sample
1. java 생성
public class cubTest {
public static String concatThree(String s1, String s2, String s3) {
if (s1 == null) s1 = "";
if (s2 == null) s2 = "";
if (s3 == null) s3 = "";
return s1 + s2 + s3;
}
public static String concatTwo(String s1, String s2) {
if (s1 == null) s1 = "";
if (s2 == null) s2 = "";
return s1 + s2;
}
}
2. 함수 생성
CREATE FUNCTION fn_concat3(a VARCHAR, b VARCHAR, c VARCHAR) RETURN VARCHAR
AS LANGUAGE JAVA
NAME 'cubTest.concatThree(java.lang.String, java.lang.String, java.lang.String) return java.lang.String';
CREATE FUNCTION fn_concat2(a VARCHAR, b VARCHAR) RETURN VARCHAR
AS LANGUAGE JAVA
NAME 'cubTest.concatTwo(java.lang.String, java.lang.String) return java.lang.String';
# 이상 현상 : 함수에서 함수를 호출 할때 함수가 호출 되는 인자 위치에 따라 오류가 출력되거나 정상턴
1. 각기 함수 동작 test시 정상 동작
csql> select fn_concat2('123','456');
=== <Result of SELECT Command in Line 2> ===
fn_concat2('123', '456')
======================
'123456'
1 row selected. (0.045001 sec) Committed. (0.000000 sec)
1 command(s) successfully processed.
csql> select fn_concat3('12','34','56');
=== <Result of SELECT Command in Line 1> ===
fn_concat3('12', '34', '56')
======================
'123456'
1 row selected. (0.008000 sec) Committed. (0.000000 sec)
1 command(s) successfully processed.
2. 함수에서 다른 함수를 호출 하는 경우 위치에 따라 비정상 동작
2.1 인자 값이 2개인 함수
2.1.1 함수(함수, 'string') => 오류
csql> select fn_concat2(fn_concat2('123','456'),'123'); => 오류
In the command from line 1,
ERROR: Stored procedure execute error: 1
0 command(s) successfully processed.
2.1.2 함수( 'string', 함수) => 정상
csql> select fn_concat2('123',fn_concat2('123','456')); => 정상
=== <Result of SELECT Command in Line 1> ===
fn_concat2('123', fn_concat2('123', '456'))
======================
'123123456'
1 row selected. (0.011001 sec) Committed. (0.000000 sec)
1 command(s) successfully processed.
2.2 인자 값이 2개인 함수
2.2.1 함수(함수, 'string', 'string') => 오류
csql> select fn_concat3(fn_concat2('123','456'),'12','123'); => 오류
In the command from line 1,
ERROR: Stored procedure execute error: 1
0 command(s) successfully processed.
2.2.2 함수('string', 함수, 'string') => 오류
csql> select fn_concat3('123', fn_concat2('45','67'), '123'); => 오류
In the command from line 1,
ERROR: Stored procedure execute error: 2
0 command(s) successfully processed.
2.2.3 함수( 'string', 'string', 함수) => 정상
csql> select fn_concat3('123', '456', fn_concat2('12','34')); => 정상
=== <Result of SELECT Command in Line 1> ===
fn_concat3('123', '456', fn_concat2('12', '34'))
======================
'1234561234'
1 row selected. (0.013001 sec) Committed. (0.000000 sec)
1 command(s) successfully processed.
말씀해주신 문제를 재현하였으며, 현재 내부적으로 원인 분석 및 검토를 진행 중입니다.
분석이 완료되면 확인된 내용과 함께 안내드리겠습니다.
감사합니다.