Thanks for getting back to me!
Here is some code I did to nake sure the date is not '000000'
BEGIN
--find the max billdate
l_maxbilldate := '000000'
IF P_OPTION = 1
for i in (select billdate, location, kwh
from mbrhistdetl where mbrsep = P_mbrsep)
Loop
-- convert each non 0 billdate to have century so can determine
max date
if i.billdate <> '000000' then
l_billdate := to_date(i.billdate, 'RRMMDD')
if l_billdate => P_FROMDATE
and l_billdate <= P_THRUDATE
and l_billtype <> 9
and l_readtype <> 5
if l_billdate > l_maxbilldate
l_maxbilldate := l_billdate
end if;
end if;
end if;
End Loop;
Have not tested it completely yet
On Jul 23, 1:45 pm, Michael Moore <[email protected]> wrote:
> I don't know how the COBOL calls to PL/SQL packages work, so I assume that
> what you gave in your example is correct, that is, I assume that it is
> possible to call a pl/sql procedure from COBOL.
>
> What I will show below is not a solution to your specific problem, but it
> should illustrate some principles that you can apply.
>
> For example, you said "I need to format billdate from 090701 to CCYYMMDD so
> I can see if they are between from-thru.". This is not true. Instead, use
> the DATE datatype.
>
> Here's my example, hope it helps.
> PROCEDURE getmbrhist(
> p_mbrsep IN mbrhistdetl.mbrsep%TYPE,
> p_option IN VARCHAR2,
> p_fromdate IN NUMBER,
> p_thrudate IN NUMBER,
> p_location OUT VARCHAR2,
> p_kwh OUT VARCHAR2,
> p_slkwh OUT VARCHAR2,
> p_status OUT NUMBER )
> AS
> v_from_date DATE;
> v_thru_date DATE;
> BEGIN
> v_from_date := TO_DATE( p_fromdate, 'yymmdd' );
> v_thru_date := TO_DATE( p_fromdate, 'yymmdd' );
>
> IF p_option = 1
> THEN
> IF v_from_date < v_thru_date
> THEN
> p_location := 'here';
> ELSE
> p_location := 'there';
> END IF;
> ELSE
> IF v_from_date BETWEEN v_thru_date AND SYSDATE
> THEN
> p_location := 'Denver';
> ELSE
> p_location := 'Mars';
> END IF;
> END IF;
> END;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---