How to use multiple statements inside the "THEN" block of CASE statement?

Below is the code:
SET @strTempString = case @strKeyMode
WHEN 'AUTO/CYCLE'
THEN  @strRefID + '|' + @strRetID
WHEN 'CYCLE'
THEN  @strRefID + '|' + @strRetID
WHEN 'COMMERCIAL'
THEN  @strRefID + '|' + @strRetID
WHEN 'ISNAP'
THEN  set @strFName = ltrim(rtrim((Left(dbo.CleanTheStringAdv(@strFName + '  ', 2) + '  ', 2))))
'' + @strRefID + '|' + @strLName + '|' + @strFName + '|' + @strZIPorPolType
WHEN 'ASNAP'
THEN  @strRefID + '|' + @strRetID
WHEN 'MOAT'
THEN  @strRefID + '|' + @strRetID
else '0'
end 
The first 3 conditions are understandable. How to use multiple statements in 4th case?
Here I first want to set the value as:
set @strFName = ltrim(rtrim((Left(dbo.CleanTheStringAdv(@strFName + '  ', 2) + '  ', 2))))
and then return the string '' + @strRefID + '|' + @strLName + '|' + @strFName + '|' + @strZIPorPolType to @strTempString. 
Please help me remove the syntax errors.
Thanks in advance.

Try below SQL
DECLARE @strKeyMode varchar(20) = 'ISNAP'
DECLARE @SQL VARCHAR(MAX)
DECLARE @strRefID int=1
DECLARE @strRetID INT=2
--FIRST WAY
IF @strKeyMode ='AUTO/CYCLE'
SELECT CAST(@strRefID as varchar(10))
ELSE IF @strKeyMode ='CYCLE'
SELECT @sql = CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))
ELSE IF @strKeyMode='ISNAP'
SELECT @sql = CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))+'test'+'abc'
ELSE
SELECT @SQL='ABC'
print @sql
----SECOND WAY
SELECT @SQL = CASE @strKeyMode
WHEN 'AUTO/CYCLE' THEN CAST(@strRefID as varchar(10))
WHEN 'CYCLE' THEN CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))
WHEN 'ISNAP' THEN CAST(@strRefID as varchar(10)) + '|' + CAST(@strRetID as varchar(10))+'test'+'abc'
ELSE 'No Record'
END
PRINT (@SQL)
--Prashanth

Similar Messages

  • How to use multiple proxies at the same time?

    im planning to use multiple proxies at the same time on mac but i have no idea how to do it?!. i need help!thanks!

  • How to use multiple Interfaces for the same BS?

    Hi @ ,
    Is it possible to have a scenarion where i am using multiple interfaces in the same BS based upon some conditional field in the message.
    I amnot able to get the solution I know with condition editor I can have multiple receivers but in my scenarion based upon message fiels i have to decide which BAPI to be used and wht mapping and then post it to the same System
    Any help will be highly rewarded
    Regards

    Hi-
    Yes it is possible you can use multimapping for mapping the interfaces.
    To know more about multimapping see
    http://help.sap.com/saphelp_nw04/helpdata/en/21/6faf35c2d74295a3cb97f6f3ccf43c/content.htm
    Some more helpful links
    /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible

  • How to use multiple counters in the 6602 to measure cycle length, calculate delay and generate triggered pulse.

    Hi,
    I need to measure the cycle length of a pulse, calculate a delay based on this value, and then generate a triggered pulse with that delay value. The input and output pulses will be continuous. The best case would be to use the cycle length from one pulse in the calculated delay for the next pulse. One of my biggest problems has been getting the calculated delay value into the pulse specs.vi for the triggered output.
    This output pulse will be used to trigger an IMAQ video acquisition; therefore, the solution to this problem will be part of a larger video acquisition application. This has posed a problem, in that accessing the counters has interfe
    red with the triggered video acquisition.
    Any suggestion will be welcome.
    Thanks
    Dave

    Filipe,
    The overhead is the problem I'm trying to get around.
    Specifically, what I need to do is to generate an output pulse after a trigger pulse, which is a given percentage of the cycle length. The input pulse is from heart rate, so it will have some variance, and the output pulse will be at a stationary point in the cardiac cycle. For example, for an input pulse of 2 Hz (500 ms) the user would likely request the output pulse be delayed by 75%. Therefore, the generated pulse will have a 375ms delay after the trigger.
    In the past I have had hardware built to do this, but I am hoping I can accomplish the same thing with multiple counters on the 6602. I have been able to accomplish this with 3 counters (2 to measure period and 1 for output
    ) but the overhead prevents adequate triggering of the IMAQ video acquisition. I am hoping another method would solve this problem.
    Thanks
    Dave

  • How to use multiple instances of the same dll ?

    Hi,
    I'd like to use multiple instances of a jni dll . I have created
    different threads, in each thread, I have called System.loadLibrary(..),
    and I would like each thread to access a different instance of this
    library.
    Unfortunately, the loadLibrary function is effective only once so I
    can not find the way to do this.
    Can anyone help me on this ?
    Thanks.
    Francois.

    Hi, :)
    and I would like each thread to access a different
    instance of this library.In Win32, this is outright impossible. A DLL will only exist once in a process space.
    In Unix, or at least in Solaris, I think this is also not possible, as libraries are loaded by the dynamic linker, and it keeps tabs of which modules have already been loaded into the process space.
    I'm assuming your problem is that your native library has non-reentrant code.
    If so, there are two approaches you can take to this:
    1) If you have access to the source code for the native library, change it so that it is reentrant.
    2) If you do not, change your Java code so that access to the native code is made from whithin synchronize blocks.
    If your problem is of a different nature, I'll second the words of the previous poster and ask you what it is...
    Cheers,
    J.

  • How to use multi queries inside the RTF file

    Hi all,
    I develope a data source in report developer 10g, and use it to create the RTF files... I have some files wich contains more than 1 query. how can I refer to the fileds in the other queries in side the RTF file, because it's bring the filed from the first query by default??
    ThanX in advance

    ThankX DD
    But that wont work for my case. the problem that I have actually is in RTF.
    for example:
    I have 3 qeuries. A,B & C. A: contains the employee data. B: his Earnings and C: his Deductions.
    in the RTF file it shows me only A contents. wich means it's not entring B & C loops, notice I add <?for-each:B_GROUP_NAME?> and same for C also.
    all my other reports wich have single qeury worked fine.
    Regards to all,
    Message was edited by:
    Adam Ali

  • How To use APEX logout inside the Portal

    I am not using APEX at the moment, but I would like to use it. At the moment the only thing I want out of APEX is to give me the ability to log out (users) completely from the portal ( all sessions killed, cleared cookies etc, such that user after logging out of portal even if he tries to copy and paste URL ( of the portal page) can not log back in to the portal (of course on the same browser), rather gets redirected to SSO login page, where once again he is challenged for his credentials.
    Based on the little knowledge that I have about APEX. Can I achieve this in the portal. I have developed current portal using Portal Builder (IDE), using OID(LDAP) method of accomplishing SSO. I understand APEX is also another
    web based IDE, uses it's own way of implementing SSO. Will there be any difference between portal users and APEX users?
    My questions are:
    1. Do I have to rewrite the portal page for users, if I use APEX?
    2. If I leave my portal page the way it is, How can I accomplish users logging out?
    3. Does the login also have to be done by APEX, if I choose to do logout by APEX?
    4. How can I integrate APEX with existing portal page? I am not writing any APEX web applications. Just wanna use it for logging out.
    HAPPY NEW YEAR (2007) to all of the Portal, APEX gurus.
    I greatly appreciate your help.
    Very Best Regards,
    -Dhiren.

    No ideas regarding this topic?

  • How to use multiple languages at the same time for spell checking?

    I use two different languages all the time and words are mostly so different (English and Finnish) that I could have spell checking on for both languages at the same time.
    Now it seem to allow to select only one language at the time and I have to switch back and fort zillion of times per day.

    Thanks for the quick answer.
    The Dictionary Switcher doesn't seem to work with Finnish language, it doesn't detect it at all to be one of the choices although in the Firefox context menu Languages -> Finnish/Finland is shown.
    Also, if it would work, I would need to get rid of multiple EN_* langauges. I just need EN_UK or EN_US, not all 22 different EN_*.
    One option would be to create a custom dictionary, which would have words from both languages. The next task is then to find out how to make this kind of custom ENFI-dictionary, which would have words from both English and Finnish languages.
    Finnish may be a some kind of special case for spell checking anyway, because the support is in its separate plugin:
    http://voikko.sourceforge.net/

  • How to use multiple profiles within the same instance of Thunderbird

    About a month ago, I had Thunderbird configured with three profiles,
    and all three could be used within a single startup/instance of
    Thunderbird. That PC is now gone. I have re-configured the three
    profiles on a new PC, but am having trouble making all three
    useable within the same instance of Thunderbird. Can you help?
    Both PCs are/were Windows-7 64 bit.

    Thunderbird only opens on the default if one profile
    or
    if Profile Manager is instructed to ask at startup it will allow you to choose which Profile to open else it opens on the last Profile used..
    So it shows one Profile at a time in one instance of Thunderbird.
    However, one Profile can have many mail accounts.
    eg: I run 4 mail accounts in one Profile.

  • How to use multiple language at the same time

    Hi,
        I have one dimension, and its desc is in English,I had a need to have another language, so created one attributes "Language1"
    and inserted Russian translation, But after uploading the data those russian characters are not getting identified by the system and it is showing "?" instead.
    Any idea?
    Thanks
    Anupam

    Do you have into .Net server Rusian fonts installed?
    For example into your .NET server are the Rusian chars recognize?
    Regards
    Sorin Radulescu

  • How to use BAPI_SALESORDER_CHANGE to remove the billing block?

    Dears,
    I want to remove billing block using FM  BAPI_SALESORDER_CHANGE,
    I know it is associated with inport parameter ORDER_HEADER_IN, and the associated field is BILL_BLOCK, and this field should find
    in table VBAK-FAKSK.
    but if for a SO , the VBAK-FAKSK is not initial, and I want to remove its billing block, How should I do?
    Any body could help me?
    Thanks a lot.
    Julie.

    dear
    done.
    Thanks a lot.
    Julie

  • RPD: How to use multiple-value variables in initialization blocks ?

    Hi all,
    I have a set of initialization blocks required for authentication, two of which are running row-wise. The first one sets a multi-valued variable, and the second one uses this variable.
    Or at least, should use, because it actually fails. The NQServer log says
    [nQSError: 13011] Query for Initialization Block 'My_Init_Block_2' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.MY_VAR_1, has no value definition.
    My first variable is initialized in a basic row-wise initialization block. What's more, if I say my 2nd block isn't required for authentication, and I read in a narrative the contents of my first variable, it contains the set of value I expect it to have.
    can anybody please advise?
    thanks in advance!
    Cedric..

    There is an example in the OBIEE Server Administration manual that looks very similar to your code except that the whole of the valueof string is quoted:
    select
    NAME, VALUE from RW_SESSION_VARS
    where USERID='VALUEOF(NQ_SESSION.USERID)' {code}<br /><br /><br /><br />Pete                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to use multiple selection parameters in the data model

    Hi, after have looked all the previous threads about how to use multiple selection parameters , I still have a problem;
    I'm using Oracle BI Publisher 10.1.3.3.2 and I'm tried to define more than one multiple selection parameters inside the data template;
    Inside a simple SQL queries they work perfectly....but inside the data template I have errors.
    My data template is the following (it's very simple...I am just testing how the parameters work):
    <dataTemplate name="Test" defaultPackage="bip_departments_2_parameters">
    <parameters>
    <parameter name="p_dep_2_param" include_in_output="false" datatype="character"/>
    <parameter name="p_loc_1_param" include_in_output="false" datatype="character"/>
    </parameters>
    <dataTrigger name="beforeReport" source="bip_departments_2_parameters.beforeReportTrigger"/>
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    select deptno, dname,loc
    from dept
    &p_where_clause
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_DEPT" source="Q2">
    <element name="deptno" value="deptno"/>
    <element name="dname" value="dname"/>
    <element name="loc" value="loc"/>
    </group>
    </dataStructure>
    </dataTemplate>
    The 2 parameters are based on these LOV:
    1) select distinct dname from dept (p_dep_2_param)
    2) select distinct loc from dept (p_loc_1_param)
    and both of them have checked the "Multiple selection" and "Can select all" boxes
    The package I created, in order to use the lexical refence is:
    CREATE OR REPLACE package SCOTT.bip_departments_2_parameters
    as
    p_dep_2_param varchar2(14);
    p_loc_1_param varchar2(20);
    p_where_clause varchar2(100);
    function beforereporttrigger
    return boolean;
    end bip_departments_2_parameters;
    CREATE OR REPLACE package body SCOTT.bip_departments_2_parameters
    as
    function beforereporttrigger
    return boolean
    is
    l_return boolean := true;
    begin
    if (p_dep_2_param is not null) --and (p_loc_1_param is not null)
    then
    p_where_clause := 'where (dname in (' || replace (p_dep_1_param, '''') || ') and loc in (' || replace (p_loc_1_param, '''') || '))';
    else
    p_where_clause := 'where 1=1';
    end if;
    return (l_return);
    end beforereporttrigger;
    end bip_departments_2_parameters;
    As you see, I tried to have only one p_where_clause (with more than one parameter inside)....but it doesn't work...
    Using only the first parameter (based on deptno (which is number), the p_where_clause is: p_where_clause := 'where (deptno in (' || replace (p_dep_2_param, '''') || '))';
    it works perfectly....
    Now I don't know if the problem is the datatype, but I noticed that with a single parameter (deptno is number), the lexical refence (inside the data template) works.....with a varchar parameter it doesn't work....
    So my questions are these:
    1) how can I define the p_where_clause (inside the package) with a single varchar parameter (for example, the department location name)
    2) how can I define the p_where_clause using more than one parameter (for example, the department location name and the department name) not number.
    Thanks in advance for any suggestion
    Alex

    Alex,
    the missing thing in your example is the fact, that if only one value is selected, the parameter has exact this value like BOSTON. If you choose more than one value, the parameter includes the *'*, so that it looks like *'BOSTON','NEW YORK'*. So you need to check in the package, if there's a *,* in the parameter or not. If yes there's more than one value, if not it's only one value or it's null.
    So change your package to (you need to expand your variables)
    create or replace package bip_departments_2_parameters
    as
    p_dep_2_param varchar2(1000);
    p_loc_1_param varchar2(1000);
    p_where_clause varchar2(1000);
    function beforereporttrigger
    return boolean;
    end bip_departments_2_parameters;
    create or replace package body bip_departments_2_parameters
    as
    function beforereporttrigger
    return boolean
    is
    l_return boolean := true;
    begin
    p_where_clause := ' ';
    if p_dep_2_param is not null then
    if instr(p_dep_2_param,',')>0 then
    p_where_clause := 'WHERE DNAME in ('||p_dep_2_param||')';
    else
    p_where_clause := 'WHERE DNAME = '''||p_dep_2_param||'''';
    end if;
    if p_loc_1_param is not null then
    if instr(p_loc_1_param,',')>0 then
    p_where_clause := p_where_clause || ' AND LOC IN ('||p_loc_1_param||')';
    else
    p_where_clause := p_where_clause || ' AND LOC = '''||p_loc_1_param||'''';
    end if;
    end if;
    else
    if p_loc_1_param is not null then
    if instr(p_loc_1_param,',')>0 then
    p_where_clause := p_where_clause || 'WHERE LOC in ('||p_loc_1_param||')';
    else
    p_where_clause := p_where_clause || 'WHERE LOC = '''||p_loc_1_param||'''';
    end if;
    end if;
    end if;
    return (l_return);
    end beforereporttrigger;
    end bip_departments_2_parameters;
    I've written a similar example at http://www.oracle.com/global/de/community/bip/tipps/Dynamische_Queries/index.html ... but it's in german.
    Regards
    Rainer

  • How java support multiple inheritance by the use of interface.

    As per my understanding, Interface is just having the signatures of the methods not the implementation.
    So How java support multiple inheritance by the use of interface?
    Answer 1: we can institate interface reference by its implemented
    class.
              ����� interface inf...
              ����� class aa implements inf..
              ����� class bb implements inf....
               Now, inf i = new aa();
               inf i = new bb();
    Answer 2: We can extends as many interface as we want in the
    single
               interface.
               i.e. interface infFirst....
               interface infSecond....
               interface infThird....
               Now ,
               interface ingMulti extends infFrist, infThird...
    By above two answers its not prity clear as per the multiple inheritance in C or C++.
               i.e.
               class first{
               method abc();....}
               class second{
               method bbc()......}
               class multi::first::second{
               we can call to abc();.....as well as bbc();
    -Please give your important suggstion on the same.(Hope I explain it well.)
    -Jeff

    The keyword implement is used only for interfaces not
    for abstract class. If i am wrong correct me.I believe your right, but I will double check.
    As for the multiple inheritence think about the following code:
    class Animal {
        //  Animal generic stuff in this class
    interface Eat {
        //  Generic stuff that models eating behavior
    interface Runs {
        //  generic methods that model running behavior
    public class Horse extends Animal implements Eat, Runs {
        //  Stuff specific to a horse
    }The Animal class is generic but has stuff in it common to all animals.
    The Eat interface models behavior that is generic to eating, all living things have to eat something to survive. Herbavore are different from carnivores.
    The Runs interface models generic behavior to running, such as speed. A cheeta definately runs faster than a human.
    This brings us to the Horse class. It extends the Animal class because it "is-a" animal, and it implements the eat and runs interface because they are behaviors a horse has.
    I hope that helps.
    Extending an abstract class is the same as extending a regular class with the exception you MUST override all abstract methods in the abstract class. Thats not too difficult but I believe when designing classes, designing an abstract can be more diffecult than modeling the base class, and generic behaviors in interfaces. JMO.
    JJ

  • How to select multiple values from the Parameters in the concurrent program

    How to select multiple values from the Parameters defined in the concurrent program...and i believe multiple selection is not a direct feature of EBS, but is there any workaround solution to acheive mulitple selection?

    I think there's no way to do that using standard feature.
    Some workaround I use :
    1. If the number of selections are fixed, you could use multiple parameters for the same valueset. For example :
    Selection1 : <choose first selection>
    Selection2: <choose 2nd selection>
    ..etc.
    If you don't use it then leave it empty.
    2. Use text varchar valueset and enter it manually and separate by comma (or other value) , eg : selection1,selection2,selection3....etc.

Maybe you are looking for

  • PSE 6.0 will not display photo collage theme or layout

    I just purchased PSE 6.0 for imac on Tues.  I would like to use the photo collage option, but zero options work.  I installed it/uninstalled it and it still did not fix it.  It is in the process of downloading ADOBE BRIDGE CS3 WITH START MEETING 1.0.

  • Bug report for SS10U1 fortran compiler

    I am getting an internal error when compiling a larger fortran source file: f90: Internal Error, code=fw-assert-einln-835, last src=mbd.f:14 If I first split the file and then compile the separate routines, the compiler survives: fsplit mbd.f f95 -c

  • Use html code in web page composer 7.3

    Hi all, I have a question about the standard editors of web page composer in 7.3. I want to create my own HTML code for the design of the portal page.. Is it possible to use the code through one of the standard editors? At the moment I have created s

  • Photo count

    Everytime I open iPhoto, the number of items in my albums change.

  • Accessing nested child in model to populate datafield in datagrid.

    I am using Rails + Flex and I have problems to access nested xml in a datagrid.datafield. I reproduce this in a simple mxml sample: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" wi