Solved

PL/SQL case statement

Posted on 2008-10-17
2
1,799 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
Comment Utility
....
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 31

Expert Comment

by:awking00
Comment Utility
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.

Join & Write a Comment

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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 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.

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now