Solved

PL/SQL case statement

Posted on 2008-10-17
2
1,843 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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 article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

829 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