Solved

PL/SQL case statement

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
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 set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

756 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