Solved

ORA-00936 Missing Expression, ORA-00972 identifier is too long

Posted on 2006-11-09
8
1,320 Views
Last Modified: 2012-06-22
I am getting the above mentioned 2 errors on my PC (Windows 2000 server).
I have another PC which is Windows 2003 server which has same exact code and works fine.

My connect string looks like :
Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=bprod;Data Source=asbc;Extended Properties=""

********* Following query gives "ORA-00936 Missing Expression"
SELECT PK_ALERTS, ALERT_ID, ALERT_NAME, ALERT_CATEGORY, ALERT_TYPE, IS_ACTIVE,
IS_BLINKING, ALERT_TOOLTIP, ALERT_SOUND_FILE, DESCRIPTION, ALERT_DBLC_ACTION,
ALERT_ANIGIF_FILE, ALERT_CAPTION, ALERT_FG_COLOR, ALERT_BG_COLOR,
ALERT_USE_SOUND, ALERT_USE_SPEECH,
(SELECT COUNT(*) FROM USER_ALERTS WHERE ALERTS.ALERT_ID = USER_ALERTS.ALERT_ID
      AND USER_ALERTS.USER_ID = 'AWILDA' ) AS CNT
FROM ALERTS WHERE IS_ACTIVE <> 0 ORDER BY ALERT_ID

********* Following query gives "ORA-00972 identifier is too long"
SELECT TASKS.* ,
( SELECT VALUE_DESCR FROM FIELDS_VALUES WHERE FIELD_TYPE = 'TaskSubM'
      AND VALUE_CODE = TASKS.TASKSubMenuCode AND Active <> 0 ) AS TaskSubMenu
FROM TASKS WHERE ACTIVE <> 0  

Both the queries when run from TOAD work fine.
The database is on Oracle9.

Regards
VU3LMG
0
Comment
Question by:vu3lmg
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 14

Expert Comment

by:GGuzdziol
ID: 17912437
Maybe there's some problem with subqueries? I don't know what You are using since You provided no information on that.
If this is the issue, You can try rewritting Your first code to:

SELECT ALERTS.PK_ALERTS, ALERTS.ALERT_ID, ALERTS.ALERT_NAME, ALERTS.ALERT_CATEGORY, ALERTS.ALERT_TYPE, ALERTS.IS_ACTIVE,
    ALERTS.IS_BLINKING, ALERTS.ALERT_TOOLTIP, ALERTS.ALERT_SOUND_FILE, ALERTS.DESCRIPTION, ALERTS.ALERT_DBLC_ACTION,
    ALERTS.ALERT_ANIGIF_FILE, ALERTS.ALERT_CAPTION, ALERTS.ALERT_FG_COLOR, ALERTS.ALERT_BG_COLOR,
    ALERTS.ALERT_USE_SOUND, ALERTS.ALERT_USE_SPEECH, COUNT(*) AS CNT
  FROM ALERTS
    LEFT OUTER JOIN USER_ALERTS ON ALERTS.ALERT_ID = USER_ALERTS.ALERT_ID AND USER_ALERTS.USER_ID = 'AWILDA'
  WHERE IS_ACTIVE <> 0
  GROUP BY ALERTS.PK_ALERTS, ALERTS.ALERT_ID, ALERTS.ALERT_NAME, ALERTS.ALERT_CATEGORY, ALERTS.ALERT_TYPE, ALERTS.IS_ACTIVE,
    ALERTS.IS_BLINKING, ALERTS.ALERT_TOOLTIP, ALERTS.ALERT_SOUND_FILE, ALERTS.DESCRIPTION, ALERTS.ALERT_DBLC_ACTION,
    ALERTS.ALERT_ANIGIF_FILE, ALERTS.ALERT_CAPTION, ALERTS.ALERT_FG_COLOR, ALERTS.ALERT_BG_COLOR,
    ALERTS.ALERT_USE_SOUND, ALERTS.ALERT_USE_SPEECH
  ORDER BY ALERT_ID

and second to

SELECT TASKS.* ,
    FIELD_VALUES.VALUE_DESCR AS TaskSubMenu
  FROM TASKS
    LEFT OUTER JOIN FIELDS_VALUES ON FIELDS_VALUES.VALUE_CODE = TASKS.TASKSubMenuCode AND FIELD_VALUES.Active <> 0 AND FIELD_TYPE = 'TaskSubM'
  WHERE ACTIVE <> 0  

(If You are sure that link always exists - both queries - feel free to change left outer join to inner join).
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 17914680
are you getting the errors in sql*plus, if so then paste the errors which will show which line the errors are for the above queries.

Thanks
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 17915274
a) As I mentioned initially, the database is Oracle9.
b) The problem must NOT be with sub queries because I have another Widows 2003 PC which runs same exact code to same exact database and these queries work fine.

Regards
VU3LMG
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 500 total points
ID: 17915497
seems to be db bug or some installation issues like initialization/default settings but not really sure as to what could be the real culprit here.

Though expensive and time consuming, try to install the same version of db in another system and try. If it works, then it has to do something with this problematic system. If there also, it fails then it is for sure some bug in the software you are installing :)

Thanks
0
 
LVL 14

Expert Comment

by:GGuzdziol
ID: 17928764
>> b) The problem must NOT be with sub queries because I have another Widows 2003 PC which runs same exact code to same exact database and these queries work fine.

I meant: those statements are obviously correct, but maybe there's some problem with Your connection provider. As You say it cannot be problem with db itself, so try if any query would work, i.e. issue select * from dual and see if this would fail.
0
 
LVL 1

Author Comment

by:vu3lmg
ID: 17988593
Alright guys, finally found the problem.  Oracle9i update was not installed.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20296212
Forced accept.

Computer101
EE Admin
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question