我在toad中运行查询以测试结果,但我收到错误
ORA-00933: sql command not properly ended
这是我的查询
SELECT DISTINCT sv.mkey,vehicle_no,'ABC' isnullcheck,TO_CHAR (date_in,'dd-MM-yyyy') || ' & ' || time_in vehicleindate_time,TO_CHAR (date_out,'dd-MM-yyyy') || ' & ' || time_out vehicleoutdate_time,gate_no_in || ' & ' || gate_no_out ingate_outgateno,gd.good_type goods_type,net_weight netweight,TO_CHAR (challan_date,'dd-MM-yyyy') || ' & ' || challan_no challandate_no,remark_in remarkin,NULL receipt_no,date_in FROM xxcus.xxgid_supinv sv,xxcus.xx_supinv_goodtype gd,xxcus.xxacl_xxgid_user_mst ms WHERE gd.good_type_code(+) = sv.good_type AND sv.project_id = 1368 AND (sv.audit_flag IS NULL OR sv.audit_flag = 'N') UNION SELECT DISTINCT sv.mkey,'XYZ' portfolio,xxcus.xxacl_xxgid_user_mst ms WHERE gd.good_type_code(+) = sv.good_type AND sv.project_id = 1368 AND sv.audit_flag IS NULL ORDER BY isnullcheck,date_in DESC,vehicle_no UNION SELECT NULL,'ABC',NULL,NULL FROM DUAL UNION SELECT NULL,'XYZ',NULL FROM DUAL
请在这里提出错误的建议
解决方法
你的两个较大的SELECTS(前2个)将返回12个项目.最后两个SELECTS(小的)返回13项. UNION必须具有匹配的列.
例如陈述应该结束……
SELECT NULL,NULL FROM DUAL UNION SELECT NULL,NULL FROM DUAL