The friendly ORA-00911 problem using VBA and apostrophe's
692101Mar 22 2009 — edited Mar 22 2009Hello one and all,
I have been debugging this for quite a while and i still cant find any solution anywhere on google etc after hours and hours of searching. The below statement will execute perfectly fine in TOAD but not in VBA. When i send this command VIA a query table i get the ol ORA-00911. I have also tried using an ADODB connection but still getting the same error. If i remove the CASE WHEN statement (and thus all the apostrophe's) then im away laughing, however i cant exactly group the data.
Why don't i use another table instead of using a CASE WHEN statement? Because the database admin will not allow me and to create a temporary table i would run into the same issue with having to use apostrophes.
INSERT INTO DATAMART.PERSONSITE (PERSON_DBID,SITE) SELECT PDBIDSKILL.DBID, MIN(PDBIDSKILL.SKILL) FROM
(SELECT DISTINCT DATAMART.V_CFG_PERSON.DBID, CASE WHEN DATAMART.V_CFG_SKILL.NAME='Complex_Rslve' OR DATAMART.V_CFG_SKILL.NAME='Broadband_Business_Resolve' THEN 'BBHD' WHEN DATAMART.V_CFG_SKILL.NAME='General' OR DATAMART.V_CFG_SKILL.NAME='General_Mobile' OR DATAMART.V_CFG_SKILL.NAME='General_Billing' THEN 'MASS' WHEN DATAMART.V_CFG_SKILL.NAME='Faults_General' OR DATAMART.V_CFG_SKILL.NAME='Faults_Business' THEN 'Faults' ELSE '_Other' END AS SKILL
FROM DATAMART.V_CFG_SKILL INNER JOIN DATAMART.V_CFG_SKILL_LEVEL ON DATAMART.V_CFG_SKILL.DBID = DATAMART.V_CFG_SKILL_LEVEL.SKILL_DBID
INNER JOIN DATAMART.V_CFG_PERSON ON DATAMART.V_CFG_PERSON.DBID = DATAMART.V_CFG_SKILL_LEVEL.PERSON_DBID) PDBIDSKILL GROUP BY PDBIDSKILL.DBID;
Any help would be greatly appreciated,
Thank you in advance.
Edited by: user10923905 on 21-Mar-2009 23:26