Ok I used the Add Command Button to paste my SQL in and then I get this error Failed to retrieve data from the databas. Details ORA-00911: invalid character [Database Vendor Code:911]
Here is my code and it works in Toad for Data Analyst. We are pulling from an Oracle Server 10.2.5
SELECT
PWLDBA.ENTORDER.ENTORDERNO,
PWLDBA.TESTREQ.ACCESSION,
PWLDBA.ENCOUNTER.ENCOUNTERNO,
PWLDBA.PATIENT.NAMELAST,
PWLDBA.PATIENT.NAMEFIRST,
PWLDBA.PATIENT.NAMEINITIAL,
PWLDBA.PATIENT.NAMESUFFIX,
'F' AS PATIENT_GENDER,
PWLDBA.PATIENT.SSN,
PWLDBA.PATIENT.DOB,
' ' As AGE,
PWLDBA.RC.DESCRIPTION AS ETHNICITY,
'NA' AS PATIENT_OCCUPATION,
PWLDBA.PATIENT.ADDR1,
PWLDBA.PATIENT.ADDR2,
PWLDBA.PATIENT.CITY,
PWLDBA.PATIENT.STATE,
PWLDBA.PATIENT.COUNTRY,
PWLDBA.PATIENT.PHONE,
PWLDBA.SF.SRCFAC,
PWLDBA.SF.SRCFACNAME,
PWLDBA.PATIENT.PID,
PWLDBA.RD.NAMELAST AS ORDERING_PROVLNAME,
PWLDBA.RD.NAMEFIRST AS ORDERING_PROVFNAME,
PWLDBA.RD.NAMEINITIAL AS ORDERING_PROVINITIAL,
PWLDBA.RD.NAMEDEGREE AS TITLE,
PWLDBA.RD.NAMESUFFIX,
PWLDBA.RD.PMRY_SFKEY,
PWLDBA.RD.ADDR1,
PWLDBA.RD.ADDR2,
PWLDBA.RD.CITY,
PWLDBA.RD.STATE,
PWLDBA.RD.ZIP,
PWLDBA.RD.CONTACTPHONE,
PWLDBA.RD.UPIN,
PWLDBA.RD.NPI,
PWLDBA.PATIENT.ITKEY_0,
PWLDBA.PATIENT.GROUP_0,
PWLDBA.TESTREQ.COLLECTED AS PRIMARY_COL_DT,
PWLDBA.TESTREQ.RECEIVED AS PRIMARY_REC_DT,
PWLDBA.PTRESULT.FINALSTAMP AS FINAL_COMP_DT,
'NA' AS CASECURRENTSTEPDESC,
'DIGENE' AS CASE_TYPE,
PWLDBA.TEST.SHORTNAME,
PWLDBA.TEST.TESTCODE,
'NA' AS LOCALSTANDARDCODE,
PWLDBA.PWSP.DESCRIPTION AS PRIMSPECDESC,
PWLDBA.TESTREQ.SOURCE,
'NA' AS SNOMED_CODES,
PWLDBA.TESTREQ.ICD9KEY_0,
'NA' AS CPTCODE,
'NA' AS LOINCCODES,
'NA' AS UMLCODES,
PWLDBA.TEST.TESTCODE,
PWLDBA.ANALYT.DESCRIPTION AS RESULTNAME,
PWLDBA.PTRESULT.VALUE AS RESULT_VALUE,
PWLDBA.PTRESULT.VALUE AS HPV_DETECTED,
PWLDBA.TESTCOMMENT.D_COMMENT,
PWLDBA.PTRESULT.ABNRANGE,
'NA' AS CLINICALHIST,
'NA' AS SPECIMENSOURCE,
PWLDBA.TEST.NAME,
'DIGENE' AS HPVTEST_MFG,
'NA' AS ADDENDUM,
'SED MEDICAL LAB' AS LABCODE
FROM
PWLDBA.TESTREQ
INNER JOIN PWLDBA.PTRESULT
ON PWLDBA.PTRESULT.TESTREQKEY=PWLDBA.TESTREQ.TESTREQKEY
INNER JOIN PWLDBA.ANALYT
ON PWLDBA.ANALYT.ANALYTKEY=PWLDBA.PTRESULT.ANALYTKEY
INNER JOIN PWLDBA.TEST
ON PWLDBA.TEST.TESTKEY=PWLDBA.TESTREQ.TESTKEY
INNER JOIN PWLDBA.PWSP
ON PWLDBA.PWSP.PWSPKEY=PWLDBA.TESTREQ.PWSPKEY
INNER JOIN PWLDBA.RD
ON PWLDBA.TESTREQ.RDKEY_0=PWLDBA.RD.RDKEY
INNER JOIN PWLDBA.TESTCOMMENT
ON PWLDBA.TESTCOMMENT.TESTREQKEY=PWLDBA.TESTREQ.TESTREQKEY
INNER JOIN PWLDBA.ENTORDER
ON PWLDBA.ENTORDER.ENTORDERKEY=PWLDBA.TESTREQ.ENTORDERKEY
INNER JOIN PWLDBA.ENCOUNTER
ON PWLDBA.ENCOUNTER.ENCOUNTERKEY=PWLDBA.ENTORDER.ENCOUNTERKEY
INNER JOIN PWLDBA.PT
ON PWLDBA.PT.PTKEY=PWLDBA.ENCOUNTER.PTKEY
INNER JOIN PWLDBA.SF
ON PWLDBA.SF.SFKEY=ENCOUNTER.SFKEY
INNER JOIN PWLDBA.PATIENT
ON PWLDBA.PATIENT.PATIENTKEY=PWLDBA.ENCOUNTER.PATIENTKEY
INNER JOIN PWLDBA.RC
ON PWLDBA.RC.RCKEY=PWLDBA.PATIENT.RCKEY
WHERE PWLDBA.TEST.SHORTNAME LIKE '%HPV' AND PWLDBA.TESTREQ.STATUS ='D'
ORDER BY
PWLDBA.ENTORDER.ENTORDERNO,
PWLDBA.ENCOUNTER.ENCOUNTERNO ASC;