Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 24 May 2004 @ 14:03:44 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   ERROR Writing a Stored Procedure??
 
From:   Manish Kumar Maurya

HI ALL,

I am trying to push data from one table to other using a stored procedure the Scenario:

i have Table A and B with same table structure but Table A has data comming in it at a interval of 15 min and i am req to push data from table A to Table B at a aggregation of Daily level.

I am able to do this by simple SQL using group by clause on the Datetime field but when i try to do the same using a stored procedure it give me ERROR saying invalid SQL,


Can any body help !!

Manish


My Actual stored proc::

     create procedure SP_CCART_AGENT_STATES_DAILY(IN vDate Date)
     BEGIN

     insert into T_CCART_AGENT_STATES_Daily
     Select cast(ReportTime as date) as reportdate,  AVG(Compliance_percent) AS Compliance_percent,
                           AVG(Available_percent) AS Available_percent,
     AVG(Occupancy_percent) AS Occupancy_percent, AVG(DNOutboundCalls) AS DNOutboundCalls,
                           AVG(TotalDNInboundTime) AS TotalDNInboundTime,
     AVG(AverageLoginHours) AS AverageLoginHours, AVG(AverageDNInboundTime)
                           AS AverageDNInboundTime, AVG(TotalDNOutboundTime)
     AS TotalDNOutboundTime, AVG(DNInboundTime_percent) AS DNInboundTime_percent,
                           AVG(TotalTalkTime) AS TotalTalkTime,
     AVG(DNInboundCalls) AS DNInboundCalls, AVG(TalkTime_percent) AS TalkTime_percent, AVG(TotalWaitTime)
                           AS TotalWaitTime, AVG(AverageDNOutTime) AS
     AverageDNOutTime, AVG(DNOutTime_percent) AS DNOutTime_percent, AVG(AverageWaitTime)
                           AS AverageWaitTime, AVG(WaitTime_percent) AS
     WaitTime_percent, AVG(TotalNotReadyTime) AS TotalNotReadyTime, AVG(AverageNotReadyTime)
                           AS AverageNotReadyTime, AVG(NotReadyTime_percent)
     AS NotReadyTime_percent, AVG(TotalHoldTime) AS TotalHoldTime, AVG(AverageHoldTime)
                           AS AverageHoldTime, AVG(TotalConsultTime) AS
     TotalConsultTime, AVG(HoldTime_percent) AS HoldTime_percent, AVG(AverageConsultTime)
                           AS AverageConsultTime, AVG(ConsultTime_percent) AS
     ConsultTime_percent, AVG(TotalAgentsWorked) AS TotalAgentsWorked,
                           AVG(AverageHandleTime) AS AverageHandleTime,
     AVG(TotalHandleTime) AS TotalHandleTime, AVG(AverageTalkTime) AS AverageTalkTime,
                           AVG(TotalAgentWorkingHours) AS
     TotalAgentWorkingHours, QueueID AS QueueID, LOBID AS LOBID, RegionID AS RegionID, SiteID AS SiteID,
                           ServiceID AS ServiceID

              from T_CCART_AGENT_STATES
             where cast(ReportTime as date)=:Vdate

             Group by
             cast(ReportTime as date),lobid,regionid,serviceid,siteid,queueid

     END


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023