ORA-00904:“%s:无效标识符”

时间:2015-12-17 08:13:54

标签: oracle10g

请告诉我我做错了什么。我输入了所有正确的列名仍然在oracle10g中出现此错误。我也试过改变位置,但没有帮助。任何帮助都会非常感激。这是我提出的查询,以及它给我的错误。

   select "RegistrationNumber",
"Vehicle"."pkVehicleId",
"ModelAndShapeYearSettings"."fkVehicleModelId",
makeTable."Text" "Make",
modelTable."Text"||' '||versionTable."Text" "Model",
"PurchaseOrder"."IsHypothecated" "Hypothecated",
--own."Text" "Ownership",
 "PurchaseOrder"."IsOwned" "Ownership",
bank."Text" "OwnerName", 
status."Text" "VehicleStatus",
"CustomerRequisition"."Renter",
reg."Text" "Region",
"Branch"."BranchName" "Branch", 
segment."Text" "Segment",
"Debtor"."DebtorName" "Debtor", 
case when ("Vehicle"."IsBuyBack" = 'N') then ( "ModelAndShapeYearSettings"."ResidualValue"  )
else 
( "Depreciation"."Residual" )end  as "ResidualValue",
case when ("Vehicle"."IsBuyBack" = 'N') then (  "ModelAndShapeYearSettings"."UsefulLife"   )
else 
( "Depreciation"."Period"  )end  as "UsefulLife",
"CustomerRequisition"."IsBuyBack" "BuyBack", 
("CustomerRequisition"."UnitPrice" +"CustomerRequisition"."Premium") "Cost", 
to_number(("CustomerRequisition"."UnitPrice" +"CustomerRequisition"."Premium") * (1- ("Depreciation"."Residual"))) "DepreciableAmount",
"Depreciation"."DepPerMonthCost" "DepreciationPerMonth", 
to_number("Depreciation"."DepPerMonthCost" * "Depreciation"."Period") "AccDep",

case  when ("Vehicle"."fkVehicleStatusId" = 498 or "Vehicle"."fkVehicleStatusId" = 449 or "Vehicle"."fkVehicleStatusId" = 448) and  Round(MONTHS_BETWEEN 
   ("Disposal"."DisposalDate" ,"Vehicle"."VehicleEntryDate") 
    ,0) -1 < "Depreciation"."Period" and sysdate > "Disposal"."DisposalDate" then ("CustomerRequisition"."Amount") - "Depreciation"."DepPerMonthCost" * (Round(MONTHS_BETWEEN 
   ("Disposal"."DisposalDate" , "Vehicle"."VehicleEntryDate")  
    ,0) )
    when ("Vehicle"."fkVehicleStatusId" = 498 or "Vehicle"."fkVehicleStatusId" = 449 or "Vehicle"."fkVehicleStatusId" = 448) and  Round(MONTHS_BETWEEN 
   ("Disposal"."DisposalDate","Vehicle"."VehicleEntryDate") 
    ,0) -1 > "Depreciation"."Period" and Round(MONTHS_BETWEEN (sysdate,"Vehicle"."VehicleEntryDate") ,0) -1 > "Depreciation"."Period" 
    then ("CustomerRequisition"."Amount") -"Depreciation"."DepPerMonthCost"*"Depreciation"."Period" 
    when ("Vehicle"."fkVehicleStatusId" = 498 or "Vehicle"."fkVehicleStatusId" = 449 or "Vehicle"."fkVehicleStatusId" = 448) and  Round(MONTHS_BETWEEN 
   ("Disposal"."DisposalDate" ,"Vehicle"."VehicleEntryDate") 
    ,0) -1 < "Depreciation"."Period" and sysdate < "Disposal"."DisposalDate" then ("CustomerRequisition"."Amount") - "Depreciation"."DepPerMonthCost" * (Round(MONTHS_BETWEEN 
   (sysdate , "Vehicle"."VehicleEntryDate")  
    ,0) )
    when ("Vehicle"."fkVehicleStatusId" = 498 or "Vehicle"."fkVehicleStatusId" = 449 or "Vehicle"."fkVehicleStatusId" = 448) and  Round(MONTHS_BETWEEN 
   ("Disposal"."DisposalDate","Vehicle"."VehicleEntryDate") 
    ,0) -1 > "Depreciation"."Period" and Round(MONTHS_BETWEEN (sysdate,"Vehicle"."VehicleEntryDate") ,0) -1 < "Depreciation"."Period" then ("CustomerRequisition"."Amount") -"Depreciation"."DepPerMonthCost"* (Round(MONTHS_BETWEEN 
   (sysdate , "Vehicle"."VehicleEntryDate")  
    ,0) ) 
    when ("Vehicle"."fkVehicleStatusId" != 498 and "Vehicle"."fkVehicleStatusId" != 449 and "Vehicle"."fkVehicleStatusId" != 448) and  Round(MONTHS_BETWEEN 
   (sysdate ,"Vehicle"."VehicleEntryDate") 
    ,0) -1 < "Depreciation"."Period" then ("CustomerRequisition"."Amount") - "Depreciation"."DepPerMonthCost" * (Round(MONTHS_BETWEEN 
   (sysdate , "Vehicle"."VehicleEntryDate")  
    ,0) ) 

    when ("Vehicle"."fkVehicleStatusId" != 498 and "Vehicle"."fkVehicleStatusId" != 449 and "Vehicle"."fkVehicleStatusId" != 448) and  Round(MONTHS_BETWEEN 
   (sysdate,"Vehicle"."VehicleEntryDate") 
    ,0) -1 > "Depreciation"."Period" then ("CustomerRequisition"."Amount") - "Depreciation"."DepPerMonthCost"*"Depreciation"."Period" 

    end as "WDV",
--to_number("CustomerRequisition"."Amount" - ("Depreciation"."DepPerMonthCost" * "Depreciation"."Period")) "WDV" ,
"Vehicle"."VehicleEntryDate"
from "Vehicle" 
inner join "EnumerationValue" modelTable on modelTable."pkEnumerationValueId"="ModelAndShapeYearSettings"."fkVehicleModelId"
inner join "ModelAndShapeYearSettings" on "ModelAndShapeYearSettings"."fkVehicleModelId" = "Vehicle"."fkModelId"
inner join "EnumerationValue" makeTable on makeTable."pkEnumerationValueId"=modelTable."fkParentEnumerationValueId"
inner join "EnumerationValue" versionTable on versionTable."pkEnumerationValueId"="Vehicle"."fkVersionId"
--left join "Ownership" on "Ownership"."fkVehicleId"="Vehicle"."pkVehicleId" 

left join "EnumerationValue" status on status."pkEnumerationValueId"="Vehicle"."fkVehicleStatusId" 
inner join "CustomerRequisition" on "CustomerRequisition"."pkCustomerRequisitionId"="Vehicle"."fkCustomerRequisitionId" 
inner join "PurchaseOrder" on  "CustomerRequisition"."fkPurchaseOrderId" = "PurchaseOrder"."pkPurchaseOrderId"
left join "EnumerationValue" bank on bank."pkEnumerationValueId"="PurchaseOrder"."fkBankId" 
inner join "Branch" on "Branch"."pkBranchId"="Vehicle"."fkBranchId" 
inner join "EnumerationValue" segment on segment."pkEnumerationValueId"="Vehicle"."fkSegmentId"  
left join "Debtor" on "Debtor"."pkDebtorId"="CustomerRequisition"."fkDebtorId" 
inner join "Depreciation" on "Depreciation"."fkVehicleId"="Vehicle"."pkVehicleId" 
left join "Disposal" on "Disposal"."fkVehicleId"="Vehicle"."pkVehicleId"
inner join "Address" on "Address"."pkAddressId"="Branch"."fkAddressId"
inner join "EnumerationValue" city on city."pkEnumerationValueId"="Address"."fkCityId"
inner join "EnumerationValue" reg on reg."pkEnumerationValueId"=city."fkParentEnumerationValueId"
where "CustomerRequisition"."IsDeleted"= 'N' and "Vehicle"."IsDeleted"='N'

union
select "RegistrationNumber",
"Vehicle"."pkVehicleId",
makeTable."Text" "Make",
modelTable."Text"||' '||versionTable."Text" "Model",
'N' "Hypothecated",
"ModelAndShapeYearSettings"."fkVehicleModelId",
 'Investor Vehicle' "Ownership",
"Vendor"."Name" "OwnerName", 
status."Text" "VehicleStatus",
'N/A' "Renter",
reg."Text" "Region",
"Branch"."BranchName" "Branch", 
segment."Text" "Segment",
'Investor Vehicle' "Debtor", 
case when ("Vehicle"."IsBuyBack" = 'N') then ( "ModelAndShapeYearSettings"."ResidualValue"  )
else 
( "Depreciation"."Residual" )end  as "ResidualValue",
case when ("Vehicle"."IsBuyBack" = 'N') then (  "ModelAndShapeYearSettings"."UsefulLife"   )
else 
( "Depreciation"."Period"  )end  as "UsefulLife",
'N/A' "BuyBack", 
"InvestorAgreement"."Cost" "Cost", 
0 "DepreciableAmount",
0 "DepreciationPerMonth", 
0 "AccDep",
0 "WDV" ,
"Vehicle"."VehicleEntryDate"
from "Vehicle" 
inner join "EnumerationValue" modelTable on modelTable."pkEnumerationValueId"="ModelAndShapeYearSettings"."fkVehicleModelId"
inner join "ModelAndShapeYearSettings" on "ModelAndShapeYearSettings"."fkVehicleModelId" = "Vehicle"."fkModelId"
inner join "EnumerationValue" makeTable on makeTable."pkEnumerationValueId"=modelTable."fkParentEnumerationValueId"
inner join "EnumerationValue" versionTable on versionTable."pkEnumerationValueId"="Vehicle"."fkVersionId"

left join "EnumerationValue" status on status."pkEnumerationValueId"="Vehicle"."fkVehicleStatusId" 
inner join "InvestorAgreement" on "InvestorAgreement"."pkInvestorAgreementId"="Vehicle"."fkInvestorAgreementId" 
inner join "Vendor" on "Vendor"."pkVendorId"= "InvestorAgreement"."fkVendorId"
inner join "Branch" on "Branch"."pkBranchId"="Vehicle"."fkBranchId" 
inner join "EnumerationValue" segment on segment."pkEnumerationValueId"="Vehicle"."fkSegmentId"  
left join "Depreciation" on "Depreciation"."fkVehicleId"="Vehicle"."pkVehicleId" 
left join "Disposal" on "Disposal"."fkVehicleId"="Vehicle"."pkVehicleId"
inner join "Address" on "Address"."pkAddressId"="Branch"."fkAddressId"
inner join "EnumerationValue" city on city."pkEnumerationValueId"="Address"."fkCityId"
inner join "EnumerationValue" reg on reg."pkEnumerationValueId"=city."fkParentEnumerationValueId"
where "InvestorAgreement"."IsDeleted"= 'N' and "Vehicle"."IsDeleted"='N';

ORA-00904:“ModelAndShapeYearSettings”。“fkVehicleModelId”:无效的标识符 00904. 00000 - “%s:无效标识符” *原因:
*行动: 行错误:61列:76

0 个答案:

没有答案