728x90
반응형
- 오라클 NULL, NVL, NULLIF, COALESCEchantlemanIS NULL,IS NOT NULLNULL값인지 아닌지 비교NVL(c,r)c가 NULL이 아니면 c값으로, NULL이면 r 반환r에 보통 0을 넣음(결과가 0이 되게)NVL2(c,r1,r2)c가 NULL이 아니면 r1값으로, NULL이면 r2 반환NULLIF(c,d)c와 d를 비교하여 같으면 NULL을, 다르면 c값 반환COALESCE(p [,p...])파라미터중 NULL이 아닌 첫번째 파리미터 반환 NVLselect buyer_name 거래처, NVL(buyer_charger,'없다') 담당자 from buyer; select null+10 덧셈, 10*null 곱셈 from dual; null에 10을 더하거나 곱해도 결과는 null로 나옵니다. select NVL(null,0)+10 덧셈, ..
- 2024-07-12 14:29:09
- LAST_DAY(), TO_DATEchantleman사귄 날짜 구하기(오늘부터 1일)select round(sysdate - TO_DATE('2024-07-10','YYYY-MM-DD')+1 )사귄날짜 from dual;select round(sysdate - TO_DATE('2024-07-10')+1 )사귄날짜 from dual; 이번 달 얼마나 남았는지 확인하기select last_day(sysdate)-sysdate from dual;
- 2024-07-10 16:31:35
- 오라클 시간 설정chantlemanselect sysdate from dual;실행하면 아래와 같이 날짜데이터만 나오게 됩니다.만약 시간도 나오게 하고싶으면 도구-환경설정-데이터베이스-NLS 날짜형식에 HH24:MI:SS를 추가해주세요다시 실행하면 시간도 나옵니다.
- 2024-07-10 16:13:08
- width_bucket()chantlemanwidth_bucket(c,min,max,b): min에서 max 범위로 설정하고 b구간으로 나누어 c가 어느 구간에 속하는지 리턴select width_bucket(88,0,100,10) from dual;
- 2024-07-10 15:38:11
- mod(), remainder()chantlemanmod(c,n) remainder(c,n)둘 다 n으로 나눈 나머지를 구하는 함수입니다. mod: 원값 - (나눌 값* 나눈 값을 소수 첫째자리에서 버림한 값)=10 - 3*floor(10/3) remainder: 원값 - (나눌값*나눈 값을 소수 첫째자리에서 반올림한 값)=10 - 3*round(10/3)
- 2024-07-10 15:32:43
- trunc(), round()chantlemanround(number, [decimal_places]): 반올림number: 반올림할 숫자decimal_places: 반올림할 소수점 이하 자리수. 생략하면 0으로 간주 trunc(number, decimal_places): 절삭number : 자를 숫자decimal_places: 자를 소수점 이하 자리수. 생략하면 0으로 간주select round(345.666,2) 결과1, trunc(345.666,-1) 결과2 from dual;만약 round(345.666,-1)을 하면 소수점 전에서 즉, 5에서 반올림한다는 의미로 350이 나옵니다. trunc와 round는 날짜 값을 특정 날짜 단위로 자를 때도 쓰입니다.trunc(date,[date_format]);round(date, [date_for..
- 2024-07-10 15:16:16
- replace(), translate()chantleman두개 모두 문자열 내에서 특정 문자를 대체하기 위해 사용됩니다. translate(string, from_string, to_string) string: 원본 문자열from_string: 대체할 문자들의 집합to_string: 새로 대체될 문자들의 집합 from_string과 to_string의 길이는 동일해야 합니다.select translate('2009-02-28','0123456789-','ABCDEFGHIJK') result from dual; replace(string, search_string, replace_string)string: 원본 문자열search_string: 대체할 문자열replace_string: 새로 대체될 문자열select buyer_name, replace(buy..
- 2024-07-10 14:37:08
- 오라클 LTRIM(), RTRIM()chantlemanLTRIM/RTRIM(string, trim_string): 좌측/우측 특정문자 제거string: 원래 문자열trim_string: 제거할 문자(생략 가능, 기본값은 공백) select trim(' AAA ') trim1,trim(leading 'a' from 'aaAaBaAaa') trim2,trim(trailing 'a' from 'aaAaBaAaa') trim3,trim(both 'a' from 'aaAaBaAaa') trim4;
- 2024-07-09 17:38:11
728x90
반응형
스킨 업데이트 안내
현재 이용하고 계신 스킨의 버전보다 더 높은 최신 버전이 감지 되었습니다. 최신버전 스킨 파일을 다운로드 받을 수 있는 페이지로 이동하시겠습니까?
("아니오" 를 선택할 시 30일 동안 최신 버전이 감지되어도 모달 창이 표시되지 않습니다.)