¿À¶óŬ Äõ¸®¿¡¼­ DATE ŸÀÔÀÌ CHAR ŸÀÔº¸´Ù ºü¸¥°¡¿ä?

¹ÎºÀ±â   
   Á¶È¸ 4853   Ãßõ 9    

´ÙÀ½°ú °°Àº µÎ°³ÀÇ Äõ¸®´Â °á°ú´Â ¶È°°À¸¸ç
date ŸÀÔÀ» ½è´À³Ä char ŸÀÔÀ» ½è´À³Ä¸é ´Ù¸¨´Ï´Ù.

(1)
        SELECT u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME
                   ,u.TOTAL_VALUE
                   ,u.TOTAL_NUM
                   ,u.MIN_VALUE
                   ,INST1.fnpempa9001(u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME, u.MIN_VALUE) MIN_TIME
                   ,u.MAX_VALUE
                   ,INST1.fnpempa9002(u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME, u.MAX_VALUE) MAX_TIME
                   ,INST1.fnpempa9003(u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME) LAST_VALUE
                   ,INST1.fnpempa9004(u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME) LAST_TIME
        FROM (SELECT OBJECT_ID, DATE_DAY, DATE_TIME
                                   ,SUM(VALUE) TOTAL_VALUE
                                   ,COUNT(VALUE) TOTAL_NUM
                                   ,MIN(VALUE) MIN_VALUE
                                   ,MAX(VALUE) MAX_VALUE
                        FROM (
                                 SELECT OBJECT_ID,VALUE_HISTORY_ID, VALUE, DATE_DAY, DATE_TIME
                                 FROM (SELECT a.OBJECT_ID, a.VALUE_HISTORY_ID, a.VALUE
                                                                ,TO_CHAR(a.TIMESTAMP,'YYYYMMDD') DATE_DAY
                                                                ,TO_CHAR(a.TIMESTAMP,'HH24') DATE_TIME
                                           FROM INST1.TSPEMPA60 a, INST1.TSPEMPA50 b
                                           WHERE a.OBJECT_ID = b.OBJECT_ID
                                                             --AND b.NODE_NAME = 'atmsdb1' /*Input - ¼­¹ö¸í*/
                                          )
                                 WHERE 1=1
                                            AND DATE_DAY = '20070227' /*Input - ³¯Â¥*/                                
                                )
                        GROUP BY OBJECT_ID, DATE_DAY, DATE_TIME
                ) u

(2)
        SELECT u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME
                   ,u.TOTAL_VALUE
                   ,u.TOTAL_NUM
                   ,u.MIN_VALUE
                   ,INST1.fnpempa9001(u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME, u.MIN_VALUE) MIN_TIME
                   ,u.MAX_VALUE
                   ,INST1.fnpempa9002(u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME, u.MAX_VALUE) MAX_TIME
                   ,INST1.fnpempa9003(u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME) LAST_VALUE
                   ,INST1.fnpempa9004(u.OBJECT_ID, u.DATE_DAY, u.DATE_TIME) LAST_TIME
        FROM (SELECT a.OBJECT_ID, DATE_DAY, DATE_TIME
                                   ,SUM(VALUE) TOTAL_VALUE
                                   ,COUNT(VALUE) TOTAL_NUM
                                   ,MIN(VALUE) MIN_VALUE
                                   ,MAX(VALUE) MAX_VALUE
                        FROM INST1.TSPEMPA60_T a, INST1.TSPEMPA50 b
                        WHERE a.OBJECT_ID = b.OBJECT_ID
                                             AND b.NODE_NAME = 'atmsdb1' /*Input - ¼­¹ö¸í*/
                                         AND DATE_DAY = '20070227' /*Input - ³¯Â¥*/
                        GROUP BY a.OBJECT_ID, DATE_DAY, DATE_TIME
                ) u


µ¥ÀÌÅÍ´Â ¿ø½Ã Å×À̺íÀÇ µ¥ÀÌÅÍ °Ç¼ö°¡ õ¸¸°Ç À̳»À̸ç
¼Óµµ´Â (1)¹ø Äõ¸®°¡ (2)¹ø º¸´Ù 30¹è Á¤µµ ºü¸¨´Ï´Ù.
À¯ÀÏÇÑ Â÷ÀÌ´Â TIMESTAMP¶ó°í µÇ¾î ÀÖ´Â Ä÷³ÀÌ DATE ŸÀÔÀ¸·Î Á¤ÀǵǾî Àִµ¥
ÀÌ ºÎºÐÀÌ DATE_DAY¿Í µ¿ÀÏÇÏ°Ô Å¸ÀÔ¸¸ ´Ù¸¥°ÍÀ̰ŵç¿ä.

¿ø·¡ DATE ŸÀÔÀÌ ºü¸¥°ÇÁö... ÀÌÁ¤µµ·Î ºü¸¥°ÇÁö ¾Ë°í ½Í½À´Ï´Ù.
¾Æ´Ô ¼Óµµ Â÷ÀÌ°¡ ³ª´Âµ¥ ´Ù¸¥ ¿äÀÎÀÌ ÀÖ¾ú´ø °ÇÁö...

À妽º´Â (1)°æ¿ì¿¡ OBJECT_ID ¿¡ °É·Á ÀÖÀ¸¸ç
(2)°æ¿ì¿¡ OBJECT_ID ±×¸®°í NODE_NAME, DATE_DAY¿¡ °É·Á ÀÖ´Â »óÅÂÀÔ´Ï´Ù.
ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.


QnA
Á¦¸ñPage 4511/5680
2014-05   4947298   Á¤ÀºÁØ1
2015-12   1483954   ¹é¸Þ°¡
2011-01   7746   ¹ÚÇö¼ö
2011-03   7746   ÇÒ¹èÀå»ç
2012-11   7746   µÎ¸®¾È
2004-12   7746   ¿ì½Â¿±
2004-01   7746   ±èÁ¤¿í
2010-01   7746   Ǫ¸ªÀÌ
2015-07   7746   º´¸ÀÆù
2008-02   7747   Á¶ÀçÇö
2014-12   7747   À̹®¿µ
2005-02   7747   ¾ÈÁ¤ÈÆ
2015-11   7747   ¾Æ¸£ÄÚ
2010-08   7747   ned3y2k
2004-02   7747   ±èÅÂÈÆ
2016-01   7748   ǪÇÏÈ÷
2004-08   7748   ±èÈ¿¼ö
2011-03   7748   ±èÈ¿¼ö
2010-05   7748   ¹æoÈ¿o¹®
2014-11   7749   ´ëÇѹα¹
2004-07   7749   ¼ÛÈ­½Ä
2012-05   7749   ÀϹÝÀ¯Àú