Solved

PL/SQL case statement

Posted on 2008-10-17
2
1,829 Views
Last Modified: 2013-12-18
I am trying to hard code some values where the person_uid is null but I am geting the error message, "expecting from .." when I try to run it.  How  can this be fixed?

Set Pages 0 Lin 132 Trims On Feed Off Ver Off Head Off Emb On Term Off
Col File_Name Noprint New_Value File_Name

SELECT DISTINCT
         'FAC_'
      || UPPER (SUBSTR (academic_period_desc, 1, 2))
      || EXTRACT (YEAR FROM start_date)  || '.txt'
         AS file_name
FROM schedule_offering
WHERE academic_period = '200830';

Col Num_Cnt Noprint New_Value Num_Cnt
Spo &&File_Name
Prompt EXTERNAL_COURSE_KEY|EXTERNAL_PERSON_KEY|ROLE

SELECT REPLACE (   a.course_identification
                || a.offering_number
                || a.academic_period_desc,
                ' ',
                ''
      )
      || '|'
     CASE
         WHEN b.person_uid IS NULL
          THEN
             CASE
                WHEN A.DEPARTMENT = 'BIOL' THEN 112390
                WHEN A.DEPARTMENT = 'EDUC' THEN 112514
                WHEN A.DEPARTMENT = 'GNST' THEN 112534
                WHEN A.DEPARTMENT = 'MATH' THEN 112664
                WHEN A.DEPARTMENT = 'GEMS' THEN 112556
                WHEN A.DEPARTMENT = 'ART'  THEN 112365
                WHEN A.DEPARTMENT = 'LLC'  THEN 112600
                WHEN A.DEPARTMENT = 'MM'   THEN 112428
                WHEN A.DEPARTMENT = 'CHP'  THEN 112835
             END
           ELSE b.person_uid
         END
      || '|'
      || 'Instructor',
      ROWNUM num_cnt
FROM schedule_offering a, faculty b
WHERE     b.id(+) = a.primary_instructor_id
      AND b.academic_period(+) = '200830'
      AND b.faculty_member_status(+) = 'AC'
      AND a.academic_period = '200830'
      AND a.status = 'A'
      AND a.actual_enrollment > 0;
     -- AND a.active_offering_ind = 'Y';

SELECT   '***FileFooter'
      || '|'
      || trim('&&Num_Cnt')
      || '|'
      || TO_CHAR (SYSDATE, 'Hh24:Mi:Ss')
      || ' '
      || TO_CHAR (SYSDATE, 'Mm/Dd/Yyyy')
FROM DUAL;

Spo Off
0
Comment
Question by:Jack Seaman
2 Comments
 
LVL 6

Accepted Solution

by:
Jankovsky earned 500 total points
ID: 22747528
....
SELECT REPLACE (   a.course_identification
                || a.offering_number
                || a.academic_period_desc,
                ' ',
                ''
      )
      || '|' || -- the place of correction
     CASE
         WHEN b.person_uid IS NULL
          THEN
.....
0
 
LVL 32

Expert Comment

by:awking00
ID: 22758262
What is the complete error message?
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
ORA-01008: not all variables bound. 6 58
Not able to add the URL for the   access control list - oracle plsql 10 102
constraint check 2 43
Oracle DB monitor SW 21 50
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…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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 take different types of Oracle backups using RMAN.

803 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