Solved

Oracle PL/SQL Syntax issue/question

Posted on 2013-01-17
2
621 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database

733 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