Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> When DO You Use a Semicolon?

When DO You Use a Semicolon?

From: Tim Marshall <tmarshal_at_morgan.ucs.mun.ca>
Date: Wed, 06 Aug 2003 03:22:27 -0230
Message-ID: <3F30979B.89021C3D@morgan.ucs.mun.ca>


I'm passing Oracle statements to an Oracle server via an Access app using Access pass through queries. In constructing the appropriate SQL, I've been tacking a semicolon at the end. For example:

SELECT FB_BLDG_NAME "Building", FD_NAME "Facility", FB_PK FROM TMA.F_FACILITIES, TMA.F_BUILDINGS WHERE FD_PK = FB_FD_FK UNION Select
'<Any Building>', '<Any Facility>', 0 from TMA.F_BUILDINGS ORDER BY 2,1;

However, when constructing something similar to the above, but with a case expression, I kept getting ORA-00911: invalid character. When I dropped the semicolon and passed the statement as below:

SELECT GRP_TAG_NO || ' ' || GRP_DESCRIPTION "Group", CASE WHEN GRP_TYPE = 'R' THEN 'Area' WHEN GRP_TYPE = 'E' THEN 'Equipment' WHEN GRP_TYPE =
'T' THEN 'Tool' WHEN GRP_TYPE = 'A' THEN 'Asset' WHEN GRP_TYPE = 'V'
THEN 'Vehicle' ELSE '<Any>' END "Type", GRP_PK FROM TMA.F_GROUPS UNION SELECT '<Any>', '<Any>', 0 FROM TMA.F_GROUPS ORDER BY 1

Why does this occur, and when should I use the semicolon? Oracle server is version 8.1.7.4.0.

Thanks very much in advance for any help on this.

-- 
Tim - http://www.ucs.mun.ca/~tmarshal/
 ^o<  
 /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^  "Want some?" - Ditto
Received on Wed Aug 06 2003 - 00:52:27 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US