IF...ELSEIF

Hello,
Im having trouble placing IF and ELSEIF in the right place.
Basically I need IF 'A' = 1000 then do this... ELSE IF "A"= 2000 then do this.....
I have to add "IF" before CASE and the ELSEIF to continue with statement.
This is what i have now!
SELECT
FROM ( a, b, c, d,
CASE
WHEN .....THEN .....
WHEN......THEN......
END AS xxxxx
from f_all_hist)

Right now I have this statment: Now I use WHEN at the end of the script!
SELECT
FROM ( a, b, c, d,
CASE
WHEN .....THEN .....
WHEN......THEN......
END AS xxxxx
from f_all_hist)
WHEN a = '1000' i also have a = 2000 with different WHEN......THEN......
How can i use IF and ELSEIF inside the sql statment. I should have only one SELECT stament, not sure if one CASE:
Something like this (This is wrong!)
SELECT
FROM (
SELECT a, b, c, d, e,
IF a = '1000' THEN
(CASE
WHEN b BETWEEN 4001 AND 4500
THEN 'D
ELSIF a = '2000'
THEN ( CASE
WHEN b BETWEEN 4001 AND 4500
THEN N
end as ……………..
from ……………)
Is this clear?
Thank-you

Similar Messages

  • ELSEIF in calculated key figure

    Dear gurus
    We have recently upgraded to NW2004s, and would need some help on the formula for my calculated key figure. This calculated key figure is meant to replicate IF... ELSEIF statement, depending on what the user enters. The logic that we have are as below :
    IF Var=1, then display key figure A
    ELSEIF Var=2, then display key figure B
    ELSEIF Var=3, then display key figure C
    ELSEIF Var=4, then display key figure D
    where Var is a Formula Variable, Processing By User Entry/Default value.
    The formula that we have originally, in BW3.5 is :
    <i>(Var == 1) * 'Amount in TC' + (Var== 2) * 'Amount in Comp Code' + (Var == 3) * 'Amount in Parall USD' + (Var == 4) * 'Amount in Hard Cur' </i>
    This formula has served us well in BW 3.1 to BW 3.5, and never had any problems with it. However, when we migrated over to BW 7.0, we could not get values for this formula (eventhough we have data in our cubes). The only data that get is when we key in Var=1, but when we try with Var=2, 3 or 4, no data is displayed in our key figure.
    We tried to debug, but somehow we could not figure out how the new BW7.0 calculates these type of key figures, and whether is there a change in the formula variable. We believe that the problem may lie in the way that BW 7.0 interprets the formula above, and only obtains the first portion of the formula (Var==1).
    We would appreciate any helps, and of course, points will be awarded if problem can be solved.
    Thanks a lot

    Dear all
    With some luck in searching, I manage to find an OSS note which depicts this error and resolve it. For those who have the same problem, please use this OSS Note 994194.
    Cheers

  • Formula : If - Elseif

    Hi all,
    I have 6 Calculated Key Figured and based on theirs values i need a Formula Key Figured, in order to do this i need to add a logical expresion in FKF; something like that: (CKF1= calculated key figured, XXX some operation)
    If (CKF1 <>0)
      XXXX
    elseif (CKF2 <> 0)
      XXXX
    elseif (CKF3 <> 0)
      XXXX
    elseif (CKF4 <> 0)
      XXXX
    elseif (CKF5 <> 0)
      XXXX
    Else
      XXXX
    Endif
    I will assign point !! please, help me !!
    Regards

    Hi Sab,
    Check this thread, which gives a clear explanation of a scenario like yours.
    Formula in BEx
    If you need any further assistance, let me know
    Regards,
    R.Ravi
    *Assigning points is the way of saying Thanks in SDN

  • Compilation error in a function due to simple IF-ELSEIF condition

    DB version:10gR2
    I have created the below mentioned function to activate or deactivate a custom functionality in a package.
    The functionlity should be activated only if the second byte of sys_config.flag_a ='Y' with CODE_ID='103'. If flag_a is null or if no such row exist , the function should return false
    During the compilation, i am getting error as mentioned below. This can be easily reproduced.
    create table sys_config (flag_a     varchar2(5), code_id varchar2(5));
    create or replace function chk_if_mod_enabled
       return boolean
       is
          v_flag_a sys_config.flag_a%TYPE;
    begin
         select nvl(substr(flag_a,2,1),'N')
         into v_flag_a
         from sys_config
         where     flag_a='Y'
         and     code_id='103';
         if     v_flag_a='Y'
              then return true;
         elseif     v_flag_a='N'
              then return false;
         else     return false;
         End If;
    exception
    when others
    then
    Return false;
    end;The error i am getting is
    Errors for FUNCTION CHK_IF_MOD_ENABLED:
    LINE/COL ERROR
    15/9     PLS-00103: Encountered the symbol "V_FLAG_A" when expecting one
             of the following:
             := . ( @ % ;
    21/1     PLS-00103: Encountered the symbol "EXCEPTION" when expecting one
             of the following:
             begin case declare else elsif end exit for goto if loop mod
             null pragma raise return select update while with
             <an identifier> <a double-quoted delimited-identifier>
             <a bind variable> << close current delete fetch lock insert
             open rollback savepoint set sql execute commit forall merge
    LINE/COL ERROR
             pipe
    25/4     PLS-00103: Encountered the symbol "end-of-file" when expecting
             one of the following:
             end not pragma final instantiable order overriding static
             member constructor mapIf i comment out the ELSEIF bit from the code, i won't get any error. Why is this happening?

    You are returning boolean type.
    So, you should be careful about using this function. You cannot use that in SQL.
    Regards.
    Satyaki De.

  • Problem with if - elseif - endif.

    Hi,
    Pls see this code
    IF g_error = 'X'.
        WRITE: / "File formatted incorrectly.".
      ELSEIF tot_betrg NE g_tot_betrg OR g_tot_rec NE l_tot_rec .
        WRITE: / 'summary record count does not match.'.
        SKIP.
      ENDIF.
    This is giving me syntax error "Field elseif if unknown. It is neither in one of the specified tables nor defined by a 'data' statement.
    Please help
    Thanks
    Pranati

    Hi Pranati,
    Modify your code in this way.
    IF g_error = 'X'.
    WRITE: / "File formatted incorrectly.".
    ELSEIF.
    tot_betrg NE g_tot_betrg OR g_tot_rec NE l_tot_rec .
    WRITE: / 'summary record count does not match.'.
    SKIP.
    ENDIF.
    Hope this resolves your query.
    <b>Reward all the helpful answers.</b>
    Regards

  • Php if/elseif and mysql

    I was wondering if you could help we with this.
    PART 1
    i have a table of students info. I give the students praise
    points for doing well in the lesson.
    I want to compare two students's praise points, if one is
    bigger (Higher) than the other i want to be taken to a win page, if
    it is a draw to a draw page and a loss to a loss page.
    i have a record set on the page that i am using to display
    student1's info in a table on the left and student2s info on the
    right (Student2s praise points are not visible and i dopnt want
    them to be)
    I want to click on a button/link that compares the praise
    points.
    PART 2
    If the result is a win, i want the feild win in the database
    for that student to be increaded by 3 points, if it is a draw then
    by 1 and if it is a loss nothing to happen.
    So i think i need an if/elseif statement and an INSERT
    STATEMENT? im not sure.
    can anyone help?
    Text
    PART 1

    LoadModule libphp4 /usr/lib/apache/libphp4.so
    AddModule mod_php4.c
    AddType application/x-httpd-php .php
    The weird thing is that this aint working for me, although it's correct
    When I open a .php file with apache, he doesn't recognize its extension and my browser asks me to open or save it...
    However when I deleted the .php in the url  (localhost/info instead of localhost/info.php) he DID load the phpinfo page.
    Now after al lot of testing that doesn't even work anymore (although I'm pretty sure that my config files are exactly the same as when that did work)
    (and I'm using rc.d/httpd)
    There are NO errors at all in my apache logs.

  • If...elseif statement...

    Hi,
    I am selecting the data to an itab gi_output.I have 3 checkboxes in my selection screen(p_wgt and p_wgt and p_dimen).so according to the checkboxes selected the data should be deleted from gi_output.
    if p_wgt = 'X'.
      delete gi_output where tarag NE '0.000' and magew NE '0.000'
                          and ntgew NE '0.000' and brgew NE '0.000'.
    elseif p_ippc = 'X'.
      delete gi_output where vegr1 NE ' '.
    elseif p_dimen = 'X'.
       delete gi_output where laeng NE '0.000'
                           and breit NE '0.000'
                           and hoehe NE '0.000'.
    elseif p_wgt = 'X' and P_ippc = 'X'.
      delete gi_output where tarag NE '0.000' and magew NE '0.000'
                         and ntgew NE '0.000' and brgew NE '0.000'
                         or vegr1 NE ' '.
    when 1 checkbox is selected..my coding is working fine..but when 2 checkboxes are selected (suppose p_wgt and P_ippc),the control is checking 1st if statement(P_wgt = 'X')than after that it is coming out of if statement block....any idea..

    Hello,
    You need to write all possible combination for check boxes.
    if p_wgt = 'X' AND p_ippc = 'X' AND p_dimen = 'X'.
    <your deletion code>
    endif.
    if p_wgt = 'X' AND p_ippc = 'X' .
    <your deletion code>
    endif.
    if p_ippc = 'X' AND p_dimen = 'X'.
    <your deletion code>
    endif.
    if p_wgt = 'X' AND  p_dimen = 'X'.
    <your deletion code>
    endif.
    if p_wgt = 'X' .
    <your deletion code>
    endif.
    if p_ippc = 'X' .
    <your deletion code>
    endif.
    if p_dimen = 'X'.
    <your deletion code>
    endif.
    Regards
    Arindam

  • IF elseif not working

    hi sapgurus,
    LOOP AT T_KONV INTO W_KONV." WHERE KSCHL+0(3) = 'JIP'
              "OR KSCHL+0(3) = 'ZIP' .
              IF W_KONV-KSCHL =  'JIP1' OR
                 W_KONV-KSCHL =  'JIP2' OR
                 W_KONV-KSCHL =  'JIP3' OR
                 W_KONV-KSCHL =  'JIP4' OR
                 W_KONV-KSCHL =  'JIP5' OR
                 W_KONV-KSCHL =  'JIP6' OR
                 W_KONV-KSCHL =  'JIP7' OR
                 W_KONV-KSCHL =  'JIP8' OR
                 W_KONV-KSCHL =  'ZIP5' OR
                 W_KONV-KSCHL =  'ZIP7'.
                W_VAT = W_KONV-KWERT + W_VAT.
              ELSEIF W_KONV-KSCHL =  'JIP3' OR
                     W_KONV-KSCHL =  'JIP5' OR
                     W_KONV-KSCHL =  'JIP7' OR
                     W_KONV-KSCHL =  'ZIP5' OR
                     W_KONV-KSCHL =  'ZIP7'.
                  W_VAT_SET    = W_KONV-KWERT + W_VAT_SET.
              ELSEIF W_KONV-KSCHL =  'JMO1' OR
                     W_KONV-KSCHL =  'JAO1' OR
                     W_KONV-KSCHL =  'JAO2' OR
                     W_KONV-KSCHL =  'JMO2' OR
                     W_KONV-KSCHL =  'JSO1' OR
                     W_KONV-KSCHL =  'JSO2' OR
                     W_KONV-KSCHL =  'JEC1' OR
                     W_KONV-KSCHL =  'JEC2' OR
                     W_KONV-KSCHL =  'JA1S' OR
                     W_KONV-KSCHL =  'JA1I'.
                W_EXC = W_KONV-KWERT + W_EXC.
              ELSEIF W_KONV-KSCHL =  'JMO1' OR
                     W_KONV-KSCHL =  'JAO1' OR
                     W_KONV-KSCHL =  'JEC1' OR
                     W_KONV-KSCHL =  'JSO1' OR
                     W_KONV-KSCHL =  'JA1S' .
                W_EXC_SET = W_KONV-KWERT + W_EXC_SET.
              ELSEIF W_KONV-KSCHL =  'JMO1' OR
                     W_KONV-KSCHL =  'JAO1' OR
                     W_KONV-KSCHL =  'JAO2' OR
                     W_KONV-KSCHL =  'JMO2' OR             "ED
                     W_KONV-KSCHL =  'JSO1' OR
                     W_KONV-KSCHL =  'JSO2' OR
                     W_KONV-KSCHL =  'JEC1' OR
                     W_KONV-KSCHL =  'JEC2' OR
                     W_KONV-KSCHL =  'JA1S' OR
                     W_KONV-KSCHL =  'JA1I'.
                WA_ED = W_KONV-KWERT + WA_ED.
              ELSEIF W_KONV-KSCHL =  'JEC1' OR               "ED CESS
                     W_KONV-KSCHL =  'JSO1' OR
                     W_KONV-KSCHL =  'JA1S'.
                WA_ED_CESS = W_KONV-KWERT + WA_ED_CESS.
              ELSEIF W_KONV-KSCHL =  'JAO2' OR
                     W_KONV-KSCHL =  'JSO1' OR
                     W_KONV-KSCHL =  'JSO2' OR              "CESS
                     W_KONV-KSCHL =  'JEC1' OR
                     W_KONV-KSCHL =  'JEC2' OR
                     W_KONV-KSCHL =  'JA1S' .
                WA_CESS = W_KONV-KWERT + WA_CESS.
              ELSEIF W_KONV-KSCHL =  'JIP1' OR
                     W_KONV-KSCHL =  'JIP2' OR
                     W_KONV-KSCHL =  'JIP3' OR
                     W_KONV-KSCHL =  'ZSRT' OR             "CST
                     W_KONV-KSCHL =  'ZSST' OR
                     W_KONV-KSCHL =  'Z1P4'.
                WA_CST = W_KONV-KWERT + WA_CST.
               ELSE.
                W_OTH = W_KONV-KWERT + W_OTH.
              ENDIF.
            ENDLOOP.
    please go thru the code... all the above condition(s) are true still the cursor is not enter from wa_ed. please suggest why?

    hi,
    try using CASE
                       WHEN
                       WHEN
                       WHEN OTHERS
                  ENDCASE
    rather than using if...elseif..
    regards,
    sirisha

  • IF ELSEIF ELSE  error

    Good Morning
    This code compiles fine:
    IF v_status_code = '3' THEN
    INSERT INTO CRAM_STG
    (ID, ITEM_NO, CHGNBR, UI, SUPPLYACTIONCODE, QTY, ACCT, RECEIPTDATE, REQUISITIONDATE, PROCESSDATE)
    VALUES
    ( to_char(sysdate,'YYMMDDHH24MISS') || test_seq.nextval, no_stock_rec.item_no, v_change_no, v_unit_of_issue, 'UR', no_stock_rec.order_qty,
    no_stock_rec.acct, sysdate, sysdate, sysdate);
    ELSE
    dbms_output.put_line ('Else ' );
    END IF;
    However when I add an elseif I get the following error. Thanks for your help. :
    END;
    Error report:
    ORA-06550: line 96, column 20:
    PLS-00103: Encountered the symbol "V_STATUS_CODE" when expecting one of the following:
    := . ( @ % ;
    Here is the ELSEIF code
    IF v_status_code = '3' THEN
    INSERT INTO CRAM_STG
    (ID, ITEM_NO, CHGNBR, UI, SUPPLYACTIONCODE, QTY, ACCT, RECEIPTDATE, REQUISITIONDATE, PROCESSDATE)
    VALUES
    ( to_char(sysdate,'YYMMDDHH24MISS') || test_seq.nextval, no_stock_rec.item_no, v_change_no, v_unit_of_issue, 'UR', no_stock_rec.order_qty,
    no_stock_rec.acct, sysdate, sysdate, sysdate);
    ELSEIF v_status_code = '4' THEN
    INSERT INTO CRAM_STG
    (ID, ITEM_NO, CHGNBR, UI, SUPPLYACTIONCODE, QTY, ACCT, RECEIPTDATE, REQUISITIONDATE, PROCESSDATE)
    VALUES
    ( to_char(sysdate,'YYMMDDHH24MISS') || test_seq.nextval, no_stock_rec.item_no, v_change_no, v_unit_of_issue, 'NR', no_stock_rec.order_qty,
    no_stock_rec.acct, sysdate, sysdate, sysdate);
    ELSE
    dbms_output.put_line ('Else ' );
    END IF;

    Use ELSIF instead...
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/controlstructures.htm#sthref910

  • If elseif else echo statement with radio buttons

    Hi everyone  Please help me out here.  I have a standard php file with 4 groups of questions (radio groups). The user must answer "yes" to ALL 4 questions where after "You Qualify" will echo on the same page.  If any of the questions are answered "No" to, then "you do not qualify" must echo on the same page. If no answer is selected - then no echo  This sounds like a simple if elseif else  statement, but for some reason I just cant get it right.  Could anyone please help me out with this?  Herewith code that I have tried:
    Do you like apples?        Yes           No 
    Do you like oranges?
            Yes           No 
    Do you like pears?
         Yes      No
    Do you like lemons?
         Yes      No

    <?php
    if ($a > $b) {
        echo "a is bigger than b";
    } elseif ($a == $b) {
        echo "a is equal to b";
    } else {
        echo "a is smaller than b";
    ?>

  • If-elseif-else

    Hi
    I have a trigger which had just if-else in it. Due to change in business requirement I had to re develop it and I decided to use if-elseif-else statement. I am getting the following error
    47/9    PLS-00103: Encountered the symbol "C_OPSHE" when expecting one of the following:
              . ( * @ % & = - + < / > at in is mod remainder not rem then
              <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
              LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
              The symbol "then" was substituted for "C_OPSHE" to continue.
    78/1    PLS-00103: Encountered the symbol "ELSE" when expecting one of the following:
              begin case declare end exit for goto if loop mod null pragma
              raise return select update while with <an identifier>
              <a double-quoted delimited-identifier> <a bind variable> <<
              close current delete fetch lock insert open rollback
              savepoint set sql execute commit forall merge pipe
    83/1    PLS-00103: Encountered the symbol "EXCEPTION"
    85/4    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
              end not pragma final instantiable order overriding static
              member constructor map Can some one help me please where I am getting it wrong:
    My trigger is as follows
    DECLARE
    crt_keyholder CLOB;
    addto varchar2(100);
    crt_key varchar2(75);
    issue varchar2(75);
    del_key varchar2(75);
    CURSOR c_opsHE IS
    SELECT pu.person_code FROM people_units pu        
    INNER JOIN unit_instances ui       
    ON pu.unit_instance_code = ui.fes_unit_instance_code       
    WHERE pu.unit_type = 'R'       
    AND pu.progress_status ='A'        
    AND pu.calocc_code LIKE '%12/13%'       
    AND (pu.unit_instance_code LIKE 'Z%' OR pu.unit_instance_code LIKE 'V%')       
    AND pu.unit_instance_code  NOT LIKE 'ZX%'     
    AND ui.fes_source_finance = 'HEFCE';      
    CURSOR c_opsFE IS
    SELECT pu.person_code FROM people_units pu
    INNER JOIN unit_instances ui
    ON pu.unit_instance_code = ui.fes_unit_instance_code
    WHERE pu.unit_type = 'R'
    AND pu.progress_status ='A'
    AND pu.calocc_code LIKE '%12/13%'
    AND (pu.unit_instance_code LIKE 'Z%' OR pu.unit_instance_code LIKE 'V%')
    AND pu.unit_instance_code  NOT LIKE 'ZX%'
    AND ui.fes_source_finance <> 'HEFCE';
    v_recOpsFE PEOPLE.PERSON_CODE%TYPE;
    v_recOpsHE PEOPLE.PERSON_CODE%TYPE;
    BEGIN
    if :new.fes_user_29 is not null then
        if :new.fes_staff_code is not null and :new.staff_user_4 = 'Y' then   
    crt_keyholder:= 'create keyholder'||' ' ||'"'|| :new.person_code||'"'||' '|| 'longname = "' ||:new.forename ||' '||:new.surname||'"'||' '||'comment = ""'||' '||'info1 = ""'||' '|| 'info2 ='||' '||'"'||:new.fes_staff_code||'"'||' '||'info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
    addto:= 'addtocommunity keyholder'||' '||'"'|| :new.person_code ||'"'||' community = "Staff" defaultgroups = "Yes";';
    crt_key:= 'create key'||' '||:new.fes_user_29||' box = '||'"General Use"'||' '||'technology = "Magnetic";';
    issue:= 'issue key '||:new.fes_user_29||' '||'technology = "Magnetic" keyholder ='||' '||'"'||:new.person_code||'";';
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_keyholder,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',addto,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_key,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',issue,0,'');
      else if
      OPEN  c_opsHE;
      FETCH c_opsHE INTO v_recOpsHE;
      IF c_opsHE%FOUND THEN
      crt_keyholder:= 'create keyholder'||' ' ||'"'|| :new.person_code||'"'||' '|| 'longname = "' ||:new.forename ||' '||:new.surname||'"'||' '||'comment = ""' ||' ' ||'info1 = "" info2 = "" info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
    addto:= 'addtocommunity keyholder'||' '||'"'|| :new.person_code ||'"'||' community = "HEStudents" defaultgroups = "Yes";';
      crt_key:= 'create key'||' '||:new.fes_user_29||' box = '||'"General Use"'||' '||'technology = "Magnetic";';
      issue:= 'issue key '||:new.fes_user_29||' '||'technology = "Magnetic" keyholder ='||' '||'"'||:new.person_code||'";';
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_keyholder,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',addto,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_key,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',issue,0,'');
         end if;
         CLOSE c_opsHE;
      else 
      OPEN  c_opsFE;
      FETCH c_opsFE INTO v_recOpsFE;
      IF c_opsFE%FOUND THEN
      crt_keyholder:= 'create keyholder'||' ' ||'"'|| :new.person_code||'"'||' '|| 'longname = "' ||:new.forename ||' '||:new.surname||'"'||' '||'comment = ""' ||' ' ||'info1 = "" info2 = "" info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
    addto:= 'addtocommunity keyholder'||' '||'"'|| :new.person_code ||'"'||' community = "FEStudents" defaultgroups  = "Yes";';
    crt_key:= 'create key'||' '||:new.fes_user_29||' box = '||'"General Use"'||' '||'technology = "Magnetic";';
    issue:= 'issue key '||:new.fes_user_29||' '||'technology = "Magnetic" keyholder ='||' '||'"'||:new.person_code||'";';
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_keyholder,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',addto,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',crt_key,0,'');
        insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',issue,0,'');
        end if;
         CLOSE c_opsFE; 
      end if;
    else
    del_key:= 'delete key'||' '||:old.fes_user_29||' '||'technology = "Magnetic"'||';';
    insert into ug_command values (UG_SEQUENCE.nextval,'ORACLE',del_key,0,'');
    end if;
    EXCEPTION
        WHEN others THEN Raise;
    END;

    For better readability, I formatted your code.. please check what should be there in place of (0=0)..
    DECLARE
       crt_keyholder   CLOB;
       addto           VARCHAR2 (100);
       crt_key         VARCHAR2 (75);
       issue           VARCHAR2 (75);
       del_key         VARCHAR2 (75);
       CURSOR c_opsHE IS
          SELECT pu.person_code
            FROM    people_units pu
                 INNER JOIN
                    unit_instances ui
                 ON pu.unit_instance_code = ui.fes_unit_instance_code
           WHERE     pu.unit_type = 'R'
                 AND pu.progress_status = 'A'
                 AND pu.calocc_code LIKE '%12/13%'
                 AND (pu.unit_instance_code LIKE 'Z%'
                      OR pu.unit_instance_code LIKE 'V%')
                 AND pu.unit_instance_code NOT LIKE 'ZX%'
                 AND ui.fes_source_finance = 'HEFCE';
       CURSOR c_opsFE IS
          SELECT pu.person_code
            FROM    people_units pu
                 INNER JOIN
                    unit_instances ui
                 ON pu.unit_instance_code = ui.fes_unit_instance_code
           WHERE     pu.unit_type = 'R'
                 AND pu.progress_status = 'A'
                 AND pu.calocc_code LIKE '%12/13%'
                 AND (pu.unit_instance_code LIKE 'Z%'
                      OR pu.unit_instance_code LIKE 'V%')
                 AND pu.unit_instance_code NOT LIKE 'ZX%'
                 AND ui.fes_source_finance != 'HEFCE';
       v_recOpsFE      PEOPLE.PERSON_CODE%TYPE;
       v_recOpsHE      PEOPLE.PERSON_CODE%TYPE;
    BEGIN
       IF :new.fes_user_29 IS NOT NULL THEN
          IF :new.fes_staff_code IS NOT NULL AND :new.staff_user_4 = 'Y' THEN
             crt_keyholder :=
                   'create keyholder'
                || ' '
                || '"'
                || :new.person_code
                || '"'
                || ' '
                || 'longname = "'
                || :new.forename
                || ' '
                || :new.surname
                || '"'
                || ' '
                || 'comment = ""'
                || ' '
                || 'info1 = ""'
                || ' '
                || 'info2 ='
                || ' '
                || '"'
                || :new.fes_staff_code
                || '"'
                || ' '
                || 'info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
             addto :=
                   'addtocommunity keyholder'
                || ' '
                || '"'
                || :new.person_code
                || '"'
                || ' community = "Staff" defaultgroups = "Yes";';
             crt_key :=
                   'create key'
                || ' '
                || :new.fes_user_29
                || ' box = '
                || '"General Use"'
                || ' '
                || 'technology = "Magnetic";';
             issue :=
                   'issue key '
                || :new.fes_user_29
                || ' '
                || 'technology = "Magnetic" keyholder ='
                || ' '
                || '"'
                || :new.person_code
                || '";';
             INSERT INTO ug_command
                  VALUES (UG_SEQUENCE.NEXTVAL,
                          'ORACLE',
                          crt_keyholder,
                          0,
             INSERT INTO ug_command
                  VALUES (UG_SEQUENCE.NEXTVAL,
                          'ORACLE',
                          addto,
                          0,
             INSERT INTO ug_command
                  VALUES (UG_SEQUENCE.NEXTVAL,
                          'ORACLE',
                          crt_key,
                          0,
             INSERT INTO ug_command
                  VALUES (UG_SEQUENCE.NEXTVAL,
                          'ORACLE',
                          issue,
                          0,
          ELSIF (0 = 0) THEN
             OPEN c_opsHE;
             FETCH c_opsHE INTO v_recOpsHE;
             IF c_opsHE%FOUND THEN
                crt_keyholder :=
                      'create keyholder'
                   || ' '
                   || '"'
                   || :new.person_code
                   || '"'
                   || ' '
                   || 'longname = "'
                   || :new.forename
                   || ' '
                   || :new.surname
                   || '"'
                   || ' '
                   || 'comment = ""'
                   || ' '
                   || 'info1 = "" info2 = "" info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
                addto :=
                      'addtocommunity keyholder'
                   || ' '
                   || '"'
                   || :new.person_code
                   || '"'
                   || ' community = "HEStudents" defaultgroups = "Yes";';
                crt_key :=
                      'create key'
                   || ' '
                   || :new.fes_user_29
                   || ' box = '
                   || '"General Use"'
                   || ' '
                   || 'technology = "Magnetic";';
                issue :=
                      'issue key '
                   || :new.fes_user_29
                   || ' '
                   || 'technology = "Magnetic" keyholder ='
                   || ' '
                   || '"'
                   || :new.person_code
                   || '";';
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             crt_keyholder,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             addto,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             crt_key,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             issue,
                             0,
             END IF;
             CLOSE c_opsHE;
          ELSE
             OPEN c_opsFE;
             FETCH c_opsFE INTO v_recOpsFE;
             IF c_opsFE%FOUND THEN
                crt_keyholder :=
                      'create keyholder'
                   || ' '
                   || '"'
                   || :new.person_code
                   || '"'
                   || ' '
                   || 'longname = "'
                   || :new.forename
                   || ' '
                   || :new.surname
                   || '"'
                   || ' '
                   || 'comment = ""'
                   || ' '
                   || 'info1 = "" info2 = "" info3 = "" info4 = "" info5 = "" info6 = "" info7 = "" info8 = "" info9 = "" info10 = "" info11 = "" info12 = "" info13 = "" info14 = "" info15 = "" info16 = "";';
                addto :=
                      'addtocommunity keyholder'
                   || ' '
                   || '"'
                   || :new.person_code
                   || '"'
                   || ' community = "FEStudents" defaultgroups  = "Yes";';
                crt_key :=
                      'create key'
                   || ' '
                   || :new.fes_user_29
                   || ' box = '
                   || '"General Use"'
                   || ' '
                   || 'technology = "Magnetic";';
                issue :=
                      'issue key '
                   || :new.fes_user_29
                   || ' '
                   || 'technology = "Magnetic" keyholder ='
                   || ' '
                   || '"'
                   || :new.person_code
                   || '";';
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             crt_keyholder,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             addto,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             crt_key,
                             0,
                INSERT INTO ug_command
                     VALUES (UG_SEQUENCE.NEXTVAL,
                             'ORACLE',
                             issue,
                             0,
             END IF;
             CLOSE c_opsFE;
          END IF;
       ELSE
          del_key :=
                'delete key'
             || ' '
             || :old.fes_user_29
             || ' '
             || 'technology = "Magnetic"'
             || ';';
          INSERT INTO ug_command
               VALUES (UG_SEQUENCE.NEXTVAL,
                       'ORACLE',
                       del_key,
                       0,
       END IF;
    EXCEPTION
       WHEN OTHERS THEN
          RAISE;
    END;Cheers,
    Manik

  • IF elseif else usage

    So, now I've been trying to learn If, elseif and else statements properly.  And I'm doing something wrong. 
    A guy told me his website would email specific people based on what zipcode they put in the contact form on his site.  I was wondering how he did it, so I tried to recreate something similar.
    Here is what I've done:
    1. I created a file called zipcodes.php
    2. In this file it has set every zipcode to a variable.  For instance:
    <?php
    $Nashville=("37010" or "37027" or "37040" or "37055" or "37152");
    ?>
    3.  I created a form with a field called 'zip'.
    4. I created a php file called phpmail.php to send this form.
    5. Right now, the top of this file looks like this:
    <?php
    include("zipcodes.php");
    $zip=$_POST["zip"];
    //NASHVILLE//
    if ($zip==$Nashville)
    $my_email = "[email protected]";
    //Knoxville//
    if ($zip==$Knoxville)
    $my_email = "[email protected]";
    //Huntsville//
    if ($zip==$Huntsville)
    $my_email = "[email protected]";
    ...etc.
    This doesn't work.  It sends them all to the last option which is texas or [email protected]
    Before I had the first if set to if and all the others set to elseif
    But that didn't work.  It sent all the emails to Nashville email I made.
    If statements must work though in this way.  Because if I have this:
    if ($zip==$Nashville)
    $my_email = "[email protected]";
         //Anything Else//
      else $my_email = "[email protected]";
    It works.  Meaning if a zipcode is in Nashville it goes to one email - and if it isn't in Nashville - it goes to hippityhoppity.
    Am I not getting something about all of this?  Thanks!

    Yeah I know.  I also wish it'd let me use PHP syntax instead of plain.  I think it'd make things easier to read.
    Here is the entire script.  It is made to work with any form with little regard for what the form has in it.  So long as there is an email field and a zip field.
    <?php
    include("zipcodes.php");
    $zip=$_POST["zip"];
              if (in_array($zip, $Nashville)) {
    $my_email = ".....";
              }elseif (in_array($zip, $Knoxville)) {
    $my_email = ".....";
              }elseif (in_array($zip, $Huntsville)) {
    $my_email = ".....";
              }elseif (in_array($zip, $Florida)) {
    $my_email = ".....";
              }elseif (in_array($zip, $Georgia)) {
    $my_email = ".....";
              }elseif (in_array($zip, $SouthCarolina)) {
    $my_email = ".....";
              }elseif (in_array($zip, $NorthCarolina)) {
    $my_email = ".....";
              }elseif (in_array($zip, $Pennsylvania)) {
    $my_email = ".....";
              }elseif (in_array($zip, $Maryland)) {
    $my_email = ".....";
               }elseif (in_array($zip, $Virginia)) {
    $my_email = ".....";
               }elseif (in_array($zip, $Texas)) {
    $my_email = ".....";
    } else { $my_email = ".....";
    $continue = "/";
    $errors = array();
    if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}
    function recursive_array_check_header($element_value)
    global $set;
    if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc: )/i",$element_value)){$set = 1;}}
    else
    foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}
    recursive_array_check_header($_REQUEST);
    if($set){$errors[] = "You cannot send an email header";}
    unset($set);
    if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
    if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}
    $_REQUEST['email'] = trim($_REQUEST['email']);
    if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}
    if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
    function recursive_array_check_blank($element_value)
    global $set;
    if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
    else
    foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}
    recursive_array_check_blank($_REQUEST);
    if(!$set){$errors[] = "You cannot send a blank form";}
    unset($set);
    if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}
    if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}
    function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}
    $message = build_message($_REQUEST);
    $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";
    $message = stripslashes($message);
    $subject = "FormToEmail Comments";
    $headers = "From: " . $_REQUEST['email'];
    mail($my_email,$subject,$message,$headers);
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Dreamweaver Tutorial - Contact Form</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#ffffff" text="#000000">
    <div>
    <center>
    <b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b>
    <br>Your message has been sent
    <p><a href="<?php print $continue; ?>">Click here to continue</a></p>
    </center>
    </div>
    </body>
    </html>

  • IF elseif endif

    i m writing a report using if elseif condition...i m getting following error
    if v_x = 'X'.
    elseif v_y = 'X'.
    elseif v_z = 'X'.
    select ...into itab...
    loop at itab.
    select single....
    append itab2.
    endloop.
    elseif v-c = 'X'.
    else.
    endif.
    Above code is showing error as " NO Open IF Statement"
    at the elseif statement.pls hlp

    if p_upload eq 'X'.
        call function 'UPLOAD'
        if sy-subrc ne 0.
          message e000 with 'unable to read file'.
        else.
          if v_line gt 0.
            loop at i_itab.
              select single vbeln lifsk vdatu..
              if sy-subrc eq 0.
              endif.
            endloop.
          else.
          endif.
        endif.
      elseif p_del_gi eq 'X'.
          LOOP AT i_vbelv into wa_vbelv.
          select single kunnr auart lifsk vdatu..
           if sy-subrc = 0.
          endif.
        endloop.
      elseif p_req_dl eq 'X'.
        select vbeln lifsk vdatu into (vbak-vbeln, vbak-lifsk, vbak-vdatu)
        endselect.
      else.
        select vbeln lifsk vdatu into (vbak-vbeln, vbak-lifsk, vbak-vdatu)
        endselect.
      endif.
    Edited by: Matt on May 11, 2009 9:48 AM
    Edited by: Matt on May 11, 2009 9:48 AM - add  tags and removed unnecessary lines taking the post over the character limit.

  • Is there elseif in java??

    is there elseif in java??

    Seriously on Java Tiger revision they are implementing the import static.
    This will allow, for example to do:import static java.lang.Math.*;or something like that.
    That will allow lazy coders, like me :), to skip some repeting names.
    Instead of doing:Math.pow(x, Math.sqrt(x)*Math.log(x));this:pow(x, sqrt(x)*log(x));Convenient and readable, huh?

  • ASP/VB If ElseIf End If

    Does anyone know how to re-write this so that it actually
    works? Can't seem
    to find anythingthat gives me a solid enough clue even if I
    simplify it.
    Thanks,
    Craig
    SELECT *
    FROM notice
    IF jobtype = 'MMColParam' AND onoff=-1 AND ndate >= date()
    THEN
    ORDER BY ndate ASC
    ELSEIF 'MMColParam'='old' AND onoff=-1 AND ndate <= date()
    THEN
    ORDER BY ndate DESC
    END IF

    Probably because queries are part of the database and as such
    are written in
    SQL, not VBScript.
    Look up the CASE statement. In an SQL resource, not a VB
    site.
    "Craig" <[email protected]> wrote in message
    news:f49ei8$21p$[email protected]..
    > Does anyone know how to re-write this so that it
    actually works? Can't
    > seem to find anythingthat gives me a solid enough clue
    even if I simplify
    > it.
    >
    > Thanks,
    > Craig
    >
    > SELECT *
    > FROM notice
    > IF jobtype = 'MMColParam' AND onoff=-1 AND ndate >=
    date() THEN
    > ORDER BY ndate ASC
    > ELSEIF 'MMColParam'='old' AND onoff=-1 AND ndate <=
    date() THEN
    > ORDER BY ndate DESC
    > END IF
    >

Maybe you are looking for

  • HP LaserJet 2035 and 10.6.1 Now Supported -- Sorta?

    Just upgraded to 10.6.1 and I the driver was automatically downloaded from Apple for the HP LaserJet 2035n. Printing works great, except for the double-sided printing is now disabled. The print driver had double-sided printing in 10.5? Anyone else se

  • Can't edit in photoshop cc 2014

    When I right click on an image in LR5 I don't have the option to open in CC 2014, which has been installed. 

  • Wireless VLAN question

    I have two SSIDs on my Cisco 1242 APs. On one of the SSIDs i have clients that will constantly broadcast data (required). Will the brodcast traffic reach my other SSID? If so, is there a way to avoid it? Will creating a separate wireless VLAN on my A

  • Aperture 3 trial installation question

    I just received my free trial serial number and the instructions say to take Aperture 2 of my Application folder or rename it. What folder would be best to put Aperture 2 into?

  • How to Get the step name of MainSequence from SequenceFilePreStep / SequenceFilePostStep?

    I'm using SequenceFilePreStep & SequenceFilePostStep to get the test time of every step. Is there any way to get the step name of MainSequence that calls the PreStep & PostStep callbacks? Thanks