Home » SQL & PL/SQL » SQL & PL/SQL » ORA-00936: Expression missing (Oracle 9.2 and SQL+)
ORA-00936: Expression missing [message #580516] Mon, 25 March 2013 11:11 Go to next message
frieder1313
Messages: 4
Registered: March 2013
Location: Frankfurt
Junior Member
Hi all,

I ran into a problem recently which has to do with the following query:

SELECT '' || ROUND(GEOGR_LAENGE,5) || ',' || ROUND(GEOGR_BREITE,5) || '," [BUE] ' || BAUFORM_GRUPPE || '"', KM 
	AS TEXT 
	FROM MYTABLEA mmtable
	WHERE (mmtable.GEOGR_LAENGE IS NOT NULL 
		AND mmtable.GEOGR_BREITE IS NOT NULL 
		AND mmtable.STRECKE_NR IN 
			(
			SELECT STRECKE_NR FROM MYTABLEB rbtable
			WHERE 	(mmtable.NL_NAME='Mitte' 
				AND mmtable.KM<=rbtable.BIS_KM
				AND mmtable.KM=>rbtable.VON_KM
				)
			)
		);


The problem is, that Oracle alerts a missing expression at line 4, and highlights the "IS NOT NULL". Personally I don't see that anything is wrong with this line. I think the problems source is somewhere else but I cannot find it.

I'll give you a little bit of background to the script:

What I am trying to achieve is to request the values in the first line with the following conditions:

- mmtable.GEOGR_LAENGE, GEOGR_BREITE must not be empty
- rbtable.STRECKE_NR for the requested line (which is similar to mmtable.STRECKE_NR) must have "MITTE" as a value for NL_NAME
- mmtable.KM => rbtable.VON_KM
- mmtable.KM <= rbtable.BIS_KM

so that only those lines will be returned.

Any ideas? Thank you very much in advance!!
Re: ORA-00936: Expression missing [message #580517 is a reply to message #580516] Mon, 25 March 2013 11:36 Go to previous messageGo to next message
flyboy
Messages: 1750
Registered: November 2006
Senior Member
Hi,
frieder1313 wrote on Mon, 25 March 2013 17:11
- mmtable.KM => rbtable.VON_KM

This is not correct comparison condition in any programming language I know, neither in mathematics.
If it is supposed to be "equal or greater then", change positions of equal and greater than signs (>=).
[Edit: typo]

[Updated on: Mon, 25 March 2013 11:37]

Report message to a moderator

Re: ORA-00936: Expression missing [message #580518 is a reply to message #580517] Mon, 25 March 2013 11:40 Go to previous messageGo to next message
BlackSwan
Messages: 21955
Registered: January 2009
Senior Member
for a quick & dirty test
>AS TEXT
not as above; but as below
TEXT
(remove the "AS")
Re: ORA-00936: Expression missing [message #580535 is a reply to message #580516] Mon, 25 March 2013 13:00 Go to previous messageGo to next message
frieder1313
Messages: 4
Registered: March 2013
Location: Frankfurt
Junior Member
Thanks for the quick answers. I will try it when I'm at work again tomorrow.

Cheers
Re: ORA-00936: Expression missing [message #580545 is a reply to message #580518] Mon, 25 March 2013 14:32 Go to previous messageGo to next message
cookiemonster
Messages: 10573
Registered: September 2008
Location: Rainy Manchester
Senior Member
BlackSwan wrote on Mon, 25 March 2013 16:40
for a quick & dirty test
>AS TEXT
not as above; but as below
TEXT
(remove the "AS")

As in the select part is legal.
Re: ORA-00936: Expression missing [message #580565 is a reply to message #580545] Mon, 25 March 2013 18:17 Go to previous messageGo to next message
BlackSwan
Messages: 21955
Registered: January 2009
Senior Member
>As in the select part is legal.

I am aware that it is "legal", but older version did not always properly handle it under some conditions.
Re: ORA-00936: Expression missing [message #580655 is a reply to message #580565] Tue, 26 March 2013 10:52 Go to previous messageGo to next message
frieder1313
Messages: 4
Registered: March 2013
Location: Frankfurt
Junior Member
Hey, so I juggled around a little bit and noticed that I needed to change a few things (not necessarily related to the problem described above). As for the comparison part, I simply used BETWEEN. Here is my resulting code including all other changes I made, just to let you know..

SELECT '' || ROUND(GEOGR_LAENGE,5) || ',' || ROUND(GEOGR_BREITE,5) || '," [BUE] ' || BAUFORM_GRUPPE || '"'
	AS TEXT 
	FROM TableA mmtable
	WHERE (		mmtable.GEOGR_LAENGE IS NOT NULL 
		AND 	mmtable.GEOGR_BREITE IS NOT NULL 
		AND 	EXISTS 
				(
				SELECT * FROM TableB rbtable
				WHERE 	(	mmtable.STRECKE_NR=rbtable.STRECKE_NR
					AND	rbtable.NL='01025437' 
					AND 	mmtable.KM_I BETWEEN rbtable.VON_KM_I AND rbtable.BIS_KM_I
					) 
				)
		);


Thanks for the help. Feel free to close the thread.

Cheers
Re: ORA-00936: Expression missing [message #580661 is a reply to message #580655] Tue, 26 March 2013 12:17 Go to previous messageGo to next message
joy_division
Messages: 4454
Registered: February 2005
Location: East Coast USA
Senior Member
Just a little nitpick thing for me. you table alias is longer than the actual table name. Why are you using one?
Re: ORA-00936: Expression missing [message #580676 is a reply to message #580516] Tue, 26 March 2013 14:47 Go to previous message
frieder1313
Messages: 4
Registered: March 2013
Location: Frankfurt
Junior Member
I just replaced the actual table name in the post because the opriginal names of TableA and TableB are long and almost similar

TableA: Original name: pftr310_mmTunOSPR
TableB: Original name: pftr311_mmTunOSPS

Previous Topic: Export to Excel Files
Next Topic: product and category query, please help
Goto Forum:
  


Current Time: Mon Apr 21 04:36:24 CDT 2014

Total time taken to generate the page: 0.11626 seconds