How do I get a single out from an Oracle-Procedure?
문제
I've got this procedure:
CREATE OR REPLACE PROCEDURE CONV1(
pDate IN VARCHAR2,
pYear OUT number,
pMonth OUT number,
pDay OUT number
)
AS
lDate DATE;
BEGIN
lDate := to_date(pDate, 'DD.MM.YYYY HH24:MI:SS');
pYear := to_number(to_char(lDate, 'YYYY'));
pMonth := to_number(to_char(lDate, 'MM'));
pDay := to_number(to_char(lDate, 'DD'));
END CONV1;
/
How do I call this procedure if I just want ONE of the outs in there?
(Like Select FMAN_STAT_CONV1('16.07.2010', pDay) from dual;
(which ain't work btw))
Greetz!
해결책
Create function which will use procedure conv1, but will return only one value.
Or even better for your particular case
SELECT to_char(to_date(your_date, 'DD.MM.YYYY HH24:MI:SS'), 'DD') from dual.
Or common case is:
CREATE OR REPLACE FUNCTION CONV2(
pDate IN VARCHAR2
)
RETURN NUMBER
IS
pDay number;
pMonth number;
pYear number;
BEGIN
conv1(pDate, pYear, pMonth, pDay);
return pDay;
END;
제휴하지 않습니다 StackOverflow