Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CBRD-25658] Supports pseudo column in SP parameter default values #2022

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

kiho-um
Copy link
Contributor

@kiho-um kiho-um commented Jan 6, 2025

Refer to http://jira.cubrid.org/browse/CBRD-25658

SP 파라미터 기본값에 의사컬럼(pseudo column) 지원

@kiho-um kiho-um requested review from hgryoo and swi0110 January 6, 2025 08:05
p_formatted_date VARCHAR DEFAULT TO_CHAR(SYSDATE, 'YYYY-MM-DD')
) AS
BEGIN
DBMS_OUTPUT.PUT_LINE('Formatted Date: ' || CASE isnull(p_formatted_date) WHEN 0 THEN 'ok' WHEN 1 THEN 'nok' END);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to_char( sysdate, 'YYYY-MM-DD')의 정확한 결과를 확인하는 것은 length 함수가 더 좋을것 같습니다.

예시)
CASE length(p_formatted_date) WHEN 10 THEN 'ok' else 'nok' END

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정 반영 하겠습니다.

DBMS_OUTPUT.PUT_LINE(' 0: ' || CASE isnull(p_date) WHEN 0 THEN 'ok' WHEN 1 THEN 'nok' END);
DBMS_OUTPUT.PUT_LINE(' 1: ' || CASE WHEN p_null_value IS NULL THEN 'ok' ELSE 'nok' END);
DBMS_OUTPUT.PUT_LINE(' 2: ' || CASE WHEN p_null_string = 'NULL' THEN 'ok' ELSE 'nok' END);
DBMS_OUTPUT.PUT_LINE(' 3: ' || CASE WHEN p_empty_string IS NULL THEN 'ok' ELSE 'nok' END);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p_empty_string 는 default로 ''로 설정했는데
비교는 NULL로 하고, 결과는 OK로 처리되고 있습니다.

즉, default로 설정한 ''가 NULL로 변경되었습니다.
버그로 보여지며, 개발팀에 확인해 주세요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CUBRID/cubrid#5792
머지가 되고, 반영되었는지 확인 후 수정 반영 하도록 하겠습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty 부분 CUBRID/cubrid#5792 머지가 완료되었음.

@kiho-um kiho-um requested review from ssihil and kwonhoil January 20, 2025 03:39
p_curr_datetime DATETIME DEFAULT CURRENT_DATETIME,
p_curr_date DATE DEFAULT CURRENT_DATE,
p_sys_time TIME DEFAULT SYS_TIME,
p_curr_time TIME DEFAULT CURRENT_TIME,
Copy link
Contributor

@kwonhoil kwonhoil Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p_date_time VARCHAR TO_CHAR(sysdatetime, 'YYYY-MM-DD HH24:MI:SS'),
추가해 주세요.

DBMS_OUTPUT.PUT_LINE(' 9: ' || CASE isnull(p_curr_datetime) WHEN 0 THEN 'ok' WHEN 1 THEN 'nok' END);
DBMS_OUTPUT.PUT_LINE('10: ' || CASE isnull(p_curr_date) WHEN 0 THEN 'ok' WHEN 1 THEN 'nok' END);
DBMS_OUTPUT.PUT_LINE('11: ' || CASE isnull(p_sys_time) WHEN 0 THEN 'ok' WHEN 1 THEN 'nok' END);
DBMS_OUTPUT.PUT_LINE('12: ' || CASE isnull(p_curr_time) WHEN 0 THEN 'ok' WHEN 1 THEN 'nok' END);
Copy link
Contributor

@kwonhoil kwonhoil Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DBMS_OUTPUT.PUT_LINE('13: ' || CASE length(p_date_time ) WHEN 19 THEN 'ok' ELSE 'nok' END);

추가해 주세요.

p_cuser VARCHAR DEFAULT CURRENT_USER,
p_unix_timestamp INTEGER DEFAULT UNIX_TIMESTAMP(),
p_sys_datetime DATETIME DEFAULT SYS_DATETIME,
p_curr_datetime DATETIME DEFAULT CURRENT_DATETIME,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SYS_DATE 추가해 주세요

p_curr_time TIME DEFAULT CURRENT_TIME,
p_var_number VARCHAR DEFAULT TO_CHAR(12345, 'S999999')
) AS
BEGIN
Copy link
Contributor

@kwonhoil kwonhoil Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys_date, sys_time 등과 같이 값이 변경되는 경우에는 length로 확인하는게 좋겠습니다.
length의 길이가 변경되는 경우에는 최소의 숫자보다 큰지를 확인하는게 좋을것 같습니다.

그 외에 user는 DBA 값으로 확인하고,
UNIX_TIMESTAMP()은 0보다 큰지 확인하는게 좋겠습니다.

END;

CREATE OR REPLACE PROCEDURE default_procedure_with_pseudo (
p_date DATE DEFAULT SYSDATE,
Copy link
Contributor

@kwonhoil kwonhoil Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p_sys_timestamp TIMESTAMP DEFAULT SYS_TIMESTAMP,
p_current_timestamp TIMESTAMP DEFAULT SYS_TIMESTAMP,

추가하고, 아래 출력하는 부분에도 추가해 주세요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants