Why do I get Bind Variable "DeliveryDate_Variable" is NOT DECLARED(Completely New TO Oracle)

Posted by GigaPr on Stack Overflow See other posts from Stack Overflow or by GigaPr
Published on 2010-04-25T16:44:21Z Indexed on 2010/04/25 19:43 UTC
Read the original article Hit count: 133

Filed under:
|

Hi,

I have the following script in Oacle I do not understand why i get

Bind Variable "DeliveryDate_Variable" is NOT DECLARED

Everything looks ok to me

VARIABLE RollingStockTypeId_Variable NUMBER := 1;
VARIABLE DeliveryDate_Variable DATE := (to_date('2010/8/25:12:00:00AM', 'yyyy/mm/dd:hh:mi:ssam'));

SELECT DISTINCT
       rs.Id,
       rs.SerialNumber,
       rsc.Name AS Category,
       (SELECT COUNT(Id) from ROLLINGSTOCKS WHERE ROLLINGSTOCKCATEGORYID = rsc.id) as "Number Owened",
       (SELECT COUNT(rs.Id)                 
       FROM ROLLINGSTOCKS rs       
       WHERE rs.ID NOT IN(  select RollingStockId 
                            from ROLLINGSTOCK_ORDER
                            WHERE :DeliveryDate_Variable  BETWEEN DEPARTUREDATE AND DELIVERYDATE)    
       AND rs.RollingStockCategoryId IN (Select Id 
                                        from RollingStockCategories 
                                        Where RollingStockTypeId = :RollingStockTypeId_Variable)
                                        AND rs.RollingStockCategoryId =     rsc.Id) AS "Number Available"
       FROM ROLLINGSTOCKS rs
       JOIN RollingStockCategories rsc ON rsc.Id = rs.RollingStockCategoryId
       WHERE rs.ID NOT IN(
                            select RollingStockId 
                            from ROLLINGSTOCK_ORDER
                            WHERE :DeliveryDate_Variable  BETWEEN DEPARTUREDATE AND DELIVERYDATE
                          )    
       AND rs.RollingStockCategoryId IN 
                          (
                            Select Id 
                            from RollingStockCategories 
                            Where RollingStockTypeId = :RollingStockTypeId_Variable 
                          )
      ORDER BY rsc.Name                       

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about variables