DB๊ฐ€ ๋ญ˜๊นŒ...? ๐Ÿ˜†

๋ฆฌ๋ฌด rimu ยท2023๋…„ 7์›” 11์ผ
0

Co.

๋ชฉ๋ก ๋ณด๊ธฐ
31/43

DB๋ž€?

์‰ฝ๊ฒŒ ๋งํ•˜๋ฉด?
์‹  = SYS ๊ณ„์ •
DB = ์ง€๊ตฌ
ํ…Œ์ด๋ธ” ์ŠคํŽ˜์ด์Šค = ๊ตญ๊ฐ€
์Šคํ‚ค๋งˆ(=USER, ์‚ฌ์šฉ์ž) = ์‚ฌ๋žŒ(Man)
๊ถŒํ•œ = ์ƒ๋ช…๋ ฅ

์‚ฌ์šฉ์ž ๊ณ„์ • ์ƒ์„ฑ ๋„์ค‘ ๊ฐ‘์ž๊ธฐ ์—๋Ÿฌ๋œธ?;;๐Ÿ˜…

์•Œ๊ณ ๋ณด๋‹ˆ ์ด๋ ‡๋‹ค๊ณ  ํ•œ๋‹ค..ใ…Ž;; C## ์„ ๋ถ™์—ฌ์„œ ์‚ฌ์šฉ์ž ๊ณ„์ •์„ ์ƒ์„ฑํ•ด์ฃผ๋ฉด ๋œ๋‹ค~!

๋งŒ๋“ค์–ด์กŒ๋‹ค~

ํ…Œ์ด๋ธ” ์ƒ์„ฑ

  • ํ…Œ์ด๋ธ”์„ ๋งŒ๋“ค๋•Œ ์ปฌ๋Ÿผ์— ๋Œ€ํ•œ ์„ค๋ช…์„ ๋‹ฌ์•„์ฃผ๋ฉด ์ฐธ ์ข‹๋‹ค๊ณ  ํ•จ!

์‹œํ€€์Šค

cycle ์„ค์ •์„ ํ•˜๋ฉด 1๋กœ ๋Œ์•„๊ฐ

์ธ๋ฑ์Šค index

์ฑ…์˜ ๋ชฉ์ฐจ๋ผ๊ณ  ์ƒ๊ฐ
1~500page
1 1~99
2 200~299
3 300~399 ๋ผ๋Š” ๋‚ด์šฉ์ด ์žˆ๋‹ค๋ผ๋ฉด
250์„ ์ฐพ๊ณ ์‹ถ๋‹ค๋ผ๊ณ  ํ•˜๋ฉด 2๋ฒˆ index์—์„œ ํ•œ๋ฒˆ์— ์ฐพ์„ ์ˆ˜ ์žˆ์Œ

์ด๋ ‡๊ฒŒ index๋ฅผ ๋‹ฌ์•„๋†“์œผ๋ฉด ๋นจ๋ฆฌ ์ž๋ฃŒ๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ๋‹ค~
SELECT * FROM TB_ORD WHERE ORD_NO ='1234';

Fuction

-- ๊ณตํ†ต ์ฝ”๋“œ ํ…Œ์ด๋ธ”์—์„œ ์ฝ”๋“œ ๊ฐ’์„ ์ด์šฉํ•ด ๋ช…์นญ์„ ๋ฑ‰์–ด๋‚ด๋Š” ํ•จ์ˆ˜
CREATE OR REPLACE FUNCTION FN_CODE_NM(V_CD VARCHAR2, V_CD2 VARCHAR2)
RETURN VARCHAR2
-- ๋‚ด๋ถ€์—์„œ ์‚ฌ์šฉํ•  ์ง€์—ญ๋ณ€์ˆ˜ ์„ ์–ธ 
IS V_NM VARCHAR2(100);
BEGIN
	SELECT CD_MN1 INTO V_NM
	FROM TB_CD_MST
	WHERE CD_VAL = V_CD
	AND CD_VAL1 = V_CD2;

	RETURN V_NM;
END FN_CODE_NM;

-- SELECT FN_CODE_NM('001','E') FROM DUAL;
-- SELECT * FROM TB_CD_MST;

create new Function์„ ๋ˆ„๋ฅด๊ณ  Declaration์—์„œ ์ฝ”๋“œ ๋ณต๋ถ™ํ•œ ํ›„,
crtl + F9 ํ•˜๋ฉด ์ปดํŒŒ์ผ๋จ!

profile
JAVA / SQL / Spring ์„ ๊ณต๋ถ€ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค ๐Ÿฅ

0๊ฐœ์˜ ๋Œ“๊ธ€