Pls -00371 error (problem in multiple declaration )

function code:
//start
create or replace function salinc(si number default 10) return number
is
number sinc;
number bef;
number aft;
begin
select sum(sal) into bef from emp where deptno=si;
update employees set sal=sal+200 where deptno=si;
select sum(sal) into aft from emp where deptno=si;
sinc:=aft-bef;
return sinc;
end salinc;
//end
is giving me these 2 errors:
0/0      PL/SQL: Compilation unit analysis terminated
1/46      PLS-00371: at most one declaration for 'NUMBER' is permitted in t he declaration section
how can i now declare the variables ?? need help

tushar88 wrote:
function code:
//start
create or replace function salinc(si number default 10) return number
is
number sinc;
number bef;
number aft;
beginIn oracle declaration is done as
<variable name> <data type>
i.e. your decleration is incorrect. it must be
sinc number;
bef number;
aft number;

Similar Messages

  • How to resolve multiple declaration error in libraries

    Hi All,
    I have one C Application, it links to two libraries. There is one variable with same name defined in two different libraries. These two libraries are third party libraries and i don't have access to their source code.
    Compiler gives multiple declaration of same variable error.
    Please let me know how to resolve this error.
    Thanks in Advance.
    Regards,
    Vasu

    Please, show your compilation line as well as error that you get.
    Are these static or shared libraries?
    Are we talking about Solaris here?
    regards,
    Fedor.

  • Error: Multiple declaration

    Hi all,
    We have an issue occuring only in solaris-sparc platform(not on gcc/linux).
    In a source file(.cpp) we have many variables declared and defined, when try complile all of these variables give the following error:
    Error: Multiple declaration <variable>
    The compilation unit(headers and file) contains templates(function and class),specialization.
    When these variable declaration is moved to header, then it works also when variables are put into include once using (#ifdefs like header file) it works
    Is there any technique/processing compiler does and goes thru the cpp file twice? Anything specific to solaris? Any pointers would be of great help!
    I am using Sunstudio 11
    Thanks in advance for all your help!
    Thanks,
    Qrio

    You are probably running into a program organization issue regarding placement of template declarations and definitions. Different compilers have different rules.
    The topic is discussed in detail in Chapter 5, Program Organization, of the C++ Users Guide:
    [http://docs.sun.com/app/docs/doc/819-5267/bkaep?a=view]
    (This pointer is for Sun Studio 12, but this property of Sun C++ has not changed.)
    Briefly: If a header file foo.h contains template declarations, the compiler will look for foo.cc (or foo.C, foo.cpp, foo.c, etc) expecting to find template definitions, and include foo.cc automatically. Consequently, if foo.h contains template declarations, foo.cc must contain only definitions for templates declared in foo.h. It can also contain declarations needed for those definitions that are not available when foo.h is included, but no other definitions.

  • Forte C++:error: Multiple Declaration for std::exception

    Hi,
    I am trying to compile code written in C++ 4.2/solrais 2.6 with Forte 6 C++ compiler on Solaris 7. Getting the following error.
    /opt/SUNWspro/WS6/include/CC/exception.h Line 17: Multiple Declaration for std::exception.
    Tried running only the preprocessor using -E option and noticed from the output that both "exception" and "exception.h" contents included.
    Any help!

    I got this same error and was able to fix it by eliminating
    #include <math.h> in my code.
    As it turned out this #include was not needed.
    It then compiled in standard mode.
    Hope this helps.

  • Forte C++ error: Multiple declaration for std::tm

    I am trying to compile a program (in standard mode) a program that used
    to compile OK in SC4.2 and still compiles OK in compat (but I need
    to compile it standard mode). Forte C++ 6.0 gives me the error:
    CC -c -O -mt -KPIC -D_REENTRANT ... file.c
    "/usr/include/time.h", line 30: Error: Multiple declaration for std::tm.
    "/usr/include/wchar.h", line 21: Error: Multiple declaration for std::tm.
    2 Error(s) detected.
    I include time.h, but wchar.h is included from the chain:
    /opt/SUNWspro/WS6/include/CC/iostream.h
    /opt/SUNWspro/WS6/include/CC/Cstd/./istream
    /opt/SUNWspro/WS6/include/CC/Cstd/./ios
    /opt/SUNWspro/WS6/include/CC/Cstd/rw/rwlocale
    /opt/SUNWspro/WS6/include/CC/Cstd/./string
    /opt/SUNWspro/WS6/include/CC/std/wchar.h
    So can't I include iostream.h and time.h together?

    Why are you using major include files with dot-h extentions in Standard Mode? Don't you mean to use #include <ctime> and #include <iostream>?

  • HT201210 pls solve my problem error 3194

    pls solve my problem error 3194

    Hello,
    Check this:
    This device is not eligible for the requested build (Also sometimes displayed as an "error 3194")
    Update to the latest version of iTunes. Mac OS X 10.5.8 (Leopard) users may need to download iTunes 10.6.3.
    Third-party security software or router security settings can also cause this issue. To resolve this, followTroubleshooting security software issues.
    Downgrading to a previous version of iOS is not supported. If you have installed software to performunauthorized modifications to your iOS device, that software may have redirected connections to the update server (gs.apple.com) within the Hosts file. Uninstall the unauthorized modification software from the computer.
    Edit out the "gs.apple.com" redirect from your hosts file, and then restart the computer for the host file changes to take affect. For steps to edit the Hosts file and allow iTunes to communicate with the update server, see iTunes: Troubleshooting iTunes Store on your computer, iPhone, iPad, or iPod—follow steps under the heading Blocked by configuration (Mac OS X / Windows) > Rebuild network information > The hosts file may also be blocking the iTunes Store. If you do not uninstall the unauthorized modification software prior to editing the hosts file, that software may automatically modify the hosts file again on restart.
    Avoid using an older or modified .ipsw file. Try moving the current .ipsw file (see Advanced Steps > Rename, move, or delete the iOS software file (.ipsw) below for file locations), or try restoring in a new user to ensure that iTunes downloads a new .ipsw.
    Hope it helps,

  • PLS-00907 Error but referenced package compiled

    Hi I am experiencing some problems with Database Link.
    In DEV Environment,
    I have two database, DB A and DB B.
    In DB A I have package name SUPPORT_PKG and inside it I have a function named HISTORY_UPDATE.
    Package is compiled correctly in DB A and working fine.
    I created a procedure CALL_HIST_UPD in DB B to execute SUPPORT.PKG.HISTORY_UPDATE@A through DB LINK.
    and it gave me PLS-00907 error.
    UAT environment has the same setup of user and package as DEV.
    then I tried to copy the CALL_HIST_UPD to DB B in UAT and it can be compiled sucessfully in UAT.so I do the following
    Back to Dev again
    I tried to figure what's going on until I decided to replace the header specification SUPPORT.PKG.HISTORY_UPDATE
    with the declaration part from the body and recompiled the whole package again, and this time I can compile the procedure in DB B.
    I am curious and check the header in UAT and found that UAT Headers is the same exactly with the DEV Headers
    before I replaced it with the new one by copying from the body. I am curious why the DEV environment give the PLS-00907 error at the first time, even at that time package in A are compiled nicely.
    Let me know if the question is not clear.
    thanks for your help

    Try this -
    CREATE OR REPLACE PACKAGE data_mgmt AUTHID CURRENT_USER
    IS
       FUNCTION hy_name (in_dt DATE, in_option_txt VARCHAR2)
          RETURN VARCHAR2;
    END data_mgmt;
    CREATE OR REPLACE PACKAGE BODY data_mgmt
    IS
       FUNCTION hy_name (in_dt DATE, in_option_txt VARCHAR2)
          RETURN VARCHAR2
       IS
          return_txt   VARCHAR2 (25);
       BEGIN
          RETURN return_txt;
       END hy_name;
    END data_mgmt;
    /

  • PLS-00428 Error when creating a new trigger

    Hi,
    I'm encountering the PLS-00428 error when I run the script below.
    CREATE OR REPLACE TRIGGER TIBCOUSER.po_response_trigger
    BEFORE INSERT ON po_response FOR EACH ROW
    BEGIN
    IF:NEW.ariba_processsequence is null then
    SELECT pttransid AS pttransid, 'Product Test Pass 1' AS pttransname, aribaorderid AS aribaorderid, '0' AS errorcode, '' AS MESSAGE, SYSDATE AS ariba_insertdate
    FROM po_request
    WHERE adb_l_delivery_status = 'N';
    UPDATE po_request
    SET adb_l_delivery_status = 'C'
    WHERE adb_l_delivery_status = 'N';
    END IF;
    END;
    Can someone point out what is missing or what is wrong with the script? Any help would be much appreciated.
    Regards,
    Jigger

    Hi Jigger,
    I was able to create the trigger using the script below.That's nice, you got the trigger created. Below is your trigger, I have added some comments.
    create or replace trigger tibcouser.po_response_trigger
       before insert or update
       on po_response
       for each row
    declare
      -- 1. These variables should really be anchored to po_response
      -- 2. They should be named differently than columns in po_response
      -- 3. It seems that you don't need them (See 7.)
       pttransid               integer := null;
       pttransname             varchar2(255) := null;
       aribaorderid            varchar2(255) := null;
       errorcode               integer := null;
       message                 varchar2(255) := null;
       ariba_insertdate        date := null;
       adb_l_delivery_status   char(1) := null;
    begin
      -- 4. This is never true, since adb_l_delivery_status is null, here
          -- So, I guess your trigger never does anything, so in a sense it works
       if (adb_l_delivery_status = 'N')
       then
        -- 5. This select  will raise too_many_rows, when there is more than one record in po_response.
        -- 6. It seems you will have a problem with mutating table
        -- 7. The select doesn't do anything, you never use any of the values selected
        -- 8. The select is confusing, since variables are named equally to columns
        -- 9. You select constants, why not just assign them right away
        select pttransid
                ,pttransname
                ,aribaorderid
                ,'0'
                ,sysdate
            into pttransid
                ,pttransname
                ,aribaorderid
                ,errorcode
                ,message
                ,ariba_insertdate
            from po_response;
          -- 10. This update will update ALL records in po_request, probably not what you want.
          update po_request
             set adb_l_delivery_status = 'C';
       end if;
    -- 11. Good practise dictates end po_response_trigger;
    end;
    /In general, when you think your post has been answered, then kindly mark it as such.
    Regards
    Peter

  • Help me resolve this---- PLS-00302: component 'STRING' must be declared

    Can anyone please guide me in resolving the below error
    The statement below is in the package spec.
    TYPE rec IS RECORD ( proj AV_ACTIVITY.proj%TYPE, act AV_ACTIVITY.act%TYPE );
    TYPE object_table_type is TABLE OF rec INDEX BY BINARY_INTEGER;
    temp_as_rn object_table_type;
    Then i am wrting a cursor in the package body and trying to access the component...but it throws up the
    PLS-00302: component 'PROJ' must be declared
    The below code is in the package body
    CURSOR c2_memo_attr(proj_temp varchar2,act_temp varchar2) is
    select distinct
    dup.proj,
    dup.proj_ds as proj_ds,
    dup.act,
    dup.act_ds as act_ds,
    initcap(to_char(ac.eid, 'fmMonth DDth, YYYY')),
    initcap(to_char(ac.lid, 'fmMonth DDth, YYYY')),
    initcap(to_char(ac.act_due_date, 'fmMonth DDth, YYYY')),
    dup.uc03 as Study_no
    from dup_resource_status dup, av_activity ac
    where ( ac.proj = proj_temp
    and ac.act = act_temp)
    and dup.proj = ac.proj
    and dup.act = ac.act
    and ac.ver = 0;
    for c2_memo_attr_rec in c2_memo_attr(temp_as_rn.proj,temp_as_rn.act)
    loop
    text := 'abcd......'
         end loop;

    Cursor loops are obsolete technology? Hmm, not sure I agree with you there.
    Yes, sometimes they are an indication of slow-by-slow processing that could be better done in one dml statement, or with bulk collections, etc, but sometimes that's not the case - unless I'm missing something.
    For example, I'm writing a procedure to take care of deleting partitions on a periodic basis, and I'm taking into consideration the case where there might be more than one partition to delete. So I'm using a cursor to identify the partitions to delete, and using a cursor for loop to loop round and execute the dynamic drop partition statement.
    Since there's never going to be that many partitions, this isn't going to be particularly unperformant, and so I don't see a problem with using the cursor for loop construction for it.
    I'd like to hear more on why you think it's obsolete technology in reference to my specific example - and also what you think I should be using.

  • How to fix the PLS-00123 error?

    I construct about the oracle spatial sql as follow:
    declare
    ord sdo_ordinate_array := sdo_ordinate_array();
    begin
    begin for i IN 1 ..5624 LOOP
    ord extend;
    end LOOP;
    ord(1) := number1;
    ord(2) := number2;
    ord(3) := number3;
    ord(4) := number4;
    insert into table(shape,....) values(SDO_GEOMETRY(2002,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),ord));
    END;
    Because the count of geometry node is very long. I got the PLS-00123 error when I execute the state? somebody help me fix the problem?????
    Message was edited by:
    user646459

    It seems more on PL/SQL error to me. Have you posted your question in PL/SQL forum?
    Ming Man

  • Cyclic PLS-00538 and PLS-00539 errors?

    I've defined a supertype, t_cliente, and derived two subtypes, t_cliente_pers and t_cliente_soc. The first one has 6 member functions and the latter ones override only two of them.
    Every time I launch the script for creation I get PLS-00538 and PLS-00539 errors, but I'm not able to find out why.
    The explanation for PLS-00538 is: subprogram or cursor "string" is declared in an object type specification and must be defined in the object type body.
    For PLS-00539 is: subprogram "string" is declared in an object type body and must be defined in the object type specification.
    It's a cycle! And after all I defined these 2 functions in type specification and type body.
    I'm using 10g XE. Here's the code:
    create TYPE t_indirizzo AS OBJECT (
    via VARCHAR(45),
    numero NUMBER(4),
    cap INTEGER(5),
    citta VARCHAR(30),
    provincia VARCHAR(30),
    regione VARCHAR(30),
    MEMBER FUNCTION indirizzoCompleto RETURN VARCHAR
    create TYPE t_telefono AS OBJECT (
    num_tel NUMBER(15)
    create TYPE t_telefono_array IS VARRAY(3) OF t_telefono
    create TYPE t_anagrafica AS OBJECT (
    nome VARCHAR(45),
    cognome VARCHAR(45),
    sesso CHAR(1),
    cod_fiscale VARCHAR(16),
    data_nascita DATE
    create TYPE t_ragioneSociale AS OBJECT (
    nome_soc VARCHAR(45),
    data_cost DATE,
    part_iva NUMBER(11)
    create TYPE t_persona AS OBJECT (
    dati_anagrafici t_anagrafica,
    indirizzo t_indirizzo,
    email VARCHAR(45),
    telefono t_telefono_array
    create TYPE t_societa AS OBJECT (
    ragione_sociale t_ragioneSociale,
    indirizzo t_indirizzo,
    email VARCHAR(45),
    telefono t_telefono_array,
    persona_rif REF t_persona
    create TYPE t_cliente AS OBJECT (
    cod_cliente NUMBER(8),
    MEMBER FUNCTION incFatti RETURN NUMBER,
    MEMBER FUNCTION incSubiti RETURN NUMBER,
    MEMBER FUNCTION incFattiPeriodo RETURN NUMBER, /* this is the first function that gives me problems */
    MEMBER FUNCTION incSubitiPeriodo RETURN NUMBER, /* this is the second one */
    MEMBER FUNCTION nomeCliente RETURN VARCHAR,
    MEMBER FUNCTION tipoCliente RETURN VARCHAR
    ) NOT FINAL
    create or replace
    TYPE BODY t_cliente AS
    MEMBER FUNCTION incFatti RETURN NUMBER
    IS incidenti NUMBER;
    BEGIN
    SELECT count(i. cod_incidente) INTO incidenti
    FROM incidente i, mezzo m
    WHERE SELF.cod_cliente = m.proprietario.cod_cliente AND m.num_targa = i.mezzo. num_targa AND i. responsabilita = 'c';
    RETURN (incidenti);
    END;
    MEMBER FUNCTION incSubiti RETURN NUMBER
    IS incidenti NUMBER;
    BEGIN
    SELECT count(i. cod_incidente) INTO incidenti /* here's the first PLS-00538 error */
    FROM incidente i, mezzo m /* here's the second PLS-00538 error */
    WHERE SELF.cod_cliente = m.proprietario.cod_cliente AND m.num_targa = i.mezzo. num_targa AND i. responsabilita = 's';
    RETURN (incidenti);
    END;
    MEMBER FUNCTION incFattiPeriodo(da DATE, a DATE) RETURN NUMBER /* here's the first PLS-00539 error */
    IS incidenti NUMBER;
    BEGIN
    SELECT count(i. cod_incidente) INTO incidenti
    FROM incidente i , mezzo m
    WHERE SELF. cod_cliente = m.proprietario.cod_cliente AND m. num_targa = i.mezzo. num_targa AND i. responsabilita = 'c' AND (i.data_inc BETWEEN da and a);
    RETURN (incidenti);
    END;
    MEMBER FUNCTION incSubitiPeriodo(da DATE, a DATE) RETURN NUMBER /* here's the second PLS-00539 error */
    IS incidenti NUMBER;
    BEGIN
    SELECT count(i. cod_incidente) INTO incidenti
    FROM incidente i , mezzo m
    WHERE SELF. cod_cliente = m.proprietario.cod_cliente AND m. num_targa = i.mezzo. num_targa AND i. responsabilita = 's' AND (i.data_inc BETWEEN da and a);
    RETURN (incidenti);
    END;
    MEMBER FUNCTION nomeCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN TO_CHAR(cod_cliente);
    END;
    MEMBER FUNCTION tipoCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN ('u');
    END;
    END;
    create TYPE t_cliente_pers UNDER t_cliente (
    persona REF t_persona,
    OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR,
    OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
    ) NOT FINAL
    create or replace
    TYPE BODY t_cliente_pers AS
    OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR
    IS nc VARCHAR(90);
    BEGIN
    SELECT concat(DEREF(SELF.persona).dati_anagrafici.nome, concat(' ',DEREF(SELF.persona).dati_anagrafici.cognome)) INTO nc
    FROM DUAL;
    RETURN (nc);
    END;
    OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN ('p');
    END;
    END;
    create TYPE t_cliente_soc UNDER t_cliente (
    societa t_societa,
    OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR,
    OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
    ) NOT FINAL
    create or replace
    TYPE BODY t_cliente_soc AS
    OVERRIDING MEMBER FUNCTION nomeCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN (societa.ragione_sociale.nome_soc);
    END;
    OVERRIDING MEMBER FUNCTION tipoCliente RETURN VARCHAR
    IS
    BEGIN
    RETURN ('s');
    END;
    END;
    /

    The declarations of functions incFattiPeriodo and incSubitiPeriodo differ between type specification and type body (the ones in the type body have formal parameters).

  • Problem with multiple Toplink/JPA apps in same server

    Anyone have experence of running serveral Toplink/ EJB-3 Web apps in the same server (OC4J, alas)?
    We seem to get a problem with the second app failing to initialise toplink, with an entity not found message. Each app runs OK on it's own.

    Yes, they access the same datasource and most of the tables overlap.
    We're thinking it might help to have common entity classes and put them in a shared library, but I don't know if this is relevant (setting up shared libraries complicates testing and tends to snowball, I reckon we need about 15 jars all told).
    I''ve had some funnies on OC4J before which I think may be to do with it's use of ClassLoaders, for example I initially put persistence.xml in the libary jar with the data model, but for some reason I get the entity not found error that way. It only seems to work if it's in the classes folder.
    For the moment we're getting arround the problem with multiple OC4J instances in the server.

  • Problem in multiple selections in a jList

    I have two jLists. Now I have to select some items from one jlist and have to transfer in the other one. But while trying to do it in the runtime I am getting some unexpected runtime errors including "Exception occurred during event dispatching". When I try to transfer only one item it works fine but shows problem in multiple selections. Pleast give your suggestions.

    [_First suggestion_|http://catb.org/~esr/faqs/smart-questions.html]
    [_Second suggestion_|http://mindprod.com/jgloss/sscce.html]
    db

  • PLS-00201 error when trying to pass an OUT parameter

    Hi,
    Please help me to resolve the below error:
    I am trying to pass an OUT parameter in a package.
    I have declared it in package specs as
    ProcABC(p_val IN varchar2, p_val2 IN varchar2, p_val3 OUT varchar2)
    In package body
    I have created the procedure as
    Create or Replace procedure ProcABC(p_val IN varchar2, p_val2 IN varchar2, p_val3 OUT varchar2) AS
    v_LogDir varchar2(40);
    v_message varchar2(200);
    BEGIN
    SELECT directory_path into v_LogDir FROM ALL_DIRECTORIES WHERE directory_name = 'ABC';
    v_message := v_LogDir ;
    some sql statements..
    p_val3 := v_message;
    Return p_val3;
    End procABC;
    SQL> exec pkg_A.procABC('Stage2', NULL, p_val3);
    Package compiles successfully but while execution it returns error as:
    ORA-06550: line 1, column 74:
    PLS-00201: identifier 'p_val3 ' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Please advise.

    Hi Suresh,
    Thanks for the information and help. I was able to run the package with this usage.
    Now, the issue is
    I need to return a v long string by the OUT parameter so I defined the datatype of OUT parameter as CLOB.
    But, when I declare local variable to run the package with this OUT paramater I get the error :
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 1
    When I pass a shorter string it works.
    Kindly advise me how to resolve this issue while using CLOB as datatype of OUT parameter.

  • Problem Using Multiple With Statements

    I'm having a problem using multiple WITH statements. Oracle seems to be expecting a SELECT statement after the first one. I need two in order to reference stuff from the second one in another query.
    Here's my code:
    <code>
    WITH calculate_terms AS (SELECT robinst_current_term_code,
    CASE
    WHEN robinst_current_term_code LIKE '%60' THEN robinst_current_term_code - '40'
    WHEN robinst_current_term_code LIKE '%20' THEN robinst_current_term_code - '100'
    END first_term,
    CASE
    WHEN robinst_current_term_code LIKE '%60' THEN robinst_current_term_code - '100'
    WHEN robinst_current_term_code LIKE '%20' THEN robinst_current_term_code - '160'
    END second_term
    FROM robinst
    WHERE robinst_aidy_code = :aidy)
    /*Use terms from calculate_terms to generate attendance periods*/
    WITH gen_attn_terms AS
    SELECT
    CASE
    WHEN first_term LIKE '%60' THEN 'Fall '||substr(first_term,0,4)
    WHEN first_term LIKE '%20' THEN 'Spring '||substr(first_term,0,4)
    END first_attn_period,
    CASE
    WHEN second_term LIKE '%60' THEN 'Fall '||substr(second_term,0,4)
    WHEN second_term LIKE '%20' THEN 'Spring '||substr(second_term,0,4)
    END second_attn_period
    FROM calculate_terms
    SELECT *
    FROM gen_attn_terms
    <code>
    I get ORA-00928: missing SELECT keyword error. What could be the problem?

    You can just separate them with a comma:
    WITH calculate_terms AS (SELECT robinst_current_term_code,
    CASE
    WHEN robinst_current_term_code LIKE '%60' THEN robinst_current_term_code - '40'
    WHEN robinst_current_term_code LIKE '%20' THEN robinst_current_term_code - '100'
    END first_term,
    CASE
    WHEN robinst_current_term_code LIKE '%60' THEN robinst_current_term_code - '100'
    WHEN robinst_current_term_code LIKE '%20' THEN robinst_current_term_code - '160'
    END second_term
    FROM robinst
    WHERE robinst_aidy_code = :aidy),
    /*Use terms from calculate_terms to generate attendance periods*/
    gen_attn_terms AS
    SELECT
    CASE
    WHEN first_term LIKE '%60' THEN 'Fall '||substr(first_term,0,4)
    WHEN first_term LIKE '%20' THEN 'Spring '||substr(first_term,0,4)
    END first_attn_period,
    CASE
    WHEN second_term LIKE '%60' THEN 'Fall '||substr(second_term,0,4)
    WHEN second_term LIKE '%20' THEN 'Spring '||substr(second_term,0,4)
    END second_attn_period
    FROM calculate_terms
    )Not tested because there are no scripts.

Maybe you are looking for