Solved

PL/SQL case statement

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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 …
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

740 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