Solved

Oracle PL/SQL Syntax issue/question

Posted on 2013-01-17
2
619 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
2 Comments
 
LVL 76

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

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

Suggested Solutions

Title # Comments Views Activity
oracle 11g 23 106
Oracle SQL - Query help 7 66
DB migration from Mssql to 12c oracle , data not loading. 3 39
setting local variables in a cursor block 3 18
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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 explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

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