Solved

Oracle PL/SQL Syntax issue/question

Posted on 2013-01-17
2
631 Views
Last Modified: 2013-01-17
I have about 20 select statements written by another developer where I need to make them into views.

In about 8 of them, I recieve the error:
"ORA-00936: missing expression
00936. 00000 -  "missing expression"
*Cause:    
*Action:
Error at Line: 8 Column: 13"

That's right at the point where the two open parenthesis - EXISTS sits in each statement.

Any ideas on whether this is valid sytax.  I believe this code came from Business Objects and might be some of that syntax??

If so, ideas on how to correct this with Oracle syntax?  

Thanks in advance!!

---here's an example select statement that gets the error above:


SELECT DISTINCT
  RES_GSE_PERSON_TYPE.NAME,
  RES_GSE_SRM_RESOURCES.PERSON_TYPE
FROM
  (
  SELECT DISTINCT r.id RESOURCE_ID
    FROM   srm_resources r
    WHERE ((EXISTS (SELECT user_id
                    FROM   cmn_sec_assgnd_obj_perm_r_v
                    WHERE  object_type = 'RECORD'
                    AND    object_code = 'PRJ_RESOURCE'
                    AND    permission_code = 'ResourceViewManagement'
                    AND    component_code = 'PRJ'
                    AND    user_id = (SELECT u.id
                                      FROM   cmn_sec_users u, srm_resources r, odf_ca_resource odfr
                                      WHERE  u.id = r.user_id
                                      AND    r.id = odfr.id
                                      AND   (UPPER(u.user_name) = UPPER(@variable('BOUSER'))
                                      OR     UPPER(odfr.bo_user) = UPPER(@variable('BOUSER'))))))
           OR
          (EXISTS (SELECT object_instance_id
                   FROM   cmn_sec_assgnd_obj_perm_v
                   WHERE  object_instance_id = r.id
                   AND    object_type = 'RECORD'
                   AND    object_code = 'PRJ_RESOURCE'
                   AND    permission_code = 'ResourceViewManagement'
                   AND    component_code = 'PRJ'
                   AND    user_id = (SELECT u.id
                                     FROM   cmn_sec_users u, srm_resources r, odf_ca_resource odfr
                                     WHERE  u.id = r.user_id
                                     AND    r.id = odfr.id
                                     AND   (UPPER(u.user_name) = UPPER(@variable('BOUSER'))
                                     OR     UPPER(odfr.bo_user) = UPPER(@variable('BOUSER')))))))
  )  RES_GSE_RESOURCE_SECURITY,
  (
  SELECT LOOKUP_CODE, LOOKUP_ENUM, ID, NAME
FROM CMN_LOOKUPS_V
WHERE LOOKUP_TYPE = 'SRM_RESOURCE_TYPE' AND LANGUAGE_CODE = 'en'
  )  RES_GSE_PERSON_TYPE,
  SRM_RESOURCES  RES_GSE_SRM_RESOURCES,
  (
  SELECT RECORD_ID RESOURCE_ID,
       OBST.NAME OBS_TYPE_NAME,
       OBSU.LEVEL1_NAME,
       OBSU.LEVEL2_NAME,
       OBSU.LEVEL3_NAME,
       OBSU.LEVEL4_NAME,
       OBSU.LEVEL5_NAME,
       OBSU.LEVEL6_NAME,
       OBSU.LEVEL7_NAME,
       OBSU.LEVEL8_NAME,
       OBSU.LEVEL9_NAME,
       OBSU.LEVEL10_NAME,
       OBSU.PATH OBS_PATH,
       OBSU.OBS_UNIT_ID
FROM   PRJ_OBS_ASSOCIATIONS OBSA, NBI_DIM_OBS OBSU, PRJ_OBS_TYPES OBST, PRJ_OBS_OBJECT_TYPES TYPES
WHERE  OBSA.TABLE_NAME = 'SRM_RESOURCES'
AND    OBSA.UNIT_ID = OBSU.OBS_UNIT_ID
AND    OBSU.OBS_TYPE_ID = OBST.ID
AND    OBST.ID = TYPES.TYPE_ID
AND    TYPES.TABLE_NAME = 'SRM_RESOURCES'
  )  RES_GSE_OBS_STRUCTURE
WHERE
  ( RES_GSE_PERSON_TYPE.ID(+)=RES_GSE_SRM_RESOURCES.PERSON_TYPE  )
  AND  ( RES_GSE_SRM_RESOURCES.ID=RES_GSE_OBS_STRUCTURE.RESOURCE_ID(+)  )
  AND  ( RES_GSE_RESOURCE_SECURITY.RESOURCE_ID=RES_GSE_SRM_RESOURCES.ID  )
  AND  
  (
   RES_GSE_OBS_STRUCTURE.LEVEL5_NAME  IN  ( 'MIG Admin - CAD'  )
   OR
   RES_GSE_OBS_STRUCTURE.LEVEL4_NAME  IN  ( 'MIG'  )
  )
0
Comment
Question by:Weller0123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 38789944
Are you running that as-is?

"@variable('BOUSER')" is not valid 'oracle' syntax.

Try just using a string literal.

Change:
AND   (UPPER(u.user_name) = UPPER(@variable('BOUSER'))

to:
AND   (UPPER(u.user_name) = 'BOUSER'

Do this for all the rest.
0
 

Author Comment

by:Weller0123
ID: 38790164
Thanks!!!!    I cannot try this now, but that certainly makes sense and is certainly an issue.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
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 explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to recover a database from a user managed backup

688 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