The brackets are the problem.  Access likes to throw them into the queries
it uses but Oracle does not like them so much.

See if this works:
SELECT H.SSNO, TO_NUMBER(A.GIFTVAL*-1) AS GVal, H.EMPNO,  H.FNAME, H.LNAME
FROM H1EMP H INNER JOIN AWARDS_AWARDS A ON A.EmpNo = H.EmpNo WHERE
((A.ORDERNO)= TO_CHAR(6)  AND ((A.BATCHKEY)=6) ORDER BY H.LNAME, H.FNAME;

Also, there is the funny '&' in your where clause that should not be there
(in the original it was inside the quotes)

Brian Norrell
Manager, MPI Development
QuadraMed
511 E John Carpenter Frwy, Su 500
Irving, TX 75062
(972) 831-6600


-----Original Message-----
Sent: Monday, July 02, 2001 3:40 PM
To: Multiple recipients of list ORACLE-L


I have a sql string generated in a vb function that returns a sql string.
Worked fine in Access but as it uses internal vb functions in a couple of
places it fails in Oracle.  If someone could point the error of my ways I'd
appreciate the language lesson..
(I take no responsibility for the table design!.. existing app!)

Working Access String:
SELECT H.SSNO, CDbl([A.GIFTVAL]*-1) AS GVal, H.EMPNO,  H.FNAME, H.LNAME FROM
H1EMP H INNER JOIN AWARDS_AWARDS A ON A.EmpNo = H.EmpNo WHERE
((A.ORDERNO)='& CStr(6) &' AND ((A.BATCHKEY)=6) ORDER BY H.LNAME, H.FNAME;

Non-Working Oracle String:
SELECT H.SSNO, TO_NUMBER([A.GIFTVAL]*-1) AS GVal, H.EMPNO,  H.FNAME, H.LNAME
FROM H1EMP H INNER JOIN AWARDS_AWARDS A ON A.EmpNo = H.EmpNo WHERE
((A.ORDERNO)= TO_CHAR(6) &  AND ((A.BATCHKEY)=6) ORDER BY H.LNAME, H.FNAME;


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Johnston, Steve
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Norrell, Brian
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to