Here arised some question.
How can I get the max updated date and time of that image which is shown as first
(using ESS_ENTDATE and ESS_ENTTIME)?
This's first procedure and
results.
PROCEDURE PR_GETORDERSTATUES(CUR_OUTPUT OUT H_CURSOR)
IS
BEGIN
OPEN CUR_OUTPUT FOR SELECT C.CUSTOMERID,C.CUSTOMERNAME,C,CITY,
B.ORDERDETAILID, O.ORDERID,B.QUANTITY,
O.ORDERDATE,O.ORDERTIME,S.STATUS
FROM M_CORRSQL.O_CUSTOMER C,M_CORRSQL.ORDERS O,M_CORRSQL.ORDERDETAILS B,M_CORRSQL.O_STATUS S
WHERE O.ORDERID = B.OORDERID
AND C.CUSTOMERID = O.OCUSTOMERID
AND O.ORDERID
= S.ORDERID;
END PR_GETORDERSTATUES;
Then found good solution and try it. The Following
procedure and max or latest date and time.
PROCEDURE PR_GETORDERSTATUES(CUR_OUTPUT OUT H_CURSOR)
IS
BEGIN
OPEN CUR_OUTPUT FOR SELECT S.* FROM(SELECT C.CUSTOMERID,C.CUSTOMERNAME,C.CITY,
B.ORDERDETAILID, O.ORDERID,B.QUANTITY,
O.ORDERDATE,O.ORDERTIME,S.STATUS
FROM M_CORRSQL.O_CUSTOMER C,M_CORRSQL.ORDERS O,M_CORRSQL.ORDERDETAILS B,M_CORRSQL.O_STATUS S
WHERE O.ORDERID = B.OORDERID
AND C.CUSTOMERID = O.OCUSTOMERID
AND O.ORDERID = S.ORDERID
ORDER BY TO_DATE(O.ORDERDATE||' '||O.ORDERTIME,'DD/MM/YYYY HH:MI
AM') DESC)S
WHERE ROWNUM =
1;
END PR_GETORDERSTATUES;
Also, found another solution for get max or latest date and time.
PROCEDURE PR_GETORDERSTATUES(CUR_OUTPUT OUT H_CURSOR)
IS
BEGIN
OPEN CUR_OUTPUT FOR SELECT C.CUSTOMERID,C.CUSTOMERNAME,C.CITY,
B.ORDERDETAILID, O.ORDERID,B.QUANTITY,
O.ORDERDATE,O.ORDERTIME,S.STATUS
FROM M_CORRSQL.O_CUSTOMER C,M_CORRSQL.ORDERS O,M_CORRSQL.ORDERDETAILS B,M_CORRSQL.O_STATUS S
WHERE O.ORDERID = B.OORDERID
AND C.CUSTOMERID = O.OCUSTOMERID
AND O.ORDERID = S.ORDERID
AND O.ORDERDATE = (SELECT MAX(O.ORDERDATE) FROM M_CORRSQL.ORDERS O)
AND O.ORDERTIME = (SELECT MAX(O.ORDERTIME) FROM M_CORRSQL.ORDERS O);
END PR_GETORDERSTATUES;
0 coment�rios: