Doubt in Decode and Using Temporary variable

I was facing the following issue,
For example,
The column_name if A should be stored with the value B or, with itself for which I included a statement as following,
Case [1]
SELECT ....DECODE(column_name,'A','B',column_name) alias_name
     FROM table_name
          WHERE condition;
But,
when i used a temporary variable as following i could not get the expected change,
Case [2]
SELECT ...column_name
     FROM table_name
          WHERE condition;
temp VARCHAR(10);
BEGIN
IF column_name='A' THEN
     temp:='B';
ELSE
     temp:=column_name;
END IF;
END;
I was able to get the right output in Case[1],but failed to get in [2]. Please help and Thanks in advance.

Without seeing your code, whatever I can say might be just an assumption. I can give an example to show that it will work.
SET SERVEROUTPUT ON
DECLARE
  var      VARCHAR2(10);
  col_name VARCHAR2(30);
  TEMP     VARCHAR2(20);
BEGIN
  SELECT column_name
  INTO col_name
  FROM user_tab_columns
  WHERE table_name = 'EMP'
  AND rownum       =1;
  IF (col_name     ='EMPNO') THEN
    temp          := 'X';
  ELSE
    temp := col_name;
  END IF;
  var := 'abc '||temp;
  dbms_output.put_line(var);
END;
OUTPUT :
abc X
PL/SQL procedure successfully completed.

Similar Messages

  • Creating variables in Process Flows and using thse variables in the filter

    Hi,
    I am new to OWB and in learing stage. Need to information.
    *1. as to how pass/create/use variables to OWB mapping ?*
    *2. Creating variables in Process Flows and using thse variables in the filter operator of the OWB mapping?*
    *3. Other mechanisms of how to create/use variables within OWB mapping itself ?*
    can you please provide the above details and guide me / help me in this regard.
    Thanks,
    skms.

    1. Add parameters to your mapping using the MAPPING INPUT PARAMETER from the pallette.
    2. Add parameters to the START operator in the process flow. Bind the process flow parameter to the Mapping parameter.
    3. May be appropriate to use CONSTANTS instead of parameters.
    Regards
    Si

  • Declare, Set, and Use a variable in a SQL Developer Query

    I come from the SQL Server world and am trying to do something very simple: Declare, set, and use a variable in a query. For example:
    Declare @lastPeriod date;
    Set @lastPeriod = (select max(payperiod) from table 1 where payperiod < current_date);
    Select field 1,
    Field2
    From table2
    Where payperiod = @lastPeriod
    The variable is going to be used in more areas in the query which is why I am simply not using a Sub-query in the where clause. I appreciate any assistance.

    This forum is for issues with the SQL Developer tool. You'd get more response in the SQL And PL/SQL forum.
    That said, read up on bind variables and substitution variables.
    Whenever you can you should use Bind variables (e.g. *:lastPeriod* ), as they increase performance. In sqldev, there's no need to declare as you will be prompted to enter them on execution (F9), but you do if you execute as script (F5) (e.g. VARIABLE lastPeriod VARCHAR2(30);).
    Alternatively, Substitution variables (e.g. *&lastPeriod* ) will literally be substituted in your statement before the database parses it. In sqldev, there's no need to declare as you will be prompted to enter them on execution (either F9 or F5), but you can (DEF lastPeriod='TEST'; ).
    Have fun,
    K.

  • Using a Meter control in LV Touch Panel, and using shared variables that are custom controls.

    I Just started using LV touch Panel module with an NI TPC-2106.
    I have two differenct problems:
    1) I was planning on using the "Meter" control quite a bit. I can set up the meter exactly how I like on the host PC, but on the touch Panel computer it seems to ignore my adjustments, mainly the start and end of the scale - i.e. I would like control to run from 0 to 360 with 0 straight up, using the entire circle. However, on the Touch panel computer it always puts 0 at about 7 o'clock and 360 at about 5 o'clock. I have also tried adding markers to no avail.
    2) I am communicating with a compact fieldpoint controller. I can creat a shared variable that is a simple double with no problems. However, I have some shared variables that use a custom control for the variable type - bascially a cluster with a couble doubles, a time stamp, and an enumeration. It lets me drag the shared variable into my diagram, but it seems to ignore it when I run it.

    Ipshita_C,
    - I am using LV 8.6.1f1and LV Touch Panel 8.6.1.
    - I have attached a simplified VI that shows how I want to use the meter. Notice that the placement of the endpoitns does not work correctly on the touch panel, and that it ignores the arbitrary markers that I placed.
    - I also have included an XY graph control that displays on the TPC with margins around the graph area that I removed from the graph control.
    - For the shared variable, it appears to be an issue related to the touch panel, not fieldpoint. I found another thread in this forum that mentioned that clusters containing Enumerations do not work in shared variables on the touch panel. I changed the enumeration to an integer and it now works fine.
    In general, there seem to be a disappointing number of limitations in the touch panel implementation. My biggest concern is that I have not found any documentation from NI that lists these limitations. I seem to have to try things out and see what works and what does not work. Can you point me to a comprehensive list of touch panel modules limitations?
    Attachments:
    test 2.vi ‏10 KB

  • How to declare and use a variable in BI Publisher report

    Hi Experts ,
    I have to groups of serial numbers and both group are put in same table and same row one after another , and i have a condition that if no serial number is present in both group than the line of that table should not be appeared ,i used the condition region ,biut this condition region is working in single group case if i put both groups together ,the blaing line appears with its label ,I think if i will have have variable which can count the total present of serial number than I cant put a single condition ,would you please help me ,how can I declare a variable and how can i count the number of serials in both groups ,please find below the example
    <grp1><?SR_NUM1?><end of grp1> <grp2><?SR_NUM2?><end of grp2>
    above example is how i am printing now ,now i need a combined condition where if bot group do not contain any value then this blank line should not appear . thanks in advance.
    Thanks
    Pratap

    Hi ,
    Decalring the Varible :
    <?xdoxslt:set_variable($_XDOCTX, 'var', 0)?>
    Do the calculation :
    <?xdoxslt:set_variable($_XDOCTX,'var', xdoxslt:get_variable($_XDOCTX,'var‘)+ XML columnname)?>
    Display the Variable :
    <?xdoxslt:get_variable($_XDOCTX, 'var')?>
    Declare the varaible before your loop starts.Do the calculation part inside the loop so for each row it will be updated.
    Display the results where you want using the form field and place the display varaible syntax.
    Hope this will helpful for you.
    Thanks,
    Ananth

  • Getting the GUI to access and use changed variables

    Hi,
    I'm trying to implement a GUI which when you click the new button, a new Jframe appears on screen. The user then selects an item from a list and clicks ok. The item they select is then used as an argument to call a method from the system class. The problem is when I run the program, the GUI gets the values of the variables from the system class, before the new button and the item are selected. How can I make the Gui get the new values.?? Any help would be great as its doing my head in,
    cheers

    The problem is when I run the program, the GUI gets the values of the
    variables from the system class, before the new button and the item are selected. No idea what you are talking about.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • How to Create and Use Application Variables in Java

    I Have this need to have a common variable (Counter) for all the users(Sessions) accessing my Site witch is in JSP.
    I think An Application Variable is the solution for my problem...
    But I don't know how to use this. Even though I search the web for any tutorials or Examples could not fing any.
    Could any one Please tell me or direct me to a site which has good information about this
    Thanks In Advance!!!
    Badsy.

    // get the application object
    public class myServlet extends HttpServlet
    public void doGet(HttpServletRequest req,
                        HttpServletResponse res)
    ServletContext application = getServletContext();
    }

  • Include and use custom variables in alert container.

    Hi,
    I want to include payload specific information in my alert mails. I am looking forward to this approach, to help my customer, directly understand the alert mail by pin pointing a few payload specific primary fields.
    I have gone through a few blogs, forum threads and SAP help documents and all say that this is not directly possible in ALRTCATDEF. 
    Please suggest how i can achieve this without using BPM.
    Warm Regards,
    Anshul

    Dear Francis,
    I have gone through this blog already.
    To give you a jest of my scenario:
    Itu2019s like ECC to PI to SQL synchronous communication. Now if there is a communication error between PI and SQL or there is an error on SQL then how can i use this UDF-RFC combination to raise alerts with payload specific information?
    Would appreciate if you can give your inputs on this.
    Warm Regards,
    Anshul

  • Unable to Declare a Temporary Variable in Calc Script

    We are using Hyperion System 9 BI+ Analytic Administration Services. 9.2.03.0.44
    I am trying to declare a temporary variable in a calculation script.
    We have found several guides and examples in the support documentation that give us a step by step instruction on how to 1.) declare the variable, then 2.) Assign a value.
    Example:
    /* Declare the variable */
    VAR TotalAllocDept;
    /* Baseline Fix */
    FIX ("FY10","Jan","BU Version_1", "Actual", "NoProd", "NoCust")
    /* Assign a value to the variable */
    TotalAllocDept = ("Alloc_HR"+"Alloc_IT"+"Alloc_FIN");
    ENDFIX
    /* Allocate overhead based on Total Alloc Dept Variable */
    FIX ("FY10","Jan","BU Version_1", "Actual", "NoProd", "NoCust")
    "Alloc_5xSS" = @ALLOCATE("Alloc_Overhead","Account", TotalAllocDept,, share);
    ENDFIX
    However, when we try to check the syntax, we are given various error messages such as:
    Error parsing FIX STATEMENT "invalid object type" and
    "Invalid member name" and
    Invalid Calc Script syntax.
    Can anyone suggest some techniques that we can try or alternative ways of entering the text to make it possible for us to use temporary variables?

    A variable must be declared within a calc member block and can only exist for the scope of that block.
    This would work (not that you would necessarily want it)"
    /* Allocate overhead based on Total Alloc Dept Variable */
    FIX ("FY10","Jan","BU Version_1", "Actual", "NoProd", "NoCust")
    "Alloc_5xSS"
    TotalAllocDept = ("Alloc_HR""Alloc_IT""Alloc_FIN");
    "Alloc_5xSS" = @ALLOCATE("Alloc_Overhead","Account", TotalAllocDept,, share);
    ENDFIX
    Regards,
    Cameron Lackpour

  • Use of variables in obiee

    Hello!!!
    I m new to the forum and wanna your help,next week i have to give a presentation on variables , i know how to create them and about their scope but wanna implement its use.(use of all types of variables ie,(repo sitory(static and dynamic),session(system and non system) and presentation.
    Furthermore i wanna know about the use and what are presentation variable
    So pls help, asap
    Regards,
    Priyanka

    And what do you don't know?
    How to set a presentation variable in dasboard? Answer: use a prompt see in here: http://gerardnico.com/wiki/dat/obiee/presentation_variable
    How to use a variable after is set? It is very well described in http://shivabizint.wordpress.com/2008/10/02/oracle-bi-ee-variables-overview/ @{var_name}{defaultvalue}
    you can filter data:
    - static 'col = value'
    - is prompted (in this case it will be filtered on value that comes from navigation or from a prompt)
    - on other request
    - finally from a variable
    you can use variable to make for example topn and the user wants to modify number of topn
    so you set a variable from a prompt and use that variable on topn(value, @{var_nr_values})
    you can find a lot of docs on this topic, kart give you some links...
    Make research, and when you have a problem please come back with the isue and we happily try to help...
    Regards
    Nicolae

  • Using a variable db link for an interactive report

    I have a requirement where users will select an instance (db link) from an apex LOV and the data in an interactive report will query based on the db link selected.
    I can use a db link in an interactive report query but only if I provide the exact name of the link. If I do something link select * from foo@:P12_DBLINK it doesn't work.
    It seems my only option is to use something like apex_collection.create_collection_from_query and then I can build my query with dynamic sql and use a variable for the dblink name. Then I just create an IRR based on my collection.
    Does that sound like that correct approach and/or am I missing anything?
    Any suggestions are most appreciated,
    john

    I guess I have it working ok. I am able to create a region of type 'PL/SQL Dynamic Content' and do something like this and it works. As I change the dblink select list the report refreshes with data from that instance. Pretty cool! I just can't believe it's this much work to do this. This is just one column of data and I have about 10 columns that I need to display:
    declare
    type array_t is varray(100) of number;
    array array_t;
    l_sql varchar2(4000);
    begin
    l_sql := 'SELECT credit_card_trxn_id FROM EXM_CREDIT_CARD_TRXNS@'||:P4_DBLINK;
    execute immediate l_sql BULK COLLECT INTO array;
    for i IN 1..array.count
    LOOP
    HTP.p (array(i));
    HTP.br;
    END LOOP;
    end;

  • Using a Temporary Variable in PCR

    Hi All
    Please suggest for the following.
    How can I use a temporary variable in a PCR.
    Say if I need to transfer the AMT of WT 4100 to a variable like 'XYZ=4100' in PCR.....What variable I can use and what is the correct syntex for this. And how can I use the same variable for further calculations.
    Please suggest.

    Hi Friends
    Thanks for your precious suggestions.
    I understood your point but if I need to transfer the value of a wage type in a variable as mentioned below then how can I do that....
    4000
    OUTWPPERSB
    Z1
    XYZ=/102 (Value of /102 should be transfered to XYZ so that can be used for further processing. Or If there is other way to solve this then please suggest.)
    Here this PCR should work only if there is a Wage Type 4000. And when it finds 4000 in Payroll and enter into this PCR then wage type /102 should be multiplied with a constant stored in T511K & the result of that should be stored in 5000. '/102' should not change.
    Please suggest

  • Doubt in concepts and scenarios where used

    doubt in differentiating and scenarios for below.
    statistics Vs document update      -  i already know the definitions of V1 V2 V3 updates, pls dont give defn links
    conditions Vs global filters in QD     and scenarios
    btree/bitmap index         and scenarios
    reconstruction Vs repair   and scenarios
    already searched forums, didnt get satisfactory answer.
    pls suggest.
    Edited by: Swetha N on Jan 20, 2012 10:10 AM

    Conditions - You want to get the top 10 customers, you can use condition to get the same. done during the execution, before displayign the data. last step in the report execution.
    Filters - You can filter only particular plant, customer etc. will be done before query execution, kind of starting point for qery execution.
    Btree / Bit map - in addition to Venkatesh said - Bit Map is read optimized and B Tree is write optimized.
    Reconstruction - used in 3.x flow. if a request got deleted by request you can retriev it. Go to reconstruction tab and select the request and do reconstruction.
    Repair - I guess you are asking repair full request, if it so, it is a way to pull the data from R3. with some selection that can be defined at the info package for example you found one purchase order with some incorrect data, what you do is delete selectively the purchase order from the system and do full repail request. You can define the same at info provider level.
    Document update - you change a Purchase order from Me22n, the document will get update in the r/3 backend table EKKO EKPO etc. Statistical update is from the R/3 reporting table perspective, these are LIS tables.

  • Using Shared Variables and Initialize Front Panel Binding (to PSP)

    Hi,
    I use LV DSC RT 8.2.1
    I have a Vacuum System That includes signals from - Pumps failure, Valves status, Vacuum gauge, start Pump ...
    Each signal is read by a FieldPoint. 
    All the relevant FieldPoint Channels are read by the Server (a computer in the Ethernet Network) and published to the network in the form of Shared Variables.
    I have a client VI that is reading the Shared Variables published by the Server using Front Panel Binding.
    Problem : 
    Some of the Bindings are in the mode 'Write &Read' and that causes some initialization problems.
    For example - Valve #1 is Open, and then a User start running the Client VI, (the Valve #1 Status mode is 'Write & Read")
                           if in the VI the status of Valve #1 is closed (before running it) then the Valve status is changing to Closed.
    I want the Client VI to first read the Physical status of the instrument and then to change the Value if the User changes it.
    But that's seems to be a problem when using Front Panel Binding... (is it?)
    I know I can Deploy a lvlib in the Client Side and Item Bind to the Shared Variables or Use DataSocket.
    (Is DataSocket is a Reliable method when connecting to Shared Variables? What are the disadvantages when using DataSocket?) 
    What is recommended by those of you that are experienced or by NI ?
    Sincerely Yours,
    Amitai Abramson.

    Amitai Abramson,
    Hello and thanks for using the NI Forums.
    I'm glad that you've read the Using the LabVIEW Shared Variable Tutorial on our website. Check out these other resources:
    Network Variable Technical Overview
    Troubleshooting Network-Published Shared Variables
    Why Do I See Unexpected Value Change Events for Shared Variables Using LabVIEW DSC?
    All You Need to Know About Shared Variables
    Creating a Value Change Event for Shared Variables
    Alternative Method for Using Shared Variables Between Systems in LabVIEW 8.x
    What Is The Difference Between Using Shared Variables And DataSocket VIs To Access OPC Tags?
    The issue that you are seeing by having "Write & Read" bound items on both the server and client side is essentially a race condition, you don't know which one is being read/written at what time. To resolve this issue I would take a look at some of the documents below.
    Using a Local, Global, or Shared Variable in Parallel Loops Can Cause Race Conditions
    Using Local and Global Variables Carefully
    Tutorial: Local Variable, Global Variable, and Race Conditions
    Locking a Shared Resource or Variable in LabVIEW Using Semaphores
    You mentioned not wanting to have two sets of shared variables (one on each side), but this is a great method to resovle this issue, that, or you can develope some sort of hand shaking to prevent these race conditions.
    I would suggest that in the future when using these forums you try to ask only one question per thread and make it more concise. It's hard to tackle multiple questions and such broad questions as "I want to know all the ways that I can connect to Shared Variables, and I want to know the advantages and disadvantages." I suggest this because we want you to get your questions answered and more concise questions will result in quicker and better answers. 
    Message Edited by Ben S on 10-01-2009 06:05 PM
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • How to derive value from another variable and use it to read master data?

    Hi,
    I have following case:
    First I need to read the value from Cost Center -variable (ZIPCC) and then I need to use that value to determine the home currency of that cost center from the cost center master data table (field: OBJ_CURR).
    I know to basic idea on how to do this, but don't seem to get the syntax correct. Could someone point me in the right direction?
    So the objects in play are:
    ZIPCC = Cost center selection variable (mandatory, single value)
    ZIPCUR = Cost Center Currency variable (customer exit, single value)
    0COSTCENTER
    0OBJ_CURR = Field in cost center master data
    Help will be greatly appreciated!
    -m

    Hi,
    Thank you very much for your example I can see that this logic works! However I'm experiencing trouble in selecting the 0OBJ_CURR
    This kind of declaration isn't working: "D1 Like /BIC/0OBJ_CURR."
    And the same goes for the Selection:
    "Select single OBJ_CURR into D1 from /BI0/PCOSTCENTER where COSTCENTER = i_t_var_range-low."
    This is where my syntax also went wrong.
    0OBJ_CURR is a unit, is there a special way to declare it and use it in the code?
    (and 0CURRENCY is a reference unit for 0OBJ_CURR).
    Do you have adivce on this?
    -miikka

Maybe you are looking for

  • Types of error codes in CX_AI_SYSTEM_FAULT

    Hi, all In the help.sap.com, "Error Handling"  http://help.sap.com/saphelp_nw2004s/helpdata/en/25/a45c3cff8ca92be10000000a114084/frameset.htm it says like the following. Handling System Errors You catch errors that occur when transferring a message b

  • Anyone else been shocked by a lightning cable?

    I feel asleep this morning and apparently rolled onto my lightning cable. It was still plugged into the wall but not my phone. When I woke up I had this pain in my arm that felt like a bug bite. I soon realized there was a shape of a ligtning plug an

  • Is there any library with new components for download and put into multisim? I need ISO124 and I don't know how to make it...

    People, I am not experient on Multisim and I'd need help to make one component. First, is there any library or something for me to download components that are necessary and are not there? If there isn't, can someone help me to find ISO 124 (isolatio

  • Launch Process Chain in dialog mode using WAD

    Hi, I check that I can associate the process chain launch using a button in WAD. Does someone know if there is a way to launch this in dialog and NOT in batch mode? My main issue is that I'd like to know who launch this process chain, and in batch mo

  • Calculate measure using dates

    I am facing difficulty to calculate date difference of two dates Dimension contains ID, Name, CreateDate, CloseDate I would like to calculate CreateDate - CloseDate but i am getting #error by creating calculate measure within the CUBE datediff("d",[D